aboutsummaryrefslogtreecommitdiff
path: root/shells/zsh+euc_hack/files/patch-Src::Zle::zle_refresh.c
blob: 47d7aa6fa8677a80cdb7bccbecd821f7f2c5c2c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- 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