mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-21 13:00:57 +01:00
* 2073x: Src/Zle/zle_utils.c, Src/hist.c: modify zlegetline() and zlegetline
caller so that the octet-based and wide-character versions should return the same string.
This commit is contained in:
parent
d94e9817ce
commit
0038b1a682
3 changed files with 32 additions and 2 deletions
|
|
@ -3,6 +3,10 @@
|
||||||
* unposted (cf. zsh-users/8412): Config/version.mk: fix
|
* unposted (cf. zsh-users/8412): Config/version.mk: fix
|
||||||
year typo.
|
year typo.
|
||||||
|
|
||||||
|
* 2073x: Src/Zle/zle_utils.c, Src/hist.c: modify zlegetline() and
|
||||||
|
zlegetline caller so that the octet-based and wide-character
|
||||||
|
versions should return the same string.
|
||||||
|
|
||||||
2005-01-21 Bart Schaefer <schaefer@brasslantern.com>
|
2005-01-21 Bart Schaefer <schaefer@brasslantern.com>
|
||||||
|
|
||||||
* unposted (cf. zsh-users/8409): Functions/Zle/keeper: "keeper"
|
* unposted (cf. zsh-users/8409): Functions/Zle/keeper: "keeper"
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,35 @@ zleaddtoline(int chr)
|
||||||
mod_export unsigned char *
|
mod_export unsigned char *
|
||||||
zlegetline(int *ll, int *cs)
|
zlegetline(int *ll, int *cs)
|
||||||
{
|
{
|
||||||
|
char *s;
|
||||||
|
#ifdef ZLE_UNICODE_SUPPORT
|
||||||
|
char *mb_cursor;
|
||||||
|
int i, j;
|
||||||
|
size_t mb_len = 0;
|
||||||
|
|
||||||
|
mb_cursor = s = zalloc(zlell * MB_CUR_MAX);
|
||||||
|
|
||||||
|
for(i=0;i<=zlell;i++) {
|
||||||
|
if (i == zlecs)
|
||||||
|
*cs = mb_len;
|
||||||
|
j = wctomb(mb_cursor, zleline[i]);
|
||||||
|
if (j == -1) {
|
||||||
|
/* invalid char; what to do? */
|
||||||
|
} else {
|
||||||
|
mb_len += j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*ll = mb_len;
|
||||||
|
|
||||||
|
return (unsigned char *)s;
|
||||||
|
#else
|
||||||
*ll = zlell;
|
*ll = zlell;
|
||||||
*cs = zlecs;
|
*cs = zlecs;
|
||||||
|
|
||||||
return zleline;
|
s = ztrdup(zleline);
|
||||||
|
return (unsigned char *)s;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2260,7 +2260,7 @@ bufferwords(LinkList list, char *buf, int *index)
|
||||||
if (zlegetlineptr) {
|
if (zlegetlineptr) {
|
||||||
linein = zlegetlineptr(&ll, &cs);
|
linein = zlegetlineptr(&ll, &cs);
|
||||||
} else {
|
} else {
|
||||||
linein = "";
|
linein = ztrdup("");
|
||||||
ll = cs = 0;
|
ll = cs = 0;
|
||||||
}
|
}
|
||||||
zlell = ll + 1; /* length of line plus space added below */
|
zlell = ll + 1; /* length of line plus space added below */
|
||||||
|
|
@ -2287,6 +2287,7 @@ bufferwords(LinkList list, char *buf, int *index)
|
||||||
p[zlell] = '\0';
|
p[zlell] = '\0';
|
||||||
inpush(p, 0, NULL);
|
inpush(p, 0, NULL);
|
||||||
}
|
}
|
||||||
|
zsfree(linein);
|
||||||
}
|
}
|
||||||
if (zlecs)
|
if (zlecs)
|
||||||
zlecs--;
|
zlecs--;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue