screen-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[screen-devel] [PATCH] Fix extra characters when sending a command in on


From: Nicolas Schodet
Subject: [screen-devel] [PATCH] Fix extra characters when sending a command in one go
Date: Sun, 10 Feb 2019 23:42:19 +0100

This closes bug #52372: Giberish printed to screen window in certain
situations.

When sending "^An", most of the time, screen first receives "^A", then
it receives the "n".  This means that in the ProcessInput2 function,
ilen == 1 after the escape character has been seen, ilen is decremented
and the ProcessInput2 function returns.

When "^An" is sent in one go, for example when pasting or when using a
special shortcut, ilen is not 1 when the escape character is seen.  In
this case, the s variable was incremented, but ilen was not decremented.
This leads the function to read an extra character which does not
exists.

This regression was introduced in 2fab4d6f73, as reported in the bug
report.

This can be tested by having a command in the selection:

echo -ne '\x01n' | xclip -i

And pasting it (in this case, you might see the closing bracketed paste
sequence, but that is another problem).
---
 src/process.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/process.c b/src/process.c
index afd94e2..96b6cd4 100644
--- a/src/process.c
+++ b/src/process.c
@@ -746,8 +746,9 @@ void ProcessInput2(char *ibuf, size_t ilen)
                        if (ilen == 1) {
                                D_ESCseen = ktab;
                                WindowChanged(fore, WINESC_ESC_SEEN);
-                               ilen--;
                        }
+                       if (ilen > 0)
+                               ilen--;
                }
                if (ilen == 0)
                        return;
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]