summaryrefslogtreecommitdiff
blob: 471c7a26b739086128d62fcb12b1b5e61ab8eaac (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
diff -urN rxvt-2.7.10.ORIG/src/screen.c rxvt-2.7.10/src/screen.c
--- rxvt-2.7.10.ORIG/src/screen.c	2003-03-24 01:56:06.000000000 +0900
+++ rxvt-2.7.10/src/screen.c	2003-06-30 02:11:27.000000000 +0900
@@ -828,10 +828,18 @@
 	    if (h->chstat == WBYTE) {
 		h->rstyle |= RS_multi2;	/* multibyte 2nd byte */
 		h->chstat = SBYTE;
-		if ((r->encoding_method == EUCJ) || (r->encoding_method == GB))
+		if ((r->encoding_method == EUCJ) && ((char)stp[r->screen.cur.col - 1] == (char)0x8e))
+		    h->rstyle &= ~RS_multiMask, r->screen.cur.col--;
+		else if ((r->encoding_method == EUCJ) || (r->encoding_method == GB))
 		    c |= 0x80;	/* maybe overkill, but makes it selectable */
 	    } else if (h->chstat == SBYTE) {
-		if (h->multi_byte || (c & 0x80)) {	/* multibyte 1st byte */
+		if (r->encoding_method == SJIS) {
+		    if ((h->multi_byte || ((c >= (char)0x81 && c <= (char)0x9f) || 
+(c >= (char)0xe0 && c <= (char)0xfc)))) {
+			h->rstyle |= RS_multi1;
+			h->chstat = WBYTE;
+		    }
+		} else if (h->multi_byte || (c & 0x80)) {	/* multibyte 1st byte */
 		    h->rstyle |= RS_multi1;
 		    h->chstat = WBYTE;
 		    if ((r->encoding_method == EUCJ)
@@ -2932,6 +2940,9 @@
     unsigned char  *new_selection_text;
     char           *str;
     text_t         *t;
+#ifdef MULTICHAR_SET
+    rend_t         *tr;
+#endif
 
     D_SELECT((stderr, "rxvt_selection_make(): r->selection.op=%d, r->selection.clicks=%d", r->selection.op, r->selection.clicks));
     switch (r->selection.op) {
@@ -2966,10 +2977,22 @@
  */
     for (; row < end_row; row++, col = 0) {
 	t = &(r->screen.text[row][col]);
+#ifdef MULTICHAR_SET
+	tr = &(r->screen.rend[row][col]);
+#endif
 	if ((end_col = r->screen.tlen[row]) == -1)
 	    end_col = r->TermWin.ncol;
+#ifdef MULTICHAR_SET
+	for (; col < end_col; col++, str++, t++, tr++) {
+	    if ( (r->encoding_method == EUCJ)
+		&& (*t & 0x80) && !(*tr & RS_multiMask) )
+		*str++ = 0x8E; 
+	    *str = *t;
+	}
+#else
 	for (; col < end_col; col++)
 	    *str++ = *t++;
+#endif
 	if (r->screen.tlen[row] != -1)
 	    *str++ = '\n';
     }
@@ -2977,12 +3000,24 @@
  * B: end row
  */
     t = &(r->screen.text[row][col]);
+#ifdef MULTICHAR_SET
+    tr = &(r->screen.rend[row][col]);
+#endif
     end_col = r->screen.tlen[row];
     if (end_col == -1 || r->selection.end.col <= end_col)
 	end_col = r->selection.end.col;
     MIN_IT(end_col, r->TermWin.ncol);	/* CHANGE */
+#ifdef MULTICHAR_SET
+    for (; col < end_col; col++, str++, t++, tr++) {
+	if ( (r->encoding_method == EUCJ)
+	    && (*t & 0x80) && !(*tr & RS_multiMask) )
+	    *str++ = 0x8E; 
+	*str = *t;
+    }
+#else
     for (; col < end_col; col++)
 	*str++ = *t++;
+#endif
 #ifndef NO_OLD_SELECTION
     if (r->selection_style == OLD_SELECT)
 	if (end_col == r->TermWin.ncol)