commit 51c9f7270c44420688d4bb0a75c59c9df569f9d6
parent b896670e85f0ff3c9ad7424e6fdd5ae1916e1d8a
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 25 Jan 2023 17:04:23 +0100
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.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -383,6 +383,7 @@ int get_code_from_plantation(void)
return PLANTED_COMMAND;
} else {
char *opening = strchr(plants_pointer, '{');
+ char firstbyte = *plants_pointer;
int length;
if (opening) {
@@ -391,12 +392,12 @@ int get_code_from_plantation(void)
} else
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]);
plants_pointer += length;
- return ERR;
+ return (firstbyte) ? firstbyte : ERR;
}
}
#endif