From af5a85f3630f3d60ad7061fe32693baf78c27dcd Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 10 Oct 2010 17:51:29 +0000 Subject: 28339: backslash-newline history without HIST_LEX_WORDS 28340: assignment to range of scalar variable with multibyte characters --- Src/params.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'Src/params.c') diff --git a/Src/params.c b/Src/params.c index 9a9f45893..f49a07f1a 100644 --- a/Src/params.c +++ b/Src/params.c @@ -2275,9 +2275,22 @@ setstrvalue(Value v, char *val) if (v->start > zlen) v->start = zlen; if (v->end < 0) { - v->end += zlen + 1; - if (v->end < 0) + v->end += zlen; + if (v->end < 0) { v->end = 0; + } else if (v->end >= zlen) { + v->end = zlen; + } else { +#ifdef MULTIBYTE_SUPPORT + if (isset(MULTIBYTE)) { + v->end += MB_METACHARLEN(z + v->end); + } else { + v->end++; + } +#else + v->end++; +#endif + } } else if (v->end > zlen) v->end = zlen; -- cgit 1.4.1