summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-10-10 17:51:29 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-10-10 17:51:29 +0000
commitaf5a85f3630f3d60ad7061fe32693baf78c27dcd (patch)
tree57a70dffb5fda8bd5cc77ea03ca7479954de9eea /Src
parent6fea7f0d3c4d30ddc78db9e798a3ef9427abbc6f (diff)
downloadzsh-af5a85f3630f3d60ad7061fe32693baf78c27dcd.tar.gz
zsh-af5a85f3630f3d60ad7061fe32693baf78c27dcd.zip
28339: backslash-newline history without HIST_LEX_WORDS
28340: assignment to range of scalar variable with multibyte characters
Diffstat (limited to 'Src')
-rw-r--r--Src/hist.c12
-rw-r--r--Src/params.c17
2 files changed, 24 insertions, 5 deletions
diff --git a/Src/hist.c b/Src/hist.c
index 0eeb98fb0..e65ddb1b6 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2365,7 +2365,7 @@ readhistfile(char *fn, int err, int readflags)
*/
if (inblank(*pt))
pt++;
- else if (strpfx("\\\n", pt))
+ else if (pt[0] == '\\' && pt[1] == '\n')
pt += 2;
else
break;
@@ -2414,8 +2414,14 @@ readhistfile(char *fn, int err, int readflags)
}
if (!uselex) {
do {
- while (inblank(*pt))
- pt++;
+ for (;;) {
+ if (inblank(*pt))
+ pt++;
+ else if (pt[0] == '\\' && pt[1] == '\n')
+ pt += 2;
+ else
+ break;
+ }
if (*pt) {
if (nwordpos >= nwords)
words = (short *)
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;