aboutsummaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2020-04-29 13:56:10 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2020-04-29 13:56:10 +0100
commitb06235c345d8d6426d3c8208b4e475e6c60ac884 (patch)
tree496515ffeaeebeaba5f1e660a7e2b111ea86abdf /menu.c
parent7c52d702e4bb6d3783984001678f5be98b56b7e6 (diff)
downloadrtmux-b06235c345d8d6426d3c8208b4e475e6c60ac884.tar.gz
rtmux-b06235c345d8d6426d3c8208b4e475e6c60ac884.tar.bz2
rtmux-b06235c345d8d6426d3c8208b4e475e6c60ac884.zip
Improve command prompt completion:
- Show a menu with completions if there are multiple. - Don't complete argument stuff (options, layouts) at start of text. - For -t and -s, if there is no : then complete sessions but if there is a :, show a menu of all windows in the session rather than trying to complete the window name which is a bit useless if there are duplicates. Lots of scope for being more sophisticated left here.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/menu.c b/menu.c
index 2f92af34..c6962036 100644
--- a/menu.c
+++ b/menu.c
@@ -240,6 +240,12 @@ menu_key_cb(struct client *c, struct key_event *event)
} while ((name == NULL || *name == '-') && md->choice != old);
c->flags |= CLIENT_REDRAWOVERLAY;
return (0);
+ case '\011': /* Tab */
+ if (~md->flags & MENU_TAB)
+ break;
+ if (md->choice == count - 1)
+ return (1);
+ /* FALLTHROUGH */
case KEYC_DOWN:
case 'j':
if (old == -1)
@@ -253,6 +259,31 @@ menu_key_cb(struct client *c, struct key_event *event)
} while ((name == NULL || *name == '-') && md->choice != old);
c->flags |= CLIENT_REDRAWOVERLAY;
return (0);
+ case 'g':
+ case KEYC_PPAGE:
+ case '\002': /* C-b */
+ if (md->choice > 5)
+ md->choice -= 5;
+ else
+ md->choice = 0;
+ while (md->choice != count && (name == NULL || *name == '-'))
+ md->choice++;
+ if (md->choice == count)
+ md->choice = -1;
+ c->flags |= CLIENT_REDRAWOVERLAY;
+ break;
+ case 'G':
+ case KEYC_NPAGE:
+ if (md->choice > count - 6)
+ md->choice = count - 1;
+ else
+ md->choice += 5;
+ while (md->choice != -1 && (name == NULL || *name == '-'))
+ md->choice--;
+ c->flags |= CLIENT_REDRAWOVERLAY;
+ break;
+ case '\006': /* C-f */
+ break;
case '\r':
goto chosen;
case '\033': /* Escape */