diff options
author | pommicket <pommicket@gmail.com> | 2025-09-28 00:07:58 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-09-28 00:07:58 -0400 |
commit | be834b2cb8007c51092a5a106089548a57ba9fb1 (patch) | |
tree | f9574091ed33f15fa521154bf4f3a4ec70cbebfd | |
parent | 306ddb06a7bb7e46348a1b7487117eccf5398b09 (diff) |
Don't screw up cursor pos on reload
-rw-r--r-- | buffer.c | 2 | ||||
-rw-r--r-- | main.c | 10 |
2 files changed, 12 insertions, 0 deletions
@@ -3180,6 +3180,7 @@ Status buffer_load_file(TextBuffer *buffer, const char *path) { file_contents[file_size] = 0; if (success) { bool prev_view_only = buffer->view_only; + BufferPos prev_cursor_pos = buffer->cursor_pos; buffer->view_only = false; buffer_start_edit_chain(buffer); buffer_delete_all(buffer); @@ -3188,6 +3189,7 @@ Status buffer_load_file(TextBuffer *buffer, const char *path) { buffer_end_edit_chain(buffer); nlines = buffer_line_count(buffer); buffer->view_only = prev_view_only; + buffer_cursor_move_to_pos(buffer, prev_cursor_pos); } } if (success && !reload) { @@ -1,5 +1,15 @@ /* +TODO: +- syntax highlighting for Python t-strings +- fix <foo-bar> html highlighting +- don't autocomplete when tab is pressed if there is text selected +- highlight <https://example.org> correctly in Markdown +- highlight (https://example.org) correctly in Markdown (exactly which characters are allowed in links?) + - what did I mean by this +- LSP "actions" + FUTURE FEATURES: +- wrap-text command - path-specific extensions - more tests - config variables |