diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2010-01-13 12:05:22 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2010-01-13 12:05:22 +0000 |
commit | 036cb0ce95580efa03dff169bb3dba457a48cfdc (patch) | |
tree | c1e611cf935047a626af55ef9e50c82acc4fc5cf /Src/input.c | |
parent | a7ea114f965abfea376293f9e56d1d790c1ca1d2 (diff) | |
download | zsh-036cb0ce95580efa03dff169bb3dba457a48cfdc.tar.gz zsh-036cb0ce95580efa03dff169bb3dba457a48cfdc.tar.xz zsh-036cb0ce95580efa03dff169bb3dba457a48cfdc.zip |
Joakim Rosqvist: 27591 as modified in 27594:
KEYBOARD_HACK variable
Diffstat (limited to 'Src/input.c')
-rw-r--r-- | Src/input.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/Src/input.c b/Src/input.c index 80f8ec8d5..248d2ae71 100644 --- a/Src/input.c +++ b/Src/input.c @@ -291,20 +291,32 @@ inputline(void) zputs(ingetcline, stderr); fflush(stderr); } - if (*ingetcline && ingetcline[strlen(ingetcline) - 1] == '\n' && - interact && isset(SUNKEYBOARDHACK) && isset(SHINSTDIN) && - SHTTY != -1 && *ingetcline && ingetcline[1] && - ingetcline[strlen(ingetcline) - 2] == '`') { - /* Junk an unmatched "`" at the end of the line. */ - int ct; - char *ptr; - - for (ct = 0, ptr = ingetcline; *ptr; ptr++) - if (*ptr == '`') - ct++; - if (ct & 1) { - ptr[-2] = '\n'; - ptr[-1] = '\0'; + if (keyboardhackchar && *ingetcline && + ingetcline[strlen(ingetcline) - 1] == '\n' && + interact && isset(SHINSTDIN) && + SHTTY != -1 && ingetcline[1]) + { + char *stripptr = ingetcline + strlen(ingetcline) - 2; + if (*stripptr == keyboardhackchar) { + /* Junk an unwanted character at the end of the line. + (key too close to return key) */ + int ct = 1; /* force odd */ + char *ptr; + + if (keyboardhackchar == '\'' || keyboardhackchar == '"' || + keyboardhackchar == '`') { + /* + * for the chars above, also require an odd count before + * junking + */ + for (ct = 0, ptr = ingetcline; *ptr; ptr++) + if (*ptr == keyboardhackchar) + ct++; + } + if (ct & 1) { + stripptr[0] = '\n'; + stripptr[1] = '\0'; + } } } isfirstch = 1; |