From 428dafa568923d5632101c716fb20a3de35d27be Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 15 Feb 2025 01:32:05 +0300 Subject: support mouse interaction with popup windows * Curses allows scrolling with the scroll wheel at least if mouse support is enabled via ED flags. Gtk always supported that. * Allow clicking on popup entries to fully autocomplete them. Since this behavior - just like auto completions - is parser state-dependant, I introduced a new state method (insert_completion_cb). All the implementations are currently in cmdline.c since there is some overlap with the process_edit_cmd_cb implementations. * Fixed pressing undefined function keys while showing the popup. The popup area is no longer redrawn/replaced with the Scintilla view. Instead, continue to show the popup. --- src/interface-curses/curses-info-popup.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/interface-curses/curses-info-popup.h') diff --git a/src/interface-curses/curses-info-popup.h b/src/interface-curses/curses-info-popup.h index 96dee5a..6f2ac9a 100644 --- a/src/interface-curses/curses-info-popup.h +++ b/src/interface-curses/curses-info-popup.h @@ -23,6 +23,7 @@ #include #include "list.h" +#include "string-utils.h" #include "interface.h" typedef struct { @@ -49,6 +50,10 @@ void teco_curses_info_popup_add(teco_curses_info_popup_t *ctx, teco_popup_entry_ const gchar *name, gsize name_len, gboolean highlight); void teco_curses_info_popup_show(teco_curses_info_popup_t *ctx, attr_t attr); +const teco_string_t *teco_curses_info_popup_getentry(teco_curses_info_popup_t *ctx, gint y, gint x); +void teco_curses_info_popup_scroll_page(teco_curses_info_popup_t *ctx); +void teco_curses_info_popup_scroll(teco_curses_info_popup_t *ctx, gint delta); + static inline bool teco_curses_info_popup_is_shown(teco_curses_info_popup_t *ctx) { @@ -58,8 +63,10 @@ teco_curses_info_popup_is_shown(teco_curses_info_popup_t *ctx) static inline void teco_curses_info_popup_noutrefresh(teco_curses_info_popup_t *ctx) { - if (ctx->window) - wnoutrefresh(ctx->window); + if (!ctx->window) + return; + redrawwin(ctx->window); + wnoutrefresh(ctx->window); } void teco_curses_info_popup_clear(teco_curses_info_popup_t *ctx); -- cgit v1.2.3