From 4fd7c52c48982f8889d06ee7b437e455cd8082b9 Mon Sep 17 00:00:00 2001 From: wdlkmpx Date: Tue, 29 Dec 2020 17:27:52 +0800 Subject: [PATCH] CTRL-p: fetch the previous command from the history list --- README.md | 1 + data/gmrun.1 | 2 +- src/gtkcompletionline.c | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5870302..c5f657e 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ Tips and tricks and a SPACE is inserted after the netscape-navigator). You can use UP / DOWN arrows to select the right completion. + You can use Ctrl-p / Ctrl-n to select the right completion. 3. - ESC closes the completion window, leaving the selected text in the entry. - HOME / END - the same, but clears the selection. diff --git a/data/gmrun.1 b/data/gmrun.1 index b6dc999..fe31e92 100644 --- a/data/gmrun.1 +++ b/data/gmrun.1 @@ -45,7 +45,7 @@ The command to run when Ctrl+Enter is pressed with a command entered. The entere see /etc/gmrunrc for more info .TP .B History -Number of entered commands which should be kept in gmrun's history(~/.gmrun_history). Using the Up and Down arrow keys within the gmrun window will cycle through the history. You can search backwards through the history with Ctrl+R, and forward with Ctrl+S. Hit "!" to enter a special search that matches only the start of strings. To cancel a search, hit the \fIESC\fP key. Otherwise, after you have found the history item you wish to run, hit Enter. +Number of entered commands which should be kept in gmrun's history(~/.gmrun_history). Using the Up and Down arrow keys within the gmrun window will cycle through the history. You can search backwards through the history with Ctrl+R, and forward with Ctrl+S. Hit "!" to enter a special search that matches only the start of strings. To cancel a search, hit the \fIESC\fP key. Otherwise, after you have found the history item you wish to run, hit Enter. Also: Ctrl-p = Up / Ctrl-n = Down. .TP .B ShowLast Whether to show the last command as initial text, or an empty textarea (1 or 0). diff --git a/src/gtkcompletionline.c b/src/gtkcompletionline.c index 15a0b4d..a5aa174 100644 --- a/src/gtkcompletionline.c +++ b/src/gtkcompletionline.c @@ -949,6 +949,13 @@ on_key_press(GtkCompletionLine *cl, GdkEventKey *event, gpointer data) return TRUE; /* stop signal emission */ case GDK_KEY_Up: + case GDK_KEY_P: + case GDK_KEY_p: + if (key == GDK_KEY_p || key == GDK_KEY_P) { + if (!(event->state & GDK_CONTROL_MASK)) { + goto ordinary; + } + } if (cl->win_compl != NULL) { gboolean valid; valid = gtk_tree_model_iter_previous(cl->sort_list_compl, &(cl->list_compl_it));