commit c181aed529846277dfbc8d771b059ca732ad8089
parent 31c269498cf474adbf93feca9ed3fdfaffd7886d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 27 Jul 2014 13:45:49 +0000
fix cast, wgetch() returns int
... so the check was always false.
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sandy.c b/sandy.c
@@ -1014,7 +1014,7 @@ i_dokeys(const Key bindings[], unsigned int length_bindings) {
/* Main editing loop */
void
i_edit(void) {
- int i;
+ int i, tch;
fd_set fds;
Filepos oldsel, oldcur;
@@ -1073,9 +1073,12 @@ i_edit(void) {
if(c[0] == 0x1B || (isutf8 && !ISASCII(c[0]))) {
/* Multi-byte char or escape sequence */
wtimeout(textwin, 1);
- for(i = 1; i < (c[0] == 0x1B ? 6 : UTF8LEN(c[0])); i++)
- if((c[i] = wgetch(textwin)) == ERR)
+ for(i = 1; i < (c[0] == 0x1B ? 6 : UTF8LEN(c[0])); i++) {
+ tch = wgetch(textwin);
+ c[i] = (char)tch;
+ if(tch == ERR)
break;
+ }
for(; i < 7; i++)
c[i] = '\0';
wtimeout(textwin, 0);