billiob pushed a commit to branch terminology-1.6.

http://git.enlightenment.org/apps/terminology.git/commit/?id=e1f3a4d486f66eb85ef915809aa8a0a8878491f6

commit e1f3a4d486f66eb85ef915809aa8a0a8878491f6
Author: Boris Faure <[email protected]>
Date:   Wed Dec 4 23:09:19 2019 +0100

    sb: when skipping buffer on the left and the buffer is empty, remove gap
---
 src/bin/sb.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/bin/sb.c b/src/bin/sb.c
index a0dd9e8..f52f9d4 100644
--- a/src/bin/sb.c
+++ b/src/bin/sb.c
@@ -108,8 +108,17 @@ void
 ty_sb_lskip(struct ty_sb *sb, int len)
 {
    sb->len -= len;
-   sb->gap += len;
-   sb->buf += len;
+   if (sb->len)
+     {
+        sb->gap += len;
+        sb->buf += len;
+     }
+   else
+     {
+        /* buffer is empty, get rid of gap */
+        sb->buf -= sb->gap;
+        sb->gap = 0;
+     }
 }
 
 void

-- 


Reply via email to