aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-01-15 01:06:38 +0100
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-01-15 01:06:38 +0100
commit7fece4c0a8a685d5ada4dfb89ce5fd7efa9f38fa (patch)
tree1009c049d1e93acdbc83936d2189692f3d7b2627 /src
parent86ee73747c09fcb1da7291a6bfa6e0413238a71c (diff)
Curses: fixed flickering of the hardware cursorHEADmaster-fmsbw-cimaster
* Disabling the cursor with every key press caused a cursor status change when using CARETSTYLE_CURSES, which resulted in flickering, especially when using the cursor keys or typing quickly. * Instead we now disable the cursor only if CARETSTYLE_CURSES is NOT used on the command line. * It would be good to use curs_set(2) for `^T` - in some emulators it causes e.g. a blinking cursor - but it wouldn't be visible in simpleterm. This is probably just because it doesn't guarantee any contrast. * This was broken in v2.5.1.
Diffstat (limited to 'src')
-rw-r--r--src/interface-curses/interface.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c
index 94501cb..d07ff21 100644
--- a/src/interface-curses/interface.c
+++ b/src/interface-curses/interface.c
@@ -993,10 +993,11 @@ teco_interface_getch(gboolean widechar)
/*
* Signal that we accept input by drawing a real cursor in the message bar.
+ * FIXME: curs_set(2) would be better, but isn't always visible.
*/
wmove(teco_interface.msg_window, 0, 0);
- curs_set(1);
wrefresh(teco_interface.msg_window);
+ curs_set(1);
gchar buf[4];
gint i = 0;
@@ -1023,7 +1024,6 @@ teco_interface_getch(gboolean widechar)
i = 0;
} while (cp < 0);
- curs_set(0);
return cp;
}
@@ -1837,16 +1837,6 @@ teco_interface_refresh(gboolean force)
clearok(curscr, TRUE);
/*
- * Let Scinterm enable/disable the hardware cursor
- * based on the CARETSTYLE_CURSES.
- * Doing this repeatedly ensures you can change the
- * caret style interactively.
- * Also, window resizes enable the cursor on PDCurses/wincon
- * sometimes (FIXME).
- */
- curs_set(0);
-
- /*
* Info window is updated very often which is very
* costly, especially when using PDC_set_title(),
* so we redraw it here, where the overhead does
@@ -1870,6 +1860,19 @@ teco_interface_refresh(gboolean force)
*/
teco_view_update_cursor(teco_cmdline.view);
doupdate();
+
+ /*
+ * Scinterm enables/disables the hardware cursor,
+ * but only if CARETSTYLE_CURSES is used.
+ * Disabling the cursor repeatedly ensures you can change
+ * the caret style interactively.
+ * It also makes sure the cursor is reset after
+ * teco_interface_getch().
+ * Also, window resizes sometimes enable the hardware cursor on
+ * PDCurses/wincon (FIXME).
+ */
+ if (!(teco_view_ssm(teco_cmdline.view, SCI_GETCARETSTYLE, 0, 0) & CARETSTYLE_CURSES))
+ curs_set(0);
}
#if NCURSES_MOUSE_VERSION >= 2