about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2017-03-03 10:18:46 +0000
committerPeter Stephenson <pws@zsh.org>2017-03-03 10:18:46 +0000
commit67c5d83df33cf46e5bf0d2f90bbc0f994e93f938 (patch)
tree10e9dad2de3454133aaef332d820e74a46b927ac
parent0697c45ab38f60f9cb80e0c4be3d0eb23acb0d30 (diff)
downloadzsh-67c5d83df33cf46e5bf0d2f90bbc0f994e93f938.tar.gz
zsh-67c5d83df33cf46e5bf0d2f90bbc0f994e93f938.tar.xz
zsh-67c5d83df33cf46e5bf0d2f90bbc0f994e93f938.zip
40702: new KEYS_QUEUED_COUNT ZLE variable
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/zle.yo9
-rw-r--r--Src/Zle/zle_params.c11
3 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e4d86124a..d4be9f622 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-03  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 40702: Doc/Zsh/zle.yo, Src/Zle/zle_params.c: add
+	KEYS_QUEUED_COUNT variable to ZLE parameters.
+
 2017-03-02  Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
 
 	* 40681: Src/Modules/datetime.c: strftime builtin should
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index d68365b94..b65e3be64 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -864,6 +864,12 @@ vindex(KEYS)
 item(tt(KEYS) (scalar))(
 The keys typed to invoke this widget, as a literal string; read-only.
 )
+vindex(KEYS_QUEUED_COUNT)
+item(tt(KEYS_QUEUED_COUNT) (integer))(
+The number of bytes pushed back to the input queue and therefore
+available for reading immediately before any I/O is done; read-only.
+See also tt(PENDING); the two values are distinct.
+)
 vindex(killring)
 item(tt(killring) (array))(
 The array of previously killed items, with the most recently killed first.
@@ -919,7 +925,8 @@ item(tt(PENDING) (integer))(
 The number of bytes pending for input, i.e. the number of bytes which have
 already been typed and can immediately be read. On systems where the shell
 is not able to get this information, this parameter will always have a
-value of zero.  Read-only.
+value of zero.  Read-only.  See also tt(KEYS_QUEUED_COUNT); the two
+values are distinct.
 )
 vindex(PREBUFFER)
 item(tt(PREBUFFER) (scalar))(
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index 1e4c5b832..0a922d2d6 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -85,6 +85,8 @@ static const struct gsu_integer cursor_gsu =
 { get_cursor, set_cursor, zleunsetfn };
 static const struct gsu_integer histno_gsu =
 { get_histno, set_histno, zleunsetfn };
+static const struct gsu_integer keys_queued_count_gsu =
+{ get_keys_queued_count, NULL, zleunsetfn };
 static const struct gsu_integer mark_gsu =
 { get_mark, set_mark, zleunsetfn };
 static const struct gsu_integer numeric_gsu =
@@ -146,6 +148,8 @@ static struct zleparam {
     { "HISTNO", PM_INTEGER, GSU(histno_gsu), NULL },
     { "KEYMAP", PM_SCALAR | PM_READONLY, GSU(keymap_gsu), NULL },
     { "KEYS", PM_SCALAR | PM_READONLY, GSU(keys_gsu), NULL },
+    { "KEYS_QUEUED_COUNT", PM_INTEGER | PM_READONLY, GSU(keys_queued_count_gsu),
+      NULL},
     { "killring", PM_ARRAY, GSU(killring_gsu), NULL },
     { "LASTABORTEDSEARCH", PM_SCALAR | PM_READONLY, GSU(lastabortedsearch_gsu),
       NULL },
@@ -458,6 +462,13 @@ get_keys(UNUSED(Param pm))
 }
 
 /**/
+static zlong
+get_keys_queued_count(UNUSED(Param pm))
+{
+    return kungetct;
+}
+
+/**/
 static void
 set_numeric(UNUSED(Param pm), zlong x)
 {