Questions tagged [cursor-position]

Cursor position change using j-Query.

Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element.

414 questions
663
votes
14 answers

How to move screen without moving cursor in Vim?

I recently discovered Ctrl+E and Ctrl+Y shortcuts for Vim that respectively move the screen up and down with a one line step, without moving the cursor. Do you know any command that leaves the cursor where it is but moves the screen so that the line…
ereOn
  • 48,328
  • 33
  • 147
  • 228
225
votes
11 answers

How to set caret(cursor) position in contenteditable element (div)?

I have this simple HTML as an example:
text text text
text text text
text text text
I want simple thing - when I click the button, I want to…
Frodik
  • 13,164
  • 22
  • 83
  • 132
146
votes
8 answers

Set cursor position on contentEditable

I am after a definitive, cross-browser solution to set the cursor/caret position to the last known position when a contentEditable='on'
regains focus. It appears default functionality of a content editable div is to move the caret/cursor to…
GONeale
  • 25,353
  • 21
  • 101
  • 146
138
votes
13 answers

Get contentEditable caret index position

I'm finding tons of good, crossbrowser anwers on how to SET the cursor or caret index position in a contentEditable element, but none on how to GET or find its index... What I want to do is know the index of the caret within this div, on keyup. So,…
Bertvan
  • 3,837
  • 5
  • 36
  • 59
94
votes
7 answers

How to move cursor to end of contenteditable entity

I need to move caret to end of contenteditable node like on Gmail notes widget. I read threads on StackOverflow, but those solutions are based on using inputs and they doesn't work with contenteditable elements.
avsej
  • 3,498
  • 3
  • 24
  • 31
90
votes
4 answers

Setting cursor at the end of any text of a textbox

I have a text box with a displayed string already in it. To bring the cursor to the textbox I am already doing txtbox.Focus(); But how do I get the cursor at the end of the string in the textbox ?
Anoushka Seechurn
  • 1,946
  • 7
  • 29
  • 48
83
votes
1 answer

How to speed up the left and right arrow keys for editing text?

Is it just me, or do other people find that the left and right arrow keys on MacOS are unusually slow for editing text? Compared to my Windows machines, positioning the cursor with left/right arrow keys seems to take twice as long on the Mac. The…
Blue
  • 1,146
  • 1
  • 9
  • 7
80
votes
9 answers

Set the caret/cursor position to the end of the string value WPF textbox

I am try to set the caret/cursor position to the end of the string value in my WPF textbox when I open my window for the first time. I use the FocusManager to set the focus on my textbox when my window opens. Nothing seems to work. Any…
Zamboni
  • 7,437
  • 5
  • 39
  • 48
62
votes
9 answers

How do I find the position of a cursor in a text box? C#

I have a standard WinForms TextBox and I want to insert text at the cursor's position in the text. How can I get the cursor's position? Thanks
James May
58
votes
7 answers

Cursor position in a textarea (character index, not x/y coordinates)

How can I get the caret's position in a textarea using jQuery? I'm looking for the cursor's offset from the start of the text, not for the (x, y) position.
kmunky
  • 14,323
  • 17
  • 51
  • 63
40
votes
4 answers

Inserting text in TinyMCE Editor where the cursor is

I've been trying to insert text into the TinyMCE Editor at the focused paragraph element (

) exactly where the cursor is but got no luck!! var elem = tinyMCE.activeEditor.dom.get('tinymce'); var child = elem.firstChild; while (child) { if…

Ruba
  • 797
  • 3
  • 9
  • 18
37
votes
6 answers

How to prevent the cursor from moving back one character on leaving Insert mode in Vim?

Is it possible to cancel the said behavior? A task for extra credit: Figure out a way to force Vim to refresh the cursor position immediately after exiting Insert mode.
Juliusz
  • 1,150
  • 12
  • 22
36
votes
5 answers

jquery Setting cursor position in contenteditable div

The old version of the question is below, after researching more, I decided to rephrase the question. The problem as before is, I need to focus a contenteditable div without highlighting the text, doing straight up focus highlights the text in…
Mark
  • 28,819
  • 33
  • 102
  • 136
29
votes
4 answers

jQuery: Get the cursor position of text in input without browser specific code?

Is there any way in jQuery to get the current cursor-position in an text input without doing ugly browser specific code? Like in: the cursor being after the "x" of "some text", I can get "8"?
Ansgar
  • 1,727
  • 4
  • 17
  • 27
21
votes
6 answers

emacs equivalent of vim's shift-h and shift-l

i'm wondering if emacs has these cursor movement commands built in or if i'm going to have to write them or find a snippet somewhere. i find them pretty spiffy and use them in vim regularly. i haven't found them in emacs' documentation so far. in…
rradonic
1
2 3
27 28