summaryrefslogtreecommitdiff
path: root/src/main/main.c
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2024-05-06 22:42:39 +0200
committerAlbert Cervin <albert@acervin.com>2024-05-06 22:42:39 +0200
commitad0cd5c036f0080ee8d97db2e67b8d54186d1e33 (patch)
treeb85cc21acac6e1383dfa3b78494ce09c409b2f30 /src/main/main.c
parentc42412e1643c88c81cf5b38404cc010881437fe9 (diff)
downloaddged-ad0cd5c036f0080ee8d97db2e67b8d54186d1e33.tar.gz
dged-ad0cd5c036f0080ee8d97db2e67b8d54186d1e33.tar.xz
dged-ad0cd5c036f0080ee8d97db2e67b8d54186d1e33.zip
Fix slow buffer paste
Was caused by updating all buffer hooks on every char insert. Particularily, the syntax update takes a little bit too long to call on every char. Now the keyboard parsing routine compresses all consecutive self-inserting chars into one "key press". Also fix some small issues with timers and update them with a min and max.
Diffstat (limited to 'src/main/main.c')
-rw-r--r--src/main/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/main.c b/src/main/main.c
index 169716d..7dab26b 100644
--- a/src/main/main.c
+++ b/src/main/main.c
@@ -429,6 +429,7 @@ int main(int argc, char *argv[]) {
}
}
} else if (k->mod == 0) {
+ // self-inserting chars
buffer_view_add(window_buffer_view(active_window),
&kbd_upd.raw[k->start], k->end - k->start);
} else {
@@ -453,6 +454,7 @@ int main(int argc, char *argv[]) {
frame_time = timer_average(update_windows) +
timer_average(update_keyboard) + timer_average(update_display);
+ timers_end_frame();
frame_allocator_clear(&frame_allocator);
}