diff options
author | pommicket <pommicket@gmail.com> | 2023-09-10 09:53:59 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-09-10 09:54:08 -0400 |
commit | 5485676270378a47a579d0707d5d7262aa293599 (patch) | |
tree | a14de0a879647fbbf1c91e6a59fe5ba332f451da | |
parent | 21cb2ba466ec0876d4e04fcca117650101d9359f (diff) |
fix problem where on the last line of a buffer shift+up end backspace acts weird
-rw-r--r-- | buffer.c | 14 | ||||
-rw-r--r-- | lsp.h | 4 | ||||
-rw-r--r-- | main.c | 1 |
3 files changed, 9 insertions, 10 deletions
@@ -2605,8 +2605,14 @@ void buffer_delete_chars_at_pos(TextBuffer *buffer, BufferPos pos, i64 nchars_) buffer_remove_last_edit_if_empty(buffer); + const EditInfo info = { + .pos = pos, + .end = end_pos, + .chars_inserted = 0, + .chars_deleted = deletion_len, + }; // cursor position could have been invalidated by this edit - buffer_validate_cursor(buffer); + buffer_pos_move_according_to_edit(&buffer->cursor_pos, &info); // we need to do this *after* making the change to the buffer // because of how non-incremental syncing works. @@ -2617,12 +2623,6 @@ void buffer_delete_chars_at_pos(TextBuffer *buffer, BufferPos pos, i64 nchars_) buffer_lines_modified(buffer, line_idx, line_idx); signature_help_retrigger(buffer->ted); - const EditInfo info = { - .pos = pos, - .end = end_pos, - .chars_inserted = 0, - .chars_deleted = deletion_len, - }; // move diagnostics around as needed arr_foreach_ptr(buffer->diagnostics, Diagnostic, d) { buffer_pos_move_according_to_edit(&d->pos, &info); @@ -917,9 +917,9 @@ LSPString lsp_request_add_json_string(LSPRequest *request, const JSON *json, JSO void lsp_write_quit(void); /// print server-to-client communication -#define LSP_SHOW_S2C 1 +#define LSP_SHOW_S2C 0 /// print client-to-server communication -#define LSP_SHOW_C2S 1 +#define LSP_SHOW_C2S 0 #endif // LSP_INTERNAL @@ -1,6 +1,5 @@ /* TODO: -- on the last line of a buffer, shift+up end backspace acts weird - restart LSP server automatically? FUTURE FEATURES: |