diff options
author | pommicket <pommicket@gmail.com> | 2023-03-23 12:36:24 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-03-23 12:36:24 -0400 |
commit | 000d571290008378ae64109f7dcb5947d452ef41 (patch) | |
tree | 536d26b9abdf522cf7ba568c44ac3a7d68e9dd30 /buffer.c | |
parent | 5254f8ab9b8be084a18c376774b8bebe4eb20173 (diff) |
fix scrolling to cursor when text is typed
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1998,6 +1998,11 @@ void buffer_insert_text_at_cursor(TextBuffer *buffer, String32 str) { buffer_delete_selection(buffer); // delete any selected text BufferPos endpos = buffer_insert_text_at_pos(buffer, buffer->cursor_pos, str); buffer_cursor_move_to_pos(buffer, endpos); + if (str.len) { + // this actually isn't handled by the move above since buffer->cursor_pos + // should be moved to endpos anyways. might as well keep that there though + buffer_scroll_to_cursor(buffer); + } } void buffer_insert_char_at_cursor(TextBuffer *buffer, char32_t c) { |