From 417ee008981c9aabc04fb574c63f3d90e232986c Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 23 Apr 2023 02:15:53 +0300 Subject: Gtk: fixed scrolling in the command line widget * The caret wasn't always kept out of the UZ and at some point would totally leave the view. This was apparently cause by executing two SCI_SCROLLCARETs per teco_interface_cmdline_update(). * Instead, we now use a CARET_EVEN scroll policy which also works sufficiently well. --- src/interface-gtk/interface.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 8ccfd30..d22009b 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -603,7 +603,6 @@ teco_interface_cmdline_update(const teco_cmdline_t *cmdline) * NOTE: teco_view_ssm() already locks the GDK lock. */ teco_view_ssm(teco_interface.cmdline_view, SCI_CLEARALL, 0, 0); - teco_view_ssm(teco_interface.cmdline_view, SCI_SCROLLCARET, 0, 0); /* format effective command line */ for (guint i = 0; i < cmdline->effective_len; i++) @@ -1138,17 +1137,13 @@ teco_interface_cleanup(void) * Called when the commandline widget is resized. * This should ensure that the caret jumps to the middle of the command line, * imitating the behaviour of the current Curses command line. - * - * @bug This no longer works when the command-line gets very long - * and the caret will eventually be stuck at the right edge. - * There seems to be an internal limit. */ static void teco_interface_cmdline_size_allocate_cb(GtkWidget *widget, GdkRectangle *allocation, gpointer user_data) { - teco_view_ssm(teco_interface.cmdline_view, - SCI_SETXCARETPOLICY, CARET_SLOP, allocation->width/2); + teco_view_ssm(teco_interface.cmdline_view, SCI_SETXCARETPOLICY, + CARET_SLOP | CARET_EVEN, allocation->width/2); } static gboolean -- cgit v1.2.3