summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2013-12-23 21:20:58 +0100
committerBardur Arantsson <bardur@scientician.net>2014-11-20 01:47:23 +0100
commit923c5b06fae16534385d5ac453253bbe44ed7d1d (patch)
tree2272aad977049946f9c7681f0edca2f1cf896644 /src/util.cc
parent26024b29723d0e0c3e1922003d81b9dfef5463ba (diff)
Remove inkey_scan and inkey_xtra globals
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc37
1 files changed, 14 insertions, 23 deletions
diff --git a/src/util.cc b/src/util.cc
index 3ed9dfa1..37e9f7d0 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -1661,6 +1661,8 @@ static char inkey_aux(void)
*/
static cptr inkey_next = NULL;
+bool_ inkey_flag = FALSE;
+
/*
* Get a keypress from the user.
@@ -1671,11 +1673,6 @@ static cptr inkey_next = NULL;
* before this function returns. Thus they function just like normal
* parameters, except that most calls to this function can ignore them.
*
-* If "inkey_xtra" is TRUE, then all pending keypresses will be flushed,
-* and any macro processing in progress will be aborted. This flag is
-* set by the "flush()" function, which does not actually flush anything
-* itself, but rather, triggers delayed input flushing via "inkey_xtra".
-*
* If "inkey_scan" is TRUE, then we will immediately return "zero" if no
* keypress is available, instead of waiting for a keypress.
*
@@ -1721,7 +1718,7 @@ static cptr inkey_next = NULL;
*
* Hack -- Note the use of "inkey_next" to allow "keymaps" to be processed.
*/
-char inkey(void)
+static char inkey_real(bool_ inkey_scan)
{
int v;
@@ -1734,13 +1731,13 @@ char inkey(void)
term *old = Term;
/* Hack -- Use the "inkey_next" pointer */
- if (inkey_next && *inkey_next && !inkey_xtra)
+ if (inkey_next && *inkey_next)
{
/* Get next character, and advance */
ch = *inkey_next++;
/* Cancel the various "global parameters" */
- inkey_base = inkey_xtra = inkey_flag = inkey_scan = FALSE;
+ inkey_base = inkey_flag = inkey_scan = FALSE;
/* Accept result */
macro_recorder_add(ch);
@@ -1751,20 +1748,6 @@ char inkey(void)
inkey_next = NULL;
- /* Hack -- handle delayed "flush()" */
- if (inkey_xtra)
- {
- /* End "macro action" */
- parse_macro = FALSE;
-
- /* End "macro trigger" */
- parse_under = FALSE;
-
- /* Forget old keypresses */
- Term_flush();
- }
-
-
/* Access cursor state */
(void)Term_get_cursor(&v);
@@ -1927,7 +1910,7 @@ char inkey(void)
/* Cancel the various "global parameters" */
- inkey_base = inkey_xtra = inkey_flag = inkey_scan = FALSE;
+ inkey_base = inkey_flag = FALSE;
/* Return the keypress */
@@ -1935,6 +1918,14 @@ char inkey(void)
return (ch);
}
+char inkey(void) {
+ return inkey_real(FALSE);
+}
+
+char inkey_scan() {
+ return inkey_real(TRUE);
+}
+
/*
* Hack -- flush
*/