File: Fix-character-occasionally-disappears-from-right-edge-of-screen.patch

package info (click to toggle)
bogl 0.1.18-23
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,760 kB
  • sloc: ansic: 7,872; makefile: 217; perl: 26; sh: 10
file content (38 lines) | stat: -rw-r--r-- 1,343 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From effb30989015cf760aa152de79ff51212caec91a Mon Sep 17 00:00:00 2001
From: Zhang Boyang <zhangboyang.id@gmail.com>
Date: Wed, 25 May 2022 13:45:14 +0800
Subject: [PATCH v2 6/8] Fix character occasionally disappears from right edge
 of screen

Sometimes when a line is full, the right most character disappears. The
is because term->xpos may equals to term->xsize and this condition
confuses some code. Reported by AddressSanitizer.
---
 bogl-term.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bogl-term.c b/bogl-term.c
index 1f68523..2d35d1d 100644
--- a/bogl-term.c
+++ b/bogl-term.c
@@ -283,7 +283,7 @@ static void
 clear_left (struct bogl_term *term)
 {
     int j, i = SCR(term->xpos, term->ypos);
-    if (!term->screen[i])
+    if (term->xpos < term->xsize && !term->screen[i])
     {
         for (j = i - 1; !term->screen[j]; j--)
         {
@@ -577,7 +577,7 @@ bogl_term_out (struct bogl_term *term, char *s, int n)
 
             if (wc == 'K')
             {                   /* el=\E[K */
-                if (term->state == 1 && !term->arg[0])
+                if (term->state == 1 && !term->arg[0] && term->xpos < term->xsize)
                 {
                     clear_left (term);
                     for (i = SCR (term->xpos, term->ypos); i < SCR (term->xsize, term->ypos); i++)
-- 
2.30.2