Lines Matching defs:cursor
13 // insertions & deletions, plus updates to the cursor position,
88 // STB_TEXTEDIT_POSITIONTYPE small int type encoding a valid cursor position
120 // STB_TEXTEDIT_POSITIONTYPE small type that is a valid cursor position
147 // STB_TEXTEDIT_K_LEFT keyboard input to move cursor left
148 // STB_TEXTEDIT_K_RIGHT keyboard input to move cursor right
149 // STB_TEXTEDIT_K_UP keyboard input to move cursor up
150 // STB_TEXTEDIT_K_DOWN keyboard input to move cursor down
151 // STB_TEXTEDIT_K_LINESTART keyboard input to move cursor to start of line // e.g. HOME
152 // STB_TEXTEDIT_K_LINEEND keyboard input to move cursor to end of line // e.g. END
153 // STB_TEXTEDIT_K_TEXTSTART keyboard input to move cursor to start of text // e.g. ctrl-HOME
154 // STB_TEXTEDIT_K_TEXTEND keyboard input to move cursor to end of text // e.g. ctrl-END
155 // STB_TEXTEDIT_K_DELETE keyboard input to delete selection or character under cursor
156 // STB_TEXTEDIT_K_BACKSPACE keyboard input to delete selection or character left of cursor
164 // STB_TEXTEDIT_MOVEWORDLEFT(obj,i) custom handler for WORDLEFT, returns index to move cursor to
165 // STB_TEXTEDIT_MOVEWORDRIGHT(obj,i) custom handler for WORDRIGHT, returns index to move cursor to
166 // STB_TEXTEDIT_K_WORDLEFT keyboard input to move cursor left one word // e.g. ctrl-LEFT
167 // STB_TEXTEDIT_K_WORDRIGHT keyboard input to move cursor right one word // e.g. ctrl-RIGHT
168 // STB_TEXTEDIT_K_LINESTART2 secondary keyboard input to move cursor to start of line
169 // STB_TEXTEDIT_K_LINEEND2 secondary keyboard input to move cursor to end of line
170 // STB_TEXTEDIT_K_TEXTSTART2 secondary keyboard input to move cursor to start of text
171 // STB_TEXTEDIT_K_TEXTEND2 secondary keyboard input to move cursor to end of text
174 // STB_TEXTEDIT_K_PGUP keyboard input to move cursor up a page
175 // STB_TEXTEDIT_K_PGDOWN keyboard input to move cursor down a page
179 // be a bitflag, so we can test the shifted state of cursor movements to allow selection,
219 // call this with the mouse x,y on a mouse down; it will update the cursor
220 // and reset the selection start/end to the cursor point. the x,y must
225 // cursor and the selection end point
233 // call this to paste text at the current cursor point or over the current
247 // When rendering, you can read the cursor position and selection state from
284 // per-textfield; it includes cursor position, selection state,
326 int cursor;
327 // position of the text cursor within the string
349 float preferred_x; // this determines where the cursor up/down tries to seek to along x
455 // API click: on mouse down, move the cursor to the clicked location, and reset the selection
467 state->cursor = stb_text_locate_coord(str, x, y);
468 state->select_start = state->cursor;
469 state->select_end = state->cursor;
473 // API drag: on mouse drag, move the cursor and selection endpoint to the clicked location
488 state->select_start = state->cursor;
491 state->cursor = state->select_end = p;
574 // make the selection/cursor state valid if client altered the string
581 // if clamping forced them to be equal, move the cursor to match
583 state->cursor = state->select_start;
585 if (state->cursor > n) state->cursor = n;
603 state->select_end = state->cursor = state->select_start;
606 state->select_start = state->cursor = state->select_end;
622 // move cursor to first character of selection
627 state->cursor = state->select_start;
633 // move cursor to last character of selection
639 state->cursor = state->select_end;
684 // update selection and cursor to match each other
688 state->select_start = state->select_end = state->cursor;
690 state->cursor = state->select_end;
711 if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, text, len)) {
712 stb_text_makeundo_insert(state, state->cursor, len);
713 state->cursor += len;
741 if (state->insert_mode && !STB_TEXT_HAS_SELECTION(state) && state->cursor < STB_TEXTEDIT_STRINGLEN(str)) {
742 stb_text_makeundo_replace(str, state, state->cursor, 1, 1);
743 STB_TEXTEDIT_DELETECHARS(str, state->cursor, 1);
744 if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, &ch, 1)) {
745 ++state->cursor;
750 if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, &ch, 1)) {
751 stb_text_makeundo_insert(state, state->cursor, 1);
752 ++state->cursor;
777 // if currently there's a selection, move cursor to start of selection
781 if (state->cursor > 0)
782 --state->cursor;
787 // if currently there's a selection, move cursor to end of selection
791 ++state->cursor;
802 state->cursor = state->select_end;
811 state->cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state->cursor);
820 state->cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state->cursor);
821 state->select_end = state->cursor;
832 state->cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state->cursor);
841 state->cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state->cursor);
842 state->select_end = state->cursor;
853 state->cursor = state->select_end;
874 // compute current position of cursor point
876 stb_textedit_find_charpos(&find, str, state->cursor, state->single_line);
883 state->cursor = start;
884 STB_TEXTEDIT_LAYOUTROW(&row, str, state->cursor);
895 ++state->cursor;
903 state->select_end = state->cursor;
925 // compute current position of cursor point
927 stb_textedit_find_charpos(&find, str, state->cursor, state->single_line);
934 state->cursor = find.prev_first;
935 STB_TEXTEDIT_LAYOUTROW(&row, str, state->cursor);
946 ++state->cursor;
954 state->select_end = state->cursor;
965 if (state->cursor < n)
966 stb_textedit_delete(str, state, state->cursor, 1);
977 if (state->cursor > 0) {
978 stb_textedit_delete(str, state, state->cursor-1, 1);
979 --state->cursor;
989 state->cursor = state->select_start = state->select_end = 0;
997 state->cursor = STB_TEXTEDIT_STRINGLEN(str);
1007 state->cursor = state->select_end = 0;
1016 state->cursor = state->select_end = STB_TEXTEDIT_STRINGLEN(str);
1028 state->cursor = 0;
1029 else while (state->cursor > 0 && STB_TEXTEDIT_GETCHAR(str, state->cursor-1) != STB_TEXTEDIT_NEWLINE)
1030 --state->cursor;
1042 state->cursor = n;
1043 else while (state->cursor < n && STB_TEXTEDIT_GETCHAR(str, state->cursor) != STB_TEXTEDIT_NEWLINE)
1044 ++state->cursor;
1056 state->cursor = 0;
1057 else while (state->cursor > 0 && STB_TEXTEDIT_GETCHAR(str, state->cursor-1) != STB_TEXTEDIT_NEWLINE)
1058 --state->cursor;
1059 state->select_end = state->cursor;
1071 state->cursor = n;
1072 else while (state->cursor < n && STB_TEXTEDIT_GETCHAR(str, state->cursor) != STB_TEXTEDIT_NEWLINE)
1073 ++state->cursor;
1074 state->select_end = state->cursor;
1080 // STB_TEXTEDIT_K_PGUP - move cursor up a page
1081 // STB_TEXTEDIT_K_PGDOWN - move cursor down a page
1256 state->cursor = u.where + u.insert_length;
1307 state->cursor = r.where + r.insert_length;
1346 state->cursor = 0;