summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-04 04:41:11 -0500
committerJune McEnroe <june@causal.agency>2020-02-04 04:41:11 -0500
commita65841c3cb2f367448528242b187c699cb97e0a4 (patch)
tree867e713a6efa889f7ebfd84fd237fb329af0f64a
parentFactor out unmark (diff)
downloadcatgirl-a65841c3cb2f367448528242b187c699cb97e0a4.tar.gz
catgirl-a65841c3cb2f367448528242b187c699cb97e0a4.zip
Switch windows with M-0 through M-9
Diffstat (limited to '')
-rw-r--r--ui.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/ui.c b/ui.c
index 6a834cd..0c2a64e 100644
--- a/ui.c
+++ b/ui.c
@@ -369,8 +369,7 @@ static void unmark(void) {
 	statusUpdate();
 }
 
-void uiShowID(size_t id) {
-	struct Window *window = windowFor(id);
+static void windowShow(struct Window *window) {
 	touchwin(window->pad);
 	windows.other = windows.active;
 	windows.active = window;
@@ -378,6 +377,19 @@ void uiShowID(size_t id) {
 	unmark();
 }
 
+void uiShowID(size_t id) {
+	windowShow(windowFor(id));
+}
+
+void uiShowNum(size_t num) {
+	struct Window *window = windows.head;
+	for (size_t i = 0; i < num; ++i) {
+		window = window->next;
+		if (!window) return;
+	}
+	windowShow(window);
+}
+
 void uiWrite(size_t id, enum Heat heat, const time_t *time, const char *str) {
 	(void)time;
 	struct Window *window = windowFor(id);
@@ -417,6 +429,9 @@ static void keyCode(int code) {
 static void keyMeta(wchar_t ch) {
 	switch (ch) {
 		break; case L'm': uiWrite(windows.active->id, Cold, NULL, "");
+		break; default: {
+			if (ch >= L'0' && ch <= L'9') uiShowNum(ch - L'0');
+		}
 	}
 }
 
ss='logheader'>2021-09-12Replace htagml regex with strncmpJune McEnroe Since ctags only ever produces regular expressions of the form /^re$/ or /^re/ with no other special characters, instead unescape the pattern and simply use strncmp. Running on a sqlite3.c amalgamation, the regex version takes ~37s while the strncmp version takes ~1s, producing identical output. Big win! 2021-09-11Also defer printing comment for lone close-parensJune McEnroe 2021-09-10Publish "git-comment"June McEnroe 2021-09-10Add git comment --pretty optionJune McEnroe 2021-09-08Defer printing comment if line is blank or closing braceJune McEnroe This fixes badly indented comments. 2021-09-08Up default min-repeat to 30 linesJune McEnroe 2021-09-08Handle dirty lines in git-commentJune McEnroe 2021-09-08Document and install git-commentJune McEnroe 2021-09-08Add repeat and all options to git-commentJune McEnroe 2021-09-08Add group threshold to git-commentJune McEnroe