mirror of
https://git.FreeBSD.org/ports.git
synced 2025-02-04 11:23:46 +00:00
f1f99beceb
This is just an experimental hack and cannot happily be merged into the upstream. Zsh's line editor apparently needs a rewrite in order to support multi-byte encodings because it strongly relies on the single-byte character scheme. These patches are mostly based on the work by ono@ono.org (Thanks!): http://www.ono.org/software/zsh-euc/ What I did over this is disable the hack for non-EUC locales. Maybe the patches can be moved to shells/zsh in the future, but it's premature for the moment. Notes: - forward-char, backward-char and backward-delete-char with no numeric argument should work properly with this hack. - Completion and redisplay should work fine. - There can be some trivial side-effects. - JIS X0201-Roman and JIS X0208-Kanji are supported. - JIS X0201-Katakana and JIS X0212 Kanji are NOT supported. - Only tested with the EUC-JP (ja_JP.eucJP) locale. I'm not sure if it works for GB 2312/CNS 11643-1/KS X 1001. Any feedbacks is welcome, especially a patch if it does not work. :)
48 lines
1.2 KiB
C
48 lines
1.2 KiB
C
--- Src/Zle/zle_refresh.c.orig Mon Sep 10 19:48:51 2001
|
|
+++ Src/Zle/zle_refresh.c Thu May 9 08:36:47 2002
|
|
@@ -647,7 +647,11 @@
|
|
static void
|
|
refreshline(int ln)
|
|
{
|
|
+#ifdef ZSH_EUC
|
|
+ unsigned char *nl, *ol, *p1; /* line buffer pointers */
|
|
+#else
|
|
char *nl, *ol, *p1; /* line buffer pointers */
|
|
+#endif
|
|
int ccs = 0, /* temporary count for cursor position */
|
|
char_ins = 0, /* number of characters inserted/deleted */
|
|
col_cleareol, /* clear to end-of-line from this column */
|
|
@@ -753,7 +757,32 @@
|
|
for (;;) {
|
|
if (*nl && *ol && nl[1] == ol[1]) /* skip only if second chars match */
|
|
/* skip past all matching characters */
|
|
+#ifdef ZSH_EUC
|
|
+ {
|
|
+ if (locale_is_euc) {
|
|
+ for (; *nl && (*nl == *ol); nl++, ol++, ccs++) {
|
|
+ if (_mbmap_euc[*nl] & _MB1) {
|
|
+ if (*(ol+1) == '\0')
|
|
+ continue;
|
|
+ if (_mbmap_euc[*(nl+1)] & _MB2) {
|
|
+ if (*(nl+1) != *(ol+1))
|
|
+ break;
|
|
+ else {
|
|
+ nl++;
|
|
+ ol++;
|
|
+ ccs++;
|
|
+ }
|
|
+ } else if (*(nl+1) == '\0') {
|
|
+ continue;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ } else
|
|
+#endif
|
|
for (; *nl && (*nl == *ol); nl++, ol++, ccs++) ;
|
|
+#ifdef ZSH_EUC
|
|
+ }
|
|
+#endif
|
|
|
|
if (!*nl) {
|
|
if (ccs == winw && hasam && char_ins > 0 && ins_last
|