aboutsummaryrefslogtreecommitdiff
path: root/termkey.c
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-01-18 10:04:15 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-01-18 10:04:15 +0000
commit9534330003bdfdbc6ac47ad08fdf15636e0d9518 (patch)
treeb4e251fccfd2cc20d591983b31f0c5c9d030bc42 /termkey.c
parent37d8f18ab5ec138c79ec3b0fbbf8277826992a33 (diff)
downloadtermo-9534330003bdfdbc6ac47ad08fdf15636e0d9518.tar.gz
termo-9534330003bdfdbc6ac47ad08fdf15636e0d9518.tar.xz
termo-9534330003bdfdbc6ac47ad08fdf15636e0d9518.zip
Provide new API function to determine how much buffer space remains in the instance
Diffstat (limited to 'termkey.c')
-rw-r--r--termkey.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/termkey.c b/termkey.c
index d16f42e..e50ff38 100644
--- a/termkey.c
+++ b/termkey.c
@@ -425,6 +425,13 @@ void termkey_set_canonflags(TermKey *tk, int flags)
tk->flags &= ~TERMKEY_FLAG_SPACESYMBOL;
}
+size_t termkey_get_buffer_remaining(TermKey *tk)
+{
+ /* Return the total number of free bytes in the buffer, because that's what
+ * is available to the user. */
+ return tk->buffsize - tk->buffcount;
+}
+
static void eat_bytes(TermKey *tk, size_t count)
{
if(count >= tk->buffcount) {