"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
tog: remove count prefix timeout and bold output
To:
gameoftrees@openbsd.org
Date:
Thu, 30 Jun 2022 16:58:26 +1000

Download raw body.

Thread
As per naddy's suggestion in the other related thread: block till
non-numeric input is entered, and don't echo in bold.

diff /home/mark/src/git/got-current
commit - 9b058f456d15d60a89334ce3e7f0a7c22e182c55
path + /home/mark/src/git/got-current
blob - 728ba5ee9e20edbde20ed7f0c2ff1cbabad89c0b
file + tog/tog.1
--- tog/tog.1
+++ tog/tog.1
@@ -58,12 +58,10 @@ provides global and command-specific key bindings and
 Some command-specific key bindings may be prefixed with an integer, which is
 denoted by N in the descriptions below, and is used as a modifier to the
 operation as indicated.
-When the first integer for a count modifier is entered,
 .Nm
-will wait 500 milliseconds for each successive integer or the compound sequence
-to complete.
-If this sequence should timeout or does not conclude with a valid key binding,
-the command is aborted and any preceding count is reset.
+will echo digits to the screen when count modifiers are entered, and complete
+the sequence upon input of the first non-numeric character.
+Count modifiers can be aborted by entering an unmapped key.
 The global key bindings are:
 .Bl -tag -width Ds
 .It Cm Q
blob - 6a0c6dbff39ee1a8db173cbc3fa1fbf0918eecab
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -988,10 +988,8 @@ view_search_start(struct tog_view *view)
 }

 /*
- * Compute view->count from numeric user input.  User has five-tenths of a
- * second to follow each numeric keypress with another number to form count.
- * Return first non-numeric input or ERR and assign total to view->count.
- * XXX Should we add support for user-defined timeout?
+ * Compute view->count from numeric input. Assign total to view->count and
+ * return first non-numeric key entered.
  */
 static int
 get_compound_key(struct tog_view *view, int c)
@@ -1006,8 +1004,7 @@ get_compound_key(struct tog_view *view, int c)
 		v = view->parent;

 	view->count = 0;
-	halfdelay(5);  /* block for half a second */
-	wattron(v->window, A_BOLD);
+	cbreak();  /* block for input */
 	wmove(v->window, v->nlines - 1, 0);
 	wclrtoeol(v->window);
 	waddch(v->window, ':');
@@ -1032,8 +1029,6 @@ get_compound_key(struct tog_view *view, int c)
 	/* Massage excessive or inapplicable values at the input handler. */
 	view->count = n;

-	wattroff(v->window, A_BOLD);
-	cbreak();  /* return to blocking */
 	return c;
 }


-- 
Mark Jamsek <fnc.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68