summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-10 09:53:59 -0400
committerpommicket <pommicket@gmail.com>2023-09-10 09:54:08 -0400
commit5485676270378a47a579d0707d5d7262aa293599 (patch)
treea14de0a879647fbbf1c91e6a59fe5ba332f451da
parent21cb2ba466ec0876d4e04fcca117650101d9359f (diff)
fix problem where on the last line of a buffer shift+up end backspace acts weird
-rw-r--r--buffer.c14
-rw-r--r--lsp.h4
-rw-r--r--main.c1
3 files changed, 9 insertions, 10 deletions
diff --git a/buffer.c b/buffer.c
index eb6d438..8ea982f 100644
--- a/buffer.c
+++ b/buffer.c
@@ -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);
diff --git a/lsp.h b/lsp.h
index 2e16045..1cb2422 100644
--- a/lsp.h
+++ b/lsp.h
@@ -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
diff --git a/main.c b/main.c
index f12ee19..dfaa522 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,5 @@
/*
TODO:
-- on the last line of a buffer, shift+up end backspace acts weird
- restart LSP server automatically?
FUTURE FEATURES: