mirror of git://git.sv.gnu.org/nano.git
input: let the handler of string binds return a byte whenever possible
The function get_code_from_plantation() should return ERR only when
the string bind is fully exhausted. In the normal case, where some
bytes are still available, it should return the first of these bytes,
so that the {verbatim} function will work too.
This fixes https://savannah.gnu.org/bugs/?63702.
Bug existed since version 7.0, commit 958ec294
,
since command cartouches were introduced.
This commit is contained in:
parent
b896670e85
commit
51c9f7270c
|
@ -383,6 +383,7 @@ int get_code_from_plantation(void)
|
||||||
return PLANTED_COMMAND;
|
return PLANTED_COMMAND;
|
||||||
} else {
|
} else {
|
||||||
char *opening = strchr(plants_pointer, '{');
|
char *opening = strchr(plants_pointer, '{');
|
||||||
|
char firstbyte = *plants_pointer;
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
if (opening) {
|
if (opening) {
|
||||||
|
@ -391,12 +392,12 @@ int get_code_from_plantation(void)
|
||||||
} else
|
} else
|
||||||
length = strlen(plants_pointer);
|
length = strlen(plants_pointer);
|
||||||
|
|
||||||
for (int index = length - 1; index >= 0; index--)
|
for (int index = length - 1; index > 0; index--)
|
||||||
put_back((unsigned char)plants_pointer[index]);
|
put_back((unsigned char)plants_pointer[index]);
|
||||||
|
|
||||||
plants_pointer += length;
|
plants_pointer += length;
|
||||||
|
|
||||||
return ERR;
|
return (firstbyte) ? firstbyte : ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue