aboutsummaryrefslogtreecommitdiff
path: root/japanese/slirc/files/patch-editor.sl
blob: 1566a6193eb4bc70756764c516131c0fadfdc9d5 (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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
--- scripts/editor.sl.orig	Mon Jun  7 16:07:23 1999
+++ scripts/editor.sl	Sat Jan  6 21:23:30 2001
@@ -35,6 +35,13 @@
      {
 	irc_edit_insert_pos--;
 	buf = chop_last(irc_buffer);
+#ifdef KANJI
+      if(iskanji(irc_buffer[irc_edit_insert_pos]))
+        {
+           irc_edit_insert_pos--;
+           buf = substr(irc_buffer, 1, irc_edit_insert_pos);
+        }
+#endif
 	irc_set_buffer(buf);
      }
    else
@@ -42,6 +49,14 @@
 	irc_edit_insert_pos--;
 	buf = substr(irc_buffer, 1, irc_edit_insert_pos)
 	    + substr(irc_buffer, irc_edit_insert_pos + 2, -1);
+#ifdef KANJI
+      if(iskanji(irc_buffer[irc_edit_insert_pos]))
+        {
+           irc_edit_insert_pos--;
+           buf = substr(irc_buffer, 1, irc_edit_insert_pos)
+             + substr(irc_buffer, irc_edit_insert_pos + 3, -1);
+        }
+#endif
 	irc_set_buffer(buf);
      }
      !if(irc_edit_insert_pos)
@@ -67,10 +82,25 @@
 	   if(ch <  0x0a0) return; % ISO-LATIN-1 are 0xa0-0xff
    }
    variable buf;
+#ifdef KANJI
+   variable keysym;
+#endif
    if(irc_edit_insert_pos >= strlen(irc_buffer))
      {
+#ifdef KANJI
+	buf = irc_buffer + char(ch);
+	irc_edit_insert_pos = strlen(buf);
+	if (iskanji(ch))
+	  {
+	     keysym = irc_get_input();
+	     buf = irc_buffer + char(ch) + char(keysym);
+	     irc_edit_insert_pos = strlen(buf);
+	  }
+	irc_set_buffer(buf);
+#else
 	irc_set_buffer(irc_buffer + char(ch));
 	irc_edit_insert_pos = strlen(irc_buffer);
+#endif
      }
    else
      {
@@ -78,12 +108,30 @@
 	  {
 	     buf = char(ch) + irc_buffer;
 	     irc_edit_insert_pos = 1;
+#ifdef KANJI
+	     if (iskanji(ch))
+	       {
+		  keysym = irc_get_input();
+		  buf = char(ch) + char(keysym) + irc_buffer;
+		  irc_edit_insert_pos = 2;
+	       }
+#endif
 	  }
 	else
 	  {
 	     buf = substr(irc_buffer, 1, irc_edit_insert_pos)
 		 + char(ch)
 		 + substr(irc_buffer, irc_edit_insert_pos + 1, -1);
+#ifdef KANJI
+	     if (iskanji(ch))
+	       {
+		  keysym = irc_get_input();
+		  buf = substr(irc_buffer, 1, irc_edit_insert_pos)
+		    + char(ch) + char(keysym)
+		    + substr(irc_buffer, irc_edit_insert_pos + 1, -1);
+		  irc_edit_insert_pos++;
+	       }
+#endif
 	     irc_edit_insert_pos++;
 	  }
 	irc_set_buffer(buf);
@@ -96,10 +144,20 @@
 {
    if(irc_edit_insert_pos > 0)
      irc_edit_insert_pos --;
+#ifdef KANJI
+   if(irc_edit_insert_pos > 0)
+     if(iskanji(irc_buffer[irc_edit_insert_pos]))
+       irc_edit_insert_pos--;
+#endif
 }
 
 define do_scroll_right()
 {
+#ifdef KANJI
+   if(irc_edit_insert_pos < strlen(irc_buffer))
+     if(iskanji(irc_buffer[irc_edit_insert_pos]))
+       irc_edit_insert_pos++;
+#endif
    if(irc_edit_insert_pos < strlen(irc_buffer))
      irc_edit_insert_pos++;
 }