aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-08-24 08:58:32 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-08-24 09:03:40 +0200
commit24e57872d88793ab0da07b5fe0585dae6d69b94f (patch)
tree45c047e49f88358fd5c141008e991996d2c3b585
parenta20e4c74d85b4fde4e7b75b46551383761659bbb (diff)
downloadnncmpp-24e57872d88793ab0da07b5fe0585dae6d69b94f.tar.gz
nncmpp-24e57872d88793ab0da07b5fe0585dae6d69b94f.tar.xz
nncmpp-24e57872d88793ab0da07b5fe0585dae6d69b94f.zip
Hide messages when interacting with the editor
-rw-r--r--nncmpp.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/nncmpp.c b/nncmpp.c
index 8257663..0406cfb 100644
--- a/nncmpp.c
+++ b/nncmpp.c
@@ -2508,6 +2508,17 @@ app_mpd_toggle (const char *name)
return MPD_SIMPLE (name, value ? "0" : "1");
}
+static void
+app_hide_message (void)
+{
+ if (g.message)
+ {
+ cstr_set (&g.message, NULL);
+ poller_timer_reset (&g.message_timer);
+ app_invalidate ();
+ }
+}
+
static bool
app_process_action (enum action action)
{
@@ -2542,6 +2553,7 @@ app_process_action (enum action action)
line_editor_start (&g.editor, ':');
g.editor.on_end = app_on_mpd_command_editor_end;
app_invalidate ();
+ app_hide_message ();
return true;
default:
print_error ("can't do that here: %s", g_action_descriptions[action]);
@@ -2563,6 +2575,7 @@ app_process_action (enum action action)
g.editor.on_changed = incremental_search_on_changed;
g.editor.on_end = incremental_search_on_end;
app_invalidate ();
+ app_hide_message ();
return true;
case ACTION_TAB_LAST:
@@ -2764,9 +2777,7 @@ app_process_left_mouse_click (struct widget *w, int x, int y, bool double_click)
break;
}
case WIDGET_MESSAGE:
- cstr_set (&g.message, NULL);
- poller_timer_reset (&g.message_timer);
- app_invalidate ();
+ app_hide_message ();
}
return true;
}
@@ -3029,6 +3040,11 @@ app_process_termo_event (termo_key_t *event)
struct binding dummy = { *event, 0, 0 }, *binding;
if (g.editor.line)
{
+ if (event->type == TERMO_TYPE_KEY
+ || event->type == TERMO_TYPE_FUNCTION
+ || event->type == TERMO_TYPE_KEYSYM)
+ app_hide_message ();
+
if ((binding = bsearch (&dummy, g_editor_keys, g_editor_keys_len,
sizeof *binding, app_binding_cmp)))
return app_editor_process_action (binding->action);