Browse Source

cursor should move on shift-home and shift-end

Scott Graham 11 năm trước cách đây
mục cha
commit
c4530794fb
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      stb_textedit.h

+ 2 - 2
stb_textedit.h

@@ -959,7 +959,7 @@ retry:
          stb_textedit_clamp(str, state);
          stb_textedit_clamp(str, state);
          stb_textedit_prep_selection_at_cursor(state);
          stb_textedit_prep_selection_at_cursor(state);
          stb_textedit_find_charpos(&find, str, state->cursor, state->single_line);
          stb_textedit_find_charpos(&find, str, state->cursor, state->single_line);
-         state->select_end = find.first_char;
+         state->cursor = state->select_end = find.first_char;
          state->has_preferred_x = 0;
          state->has_preferred_x = 0;
          break;
          break;
       }
       }
@@ -969,7 +969,7 @@ retry:
          stb_textedit_clamp(str, state);
          stb_textedit_clamp(str, state);
          stb_textedit_prep_selection_at_cursor(state);
          stb_textedit_prep_selection_at_cursor(state);
          stb_textedit_find_charpos(&find, str, state->cursor, state->single_line);
          stb_textedit_find_charpos(&find, str, state->cursor, state->single_line);
-         state->select_end = find.first_char + find.length;
+         state->cursor = state->select_end = find.first_char + find.length;
          state->has_preferred_x = 0;
          state->has_preferred_x = 0;
          break;
          break;
       }
       }