mirror of https://github.com/tildeclub/ex-vi.git
* The '\u', '\l', '\U', and '\L' substitution sequences work with multibyte
characters now.
This commit is contained in:
parent
6b5d023516
commit
6f9ef30277
2
Changes
2
Changes
|
@ -2,6 +2,8 @@ Release ...
|
||||||
* When a multicolumn character was replaced by another multicolumn character
|
* When a multicolumn character was replaced by another multicolumn character
|
||||||
in insert mode, the display was not updated appropriately with terminals
|
in insert mode, the display was not updated appropriately with terminals
|
||||||
other than xterm.
|
other than xterm.
|
||||||
|
* The '\u', '\l', '\U', and '\L' substitution sequences work with multibyte
|
||||||
|
characters now.
|
||||||
* Handle character case conversions with the '~' vi command correctly if the
|
* Handle character case conversions with the '~' vi command correctly if the
|
||||||
length of the converted multibyte sequence is smaller than the original one.
|
length of the converted multibyte sequence is smaller than the original one.
|
||||||
* Fixed an old vi bug: If a vi command that yanked or deleted part of a line
|
* Fixed an old vi bug: If a vi command that yanked or deleted part of a line
|
||||||
|
|
102
ex_re.c
102
ex_re.c
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#ifdef DOSCCS
|
#ifdef DOSCCS
|
||||||
static char sccsid[] = "@(#)ex_re.c 1.43 (gritter) 1/2/05";
|
static char sccsid[] = "@(#)ex_re.c 1.44 (gritter) 1/9/05";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ void
|
||||||
dosub(void)
|
dosub(void)
|
||||||
{
|
{
|
||||||
register char *lp, *sp, *rp;
|
register char *lp, *sp, *rp;
|
||||||
int c;
|
int c, n;
|
||||||
#ifdef BIT8
|
#ifdef BIT8
|
||||||
register char *qp;
|
register char *qp;
|
||||||
int q;
|
int q;
|
||||||
|
@ -591,10 +591,13 @@ dosub(void)
|
||||||
while (lp < loc1)
|
while (lp < loc1)
|
||||||
*sp++ = *lp++;
|
*sp++ = *lp++;
|
||||||
casecnt = 0;
|
casecnt = 0;
|
||||||
while (c = *rp++) {
|
while (*rp) {
|
||||||
|
nextc(c, rp, n);
|
||||||
|
rp += n;
|
||||||
#ifdef BIT8
|
#ifdef BIT8
|
||||||
c &= TRIM;
|
c &= TRIM;
|
||||||
q = *qp++;
|
q = *qp;
|
||||||
|
qp += n;
|
||||||
#endif
|
#endif
|
||||||
/* ^V <return> from vi to split lines */
|
/* ^V <return> from vi to split lines */
|
||||||
if (c == '\r')
|
if (c == '\r')
|
||||||
|
@ -649,17 +652,29 @@ dosub(void)
|
||||||
goto ovflo;
|
goto ovflo;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifndef BIT8
|
#ifdef MB
|
||||||
if (casecnt)
|
if (mb_cur_max > 1) {
|
||||||
*sp++ = fixcase(c & TRIM);
|
char mb[MB_CUR_MAX+1];
|
||||||
else
|
int i, m;
|
||||||
*sp++ = c & TRIM;
|
if (casecnt)
|
||||||
#else
|
c = fixcase(c & TRIM);
|
||||||
if (casecnt)
|
if (c & INVBIT || (m = wctomb(mb, c)) <= 0) {
|
||||||
*sp++ = fixcase(c);
|
*mb = rp[-n];
|
||||||
else
|
m = 1;
|
||||||
*sp++ = c;
|
}
|
||||||
#endif
|
for (i = 0; i < m; i++) {
|
||||||
|
*sp++ = mb[i];
|
||||||
|
if (sp >= &genbuf[LBSIZE])
|
||||||
|
goto ovflo;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
#endif /* MB */
|
||||||
|
{
|
||||||
|
if (casecnt)
|
||||||
|
*sp++ = fixcase(c & TRIM);
|
||||||
|
else
|
||||||
|
*sp++ = c & TRIM;
|
||||||
|
}
|
||||||
if (sp >= &genbuf[LBSIZE])
|
if (sp >= &genbuf[LBSIZE])
|
||||||
ovflo:
|
ovflo:
|
||||||
error(catgets(catd, 1, 130,
|
error(catgets(catd, 1, 130,
|
||||||
|
@ -680,23 +695,62 @@ fixcase(register int c)
|
||||||
if (casecnt == 0)
|
if (casecnt == 0)
|
||||||
return (c);
|
return (c);
|
||||||
casecnt--;
|
casecnt--;
|
||||||
if (destuc) {
|
#ifdef MB
|
||||||
if (islower(c))
|
if (c & INVBIT)
|
||||||
c = toupper(c);
|
return (c);
|
||||||
|
if (mb_cur_max > 1) {
|
||||||
|
if (destuc) {
|
||||||
|
if (iswlower(c))
|
||||||
|
c = towupper(c);
|
||||||
|
} else
|
||||||
|
if (iswupper(c))
|
||||||
|
c = towlower(c);
|
||||||
} else
|
} else
|
||||||
if (isupper(c))
|
#endif /* MB */
|
||||||
c = tolower(c);
|
{
|
||||||
|
if (destuc) {
|
||||||
|
if (islower(c))
|
||||||
|
c = toupper(c);
|
||||||
|
} else
|
||||||
|
if (isupper(c))
|
||||||
|
c = tolower(c);
|
||||||
|
}
|
||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
place(register char *sp, register char *l1, register char *l2)
|
place(register char *sp, register char *l1, register char *l2)
|
||||||
{
|
{
|
||||||
|
|
||||||
while (l1 < l2) {
|
while (l1 < l2) {
|
||||||
*sp++ = fixcase(*l1++);
|
#ifdef MB
|
||||||
if (sp >= &genbuf[LBSIZE])
|
if (mb_cur_max > 1) {
|
||||||
return (0);
|
char mb[MB_LEN_MAX+1];
|
||||||
|
int c, i, m, n;
|
||||||
|
|
||||||
|
nextc(c, l1, m);
|
||||||
|
if (c & INVBIT) {
|
||||||
|
m = n = 1;
|
||||||
|
*mb = *l1;
|
||||||
|
} else {
|
||||||
|
c = fixcase(c);
|
||||||
|
if ((n = wctomb(mb, c)) <= 0) {
|
||||||
|
n = 1;
|
||||||
|
*mb = *l1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l1 += m;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
*sp++ = mb[i];
|
||||||
|
if (sp >= &genbuf[LBSIZE])
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
#endif /* MB */
|
||||||
|
{
|
||||||
|
*sp++ = fixcase(*l1++);
|
||||||
|
if (sp >= &genbuf[LBSIZE])
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (sp);
|
return (sp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,12 +70,12 @@
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* Sccsid @(#)ex_version.c 1.109 (gritter) 1/2/05
|
* Sccsid @(#)ex_version.c 1.110 (gritter) 1/9/05
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ex.h"
|
#include "ex.h"
|
||||||
|
|
||||||
static char *versionstring = "@(#)Version 4.0 (gritter) 1/2/05";
|
static char *versionstring = "@(#)Version 4.0 (gritter) 1/9/05";
|
||||||
|
|
||||||
void
|
void
|
||||||
printver(void)
|
printver(void)
|
||||||
|
|
Loading…
Reference in New Issue