diff options
-rw-r--r-- | doc/sciteco.7.template | 4 | ||||
-rw-r--r-- | lib/fnkeys.tes | 4 | ||||
-rw-r--r-- | src/interface-curses/interface.c | 11 | ||||
-rw-r--r-- | src/interface-gtk/interface.c | 6 |
4 files changed, 16 insertions, 9 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template index 2a97c02..d5fc4af 100644 --- a/doc/sciteco.7.template +++ b/doc/sciteco.7.template @@ -308,6 +308,10 @@ This will not be delivered on Curses unless bit 7 (64) is set in the You can use \fBEJ\fP with negative keys to retrieve the event type, mouse coordinates and other information about the last mouse event. +Dot is \fInot\fP automatically scrolled into the view when processing +mouse events, so you can customize scrolling and even have dot leaving the +visible area. +You can manually scroll dot into the view by calling \fBSCI_SCROLLCARET\fP. .TP .BI ^K x Any other key with printable representation and all control codes diff --git a/lib/fnkeys.tes b/lib/fnkeys.tes index 922548b..6c3b833 100644 --- a/lib/fnkeys.tes +++ b/lib/fnkeys.tes @@ -179,14 +179,14 @@ -4EJ&2"= -4EJ&1"=-1|-2',0ESLINESCROLL | - ESZOOMIN + ESZOOMIN ESSCROLLCARET ' {-9D} !scrolldown! -4EJ&2"= -4EJ&1"=1|2',0ESLINESCROLL | - ESZOOMOUT + ESZOOMOUT ESSCROLLCARET ' {-9D} } diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index 75ba036..031ba61 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -1968,9 +1968,6 @@ teco_interface_event_loop_iter(void) ? teco_interface_blocking_getch() : GPOINTER_TO_INT(g_queue_pop_head(teco_interface.input_queue)); - const teco_view_t *last_view = teco_interface_current_view; - sptr_t last_pos = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0); - switch (key) { case ERR: /* shouldn't really happen */ @@ -2093,9 +2090,13 @@ teco_interface_event_loop_iter(void) * Scintilla has been patched to avoid any automatic scrolling since that * has been benchmarked to be a very costly operation. * Instead we do it only once after every keypress. + * + * The only exception is mouse events, so you can scroll the view manually + * in the ^KMOUSE macro, allowing dot to be outside of the view. */ - if (teco_interface_current_view != last_view || - last_pos != teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0)) +#if NCURSES_MOUSE_VERSION >= 2 + if (key != KEY_MOUSE) +#endif teco_interface_ssm(SCI_SCROLLCARET, 0, 0); teco_interface_refresh(); } diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 7f58c45..25f4ccd 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -1383,7 +1383,6 @@ teco_interface_input_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) gdk_window_freeze_updates(top_window); const teco_view_t *last_view = teco_interface_current_view; - sptr_t last_pos = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0); teco_interrupted = FALSE; switch (event->type) { @@ -1409,8 +1408,11 @@ teco_interface_input_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) * Scintilla has been patched to avoid any automatic scrolling since that * has been benchmarked to be a very costly operation. * Instead we do it only once after every keypress. + * + * The only exception is mouse events, so you can scroll the view manually + * in the ^KMOUSE macro, allowing dot to be outside of the view. */ - if (last_pos != teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0)) + if (event->type == GDK_KEY_PRESS) teco_interface_ssm(SCI_SCROLLCARET, 0, 0); gdk_window_thaw_updates(top_window); |