Skip to content

Commit 8871713

Browse files
committed
[notcurses] one more attempt to fix input handling
Related to #1625
1 parent 03ac257 commit 8871713

File tree

1 file changed

+7
-0
lines changed
  • src/third-party/notcurses/src/lib

1 file changed

+7
-0
lines changed

src/third-party/notcurses/src/lib/in.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,6 +2475,7 @@ process_melange(inputctx* ictx, const unsigned char* buf, int* bufused){
24752475
logdebug("input %d (%u)/%d [0x%02x] (%c)", offset, ictx->amata.used,
24762476
*bufused, buf[offset], isprint(buf[offset]) ? buf[offset] : ' ');
24772477
int consumed = 0;
2478+
int gotescape = 0;
24782479
if(buf[offset] == '\x1b'){
24792480
consumed = process_escape(ictx, buf + offset, *bufused);
24802481
if(consumed < 0){
@@ -2487,6 +2488,8 @@ process_melange(inputctx* ictx, const unsigned char* buf, int* bufused){
24872488
ictx->midescape = 0;
24882489
}
24892490
}
2491+
} else {
2492+
gotescape = 1;
24902493
}
24912494
}
24922495
// don't process as input only if we just read a valid control character,
@@ -2510,6 +2513,10 @@ process_melange(inputctx* ictx, const unsigned char* buf, int* bufused){
25102513
}
25112514
*bufused -= consumed;
25122515
offset += consumed;
2516+
if (origlen <= 32 && *bufused > 0 && consumed > 0 && gotescape) {
2517+
logdebug("got one escape, trying to read next one...");
2518+
break;
2519+
}
25132520
}
25142521
handoff_initial_responses_late(ictx);
25152522
}

0 commit comments

Comments
 (0)