diff options
| author | Albert Cervin <albert@acervin.com> | 2024-06-23 22:30:37 +0200 |
|---|---|---|
| committer | Albert Cervin <albert@acervin.com> | 2024-06-23 22:44:05 +0200 |
| commit | e0901a1efb05727111eb88d1b27b7d1a23a87365 (patch) | |
| tree | aac294067c611770a5baa2b2e388c0163174af8f /src/main/main.c | |
| parent | 67271d056409ce3727c282968a7186088bf19a28 (diff) | |
| download | dged-e0901a1efb05727111eb88d1b27b7d1a23a87365.tar.gz dged-e0901a1efb05727111eb88d1b27b7d1a23a87365.tar.xz dged-e0901a1efb05727111eb88d1b27b7d1a23a87365.zip | |
Fix buffer list switch and search/replace
Fix the buffer list return key action when buffers have the same name.
Previously, it would pick the first it could find in the buffer list
with the correct buffer name instead of the selected one. Now it uses
text properties to pass the actual buffer pointer along instead.
This however exposed a problem with the clearing of properties and where
in the frame it happens. Search and replace highlighting assumed that
they could color things in their respective command executions. However,
ideally coloring should happen in update functions so now both search
and replace implement the coloring in update hooks for the buffer
they are operating on. For replace, this was already kinda how it
worked and could be adapted with minimal effort. Search on the other
hand needed a bit more rework.
Diffstat (limited to 'src/main/main.c')
| -rw-r--r-- | src/main/main.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/main.c b/src/main/main.c index 7dab26b..ee954f9 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -68,6 +68,13 @@ void segfault() { } #define INVALID_WATCH -1 + +static void clear_buffer_props(struct buffer *buffer, void *userdata) { + (void)userdata; + + buffer_clear_text_properties(buffer); +} + struct watched_file { uint32_t watch_id; struct buffer *buffer; @@ -344,6 +351,10 @@ int main(int argc, char *argv[]) { display_resized = false; } + // TODO: maybe this should be hidden behind something + // The placement is correct though. + buffers_for_each(&buflist, clear_buffer_props, NULL); + /* Update all windows together with the buffers in them. */ struct timer *update_windows = timer_start("update-windows"); windows_update(frame_alloc, frame_time); @@ -459,6 +470,7 @@ int main(int argc, char *argv[]) { } timers_destroy(); + teardown_global_commands(); destroy_completion(); windows_destroy(); minibuffer_destroy(); |
