nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 9c7940b599f5eb58149821d112874917080ef783
parent ccfb1eb0f1a4b7b907dbac85e6beb35c02833d21
Author: Rishabh Dave <rishabhddave@gmail.com>
Date:   Tue,  5 Jul 2016 00:57:53 +0530

utils: accept mistypings and common separators between line and column

It is easy to type beside the comma key and hit instead "m" or ".", so
accept also these as a separator between line and column number.  And
when being generous anyway, also accept space, slash and semicolon.

This fulfills https://savannah.gnu.org/bugs/?48305.

Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>

Diffstat:
Msrc/utils.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/utils.c b/src/utils.c @@ -83,7 +83,12 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column) { bool retval; char *firstpart; - const char *comma = strchr(str, ','); + const char *comma; + + while (*str == ' ') + str++; + + comma = strpbrk(str, "m,. /;"); if (comma == NULL) return parse_num(str, line);