From 3f2dfb08c003f50cfdd31a8dce12759e16d71a53 Mon Sep 17 00:00:00 2001 From: Charlie Gordon Date: Sat, 4 Jan 2014 17:35:12 +0000 Subject: [PATCH] fix do_goto for hex encoded offsets in chars and bytes --- qe.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qe.c b/qe.c index b6011c9..7b5bf5a 100644 --- a/qe.c +++ b/qe.c @@ -1851,9 +1851,21 @@ void do_goto(EditState *s, const char *str, int unit) const char *p; int pos, line, col, rel; + /* Update s->offset from str specification: + * optional +- for relative moves + * distance in decimal, octal or hex + * optional space + * optional unit suffix: + * b(bytes) c(chars) w(words) l(lines) %(percent) + * + * CG: XXX: resulting offset may fall inside a character. + */ rel = (*str == '+' || *str == '-'); pos = strtol(str, (char**)&p, 0); + /* skip space required to separate hex offset from b or c suffix */ + if (*p == ' ') + p++; if (memchr("bcwl%", *p, 5)) unit = *p++;