Mercurial > vim
annotate src/farsi.c @ 12574:575d530df053 v8.0.1165
patch 8.0.1165: popup test is still flaky
commit https://github.com/vim/vim/commit/f52c38315669f85bbcf3bd74c590148bf588f6c6
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 30 16:49:19 2017 +0200
patch 8.0.1165: popup test is still flaky
Problem: Popup test is still flaky.
Solution: Add a term_wait() call. (Ozaki Kiichi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 30 Sep 2017 17:00:04 +0200 |
parents | e45c6e4d78af |
children | dd725a8ab112 |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
9403
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 * See README.txt for an overview of the Vim source code. | |
8 */ | |
9 | |
10 /* | |
11 * farsi.c: functions for Farsi language | |
12 */ | |
13 | |
9403
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
9399
diff
changeset
|
14 #include "vim.h" |
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
9399
diff
changeset
|
15 |
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
9399
diff
changeset
|
16 #if defined(FEAT_FKMAP) || defined(PROTO) |
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
9399
diff
changeset
|
17 |
7801
a1e71a01dbd6
commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents:
4352
diff
changeset
|
18 static int F_is_TyB_TyC_TyD(int src, int offset); |
7 | 19 |
20 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
21 * Convert the given Farsi character into a _X or _X_ type |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
22 */ |
7 | 23 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
24 toF_Xor_X_(int c) |
7 | 25 { |
26 int tempc; | |
27 | |
28 switch (c) | |
29 { | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
30 case BE: return _BE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
31 case PE: return _PE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
32 case TE: return _TE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
33 case SE: return _SE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
34 case JIM: return _JIM; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
35 case CHE: return _CHE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
36 case HE_J: return _HE_J; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
37 case XE: return _XE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
38 case SIN: return _SIN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
39 case SHIN: return _SHIN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
40 case SAD: return _SAD; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
41 case ZAD: return _ZAD; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
42 case AYN: return _AYN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
43 case AYN_: return _AYN_; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
44 case GHAYN: return _GHAYN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
45 case GHAYN_: return _GHAYN_; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
46 case FE: return _FE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
47 case GHAF: return _GHAF; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
48 case KAF: return _KAF; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
49 case GAF: return _GAF; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
50 case LAM: return _LAM; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
51 case MIM: return _MIM; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
52 case NOON: return _NOON; |
7 | 53 case YE: |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
54 case YE_: return _YE; |
7 | 55 case YEE: |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
56 case YEE_: return _YEE; |
7 | 57 case IE: |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
58 case IE_: return _IE; |
7 | 59 case F_HE: |
60 tempc = _HE; | |
61 | |
1880 | 62 if (p_ri && (curwin->w_cursor.col + 1 |
63 < (colnr_T)STRLEN(ml_get_curline()))) | |
7 | 64 { |
65 inc_cursor(); | |
66 | |
67 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) | |
68 tempc = _HE_; | |
69 | |
70 dec_cursor(); | |
71 } | |
72 if (!p_ri && STRLEN(ml_get_curline())) | |
73 { | |
74 dec_cursor(); | |
75 | |
76 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) | |
77 tempc = _HE_; | |
78 | |
79 inc_cursor(); | |
80 } | |
81 | |
82 return tempc; | |
83 } | |
84 return 0; | |
85 } | |
86 | |
87 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
88 * Convert the given Farsi character into Farsi capital character. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
89 */ |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
90 static int |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
91 toF_TyA(int c) |
7 | 92 { |
93 switch (c) | |
94 { | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
95 case ALEF_: return ALEF; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
96 case ALEF_U_H_: return ALEF_U_H; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
97 case _BE: return BE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
98 case _PE: return PE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
99 case _TE: return TE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
100 case _SE: return SE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
101 case _JIM: return JIM; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
102 case _CHE: return CHE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
103 case _HE_J: return HE_J; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
104 case _XE: return XE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
105 case _SIN: return SIN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
106 case _SHIN: return SHIN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
107 case _SAD: return SAD; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
108 case _ZAD: return ZAD; |
7 | 109 case _AYN: |
110 case AYN_: | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
111 case _AYN_: return AYN; |
7 | 112 case _GHAYN: |
113 case GHAYN_: | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
114 case _GHAYN_: return GHAYN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
115 case _FE: return FE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
116 case _GHAF: return GHAF; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
117 /* I am not sure what it is !!! case _KAF_H: */ |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
118 case _KAF: return KAF; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
119 case _GAF: return GAF; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
120 case _LAM: return LAM; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
121 case _MIM: return MIM; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
122 case _NOON: return NOON; |
7 | 123 case _YE: |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
124 case YE_: return YE; |
7 | 125 case _YEE: |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
126 case YEE_: return YEE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
127 case TEE_: return TEE; |
7 | 128 case _IE: |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
129 case IE_: return IE; |
7 | 130 case _HE: |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
131 case _HE_: return F_HE; |
7 | 132 } |
133 return c; | |
134 } | |
135 | |
136 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
137 * Is the character under the cursor+offset in the given buffer a join type. |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
138 * That is a character that is combined with the others. |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
139 * Note: the offset is used only for command line buffer. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
140 */ |
7 | 141 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
142 F_is_TyB_TyC_TyD(int src, int offset) |
7 | 143 { |
144 int c; | |
145 | |
146 if (src == SRC_EDT) | |
147 c = gchar_cursor(); | |
148 else | |
149 c = cmd_gchar(AT_CURSOR+offset); | |
150 | |
151 switch (c) | |
152 { | |
153 case _LAM: | |
154 case _BE: | |
155 case _PE: | |
156 case _TE: | |
157 case _SE: | |
158 case _JIM: | |
159 case _CHE: | |
160 case _HE_J: | |
161 case _XE: | |
162 case _SIN: | |
163 case _SHIN: | |
164 case _SAD: | |
165 case _ZAD: | |
166 case _TA: | |
167 case _ZA: | |
168 case _AYN: | |
169 case _AYN_: | |
170 case _GHAYN: | |
171 case _GHAYN_: | |
172 case _FE: | |
173 case _GHAF: | |
174 case _KAF: | |
175 case _KAF_H: | |
176 case _GAF: | |
177 case _MIM: | |
178 case _NOON: | |
179 case _YE: | |
180 case _YEE: | |
181 case _IE: | |
182 case _HE_: | |
183 case _HE: | |
184 return TRUE; | |
185 } | |
186 return FALSE; | |
187 } | |
188 | |
189 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
190 * Is the Farsi character one of the terminating only type. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
191 */ |
7 | 192 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
193 F_is_TyE(int c) |
7 | 194 { |
195 switch (c) | |
196 { | |
197 case ALEF_A: | |
198 case ALEF_D_H: | |
199 case DAL: | |
200 case ZAL: | |
201 case RE: | |
202 case ZE: | |
203 case JE: | |
204 case WAW: | |
205 case WAW_H: | |
206 case HAMZE: | |
207 return TRUE; | |
208 } | |
209 return FALSE; | |
210 } | |
211 | |
212 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
213 * Is the Farsi character one of the none leading type. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
214 */ |
7 | 215 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
216 F_is_TyC_TyD(int c) |
7 | 217 { |
218 switch (c) | |
219 { | |
220 case ALEF_: | |
221 case ALEF_U_H_: | |
222 case _AYN_: | |
223 case AYN_: | |
224 case _GHAYN_: | |
225 case GHAYN_: | |
226 case _HE_: | |
227 case YE_: | |
228 case IE_: | |
229 case TEE_: | |
230 case YEE_: | |
231 return TRUE; | |
232 } | |
233 return FALSE; | |
234 } | |
235 | |
236 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
237 * Convert a none leading Farsi char into a leading type. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
238 */ |
7 | 239 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
240 toF_TyB(int c) |
7 | 241 { |
242 switch (c) | |
243 { | |
244 case ALEF_: return ALEF; | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
245 case ALEF_U_H_: return ALEF_U_H; |
7 | 246 case _AYN_: return _AYN; |
247 case AYN_: return AYN; /* exception - there are many of them */ | |
248 case _GHAYN_: return _GHAYN; | |
249 case GHAYN_: return GHAYN; /* exception - there are many of them */ | |
250 case _HE_: return _HE; | |
251 case YE_: return YE; | |
252 case IE_: return IE; | |
253 case TEE_: return TEE; | |
254 case YEE_: return YEE; | |
255 } | |
256 return c; | |
257 } | |
258 | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
259 |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
260 static void |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
261 put_and_redo(int c) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
262 { |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
263 pchar_cursor(c); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
264 AppendCharToRedobuff(K_BS); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
265 AppendCharToRedobuff(c); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
266 } |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
267 |
7 | 268 /* |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
269 * Overwrite the current redo and cursor characters + left adjust. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
270 */ |
7 | 271 static void |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
272 put_curr_and_l_to_X(int c) |
7 | 273 { |
274 int tempc; | |
275 | |
276 if (curwin->w_p_rl && p_ri) | |
277 return; | |
278 | |
1880 | 279 if ((curwin->w_cursor.col < (colnr_T)STRLEN(ml_get_curline()))) |
7 | 280 { |
281 if ((p_ri && curwin->w_cursor.col) || !p_ri) | |
282 { | |
283 if (p_ri) | |
284 dec_cursor(); | |
285 else | |
286 inc_cursor(); | |
287 | |
288 if (F_is_TyC_TyD((tempc = gchar_cursor()))) | |
289 { | |
290 pchar_cursor(toF_TyB(tempc)); | |
291 AppendCharToRedobuff(K_BS); | |
292 AppendCharToRedobuff(tempc); | |
293 } | |
294 | |
295 if (p_ri) | |
296 inc_cursor(); | |
297 else | |
298 dec_cursor(); | |
299 } | |
300 } | |
301 | |
302 put_and_redo(c); | |
303 } | |
304 | |
305 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
306 * Change the char. under the cursor to a X_ or X type |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
307 */ |
7 | 308 static void |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
309 chg_c_toX_orX(void) |
7 | 310 { |
311 int tempc, curc; | |
312 | |
313 switch ((curc = gchar_cursor())) | |
314 { | |
315 case _BE: | |
316 tempc = BE; | |
317 break; | |
318 case _PE: | |
319 tempc = PE; | |
320 break; | |
321 case _TE: | |
322 tempc = TE; | |
323 break; | |
324 case _SE: | |
325 tempc = SE; | |
326 break; | |
327 case _JIM: | |
328 tempc = JIM; | |
329 break; | |
330 case _CHE: | |
331 tempc = CHE; | |
332 break; | |
333 case _HE_J: | |
334 tempc = HE_J; | |
335 break; | |
336 case _XE: | |
337 tempc = XE; | |
338 break; | |
339 case _SIN: | |
340 tempc = SIN; | |
341 break; | |
342 case _SHIN: | |
343 tempc = SHIN; | |
344 break; | |
345 case _SAD: | |
346 tempc = SAD; | |
347 break; | |
348 case _ZAD: | |
349 tempc = ZAD; | |
350 break; | |
351 case _FE: | |
352 tempc = FE; | |
353 break; | |
354 case _GHAF: | |
355 tempc = GHAF; | |
356 break; | |
357 case _KAF_H: | |
358 case _KAF: | |
359 tempc = KAF; | |
360 break; | |
361 case _GAF: | |
362 tempc = GAF; | |
363 break; | |
364 case _AYN: | |
365 tempc = AYN; | |
366 break; | |
367 case _AYN_: | |
368 tempc = AYN_; | |
369 break; | |
370 case _GHAYN: | |
371 tempc = GHAYN; | |
372 break; | |
373 case _GHAYN_: | |
374 tempc = GHAYN_; | |
375 break; | |
376 case _LAM: | |
377 tempc = LAM; | |
378 break; | |
379 case _MIM: | |
380 tempc = MIM; | |
381 break; | |
382 case _NOON: | |
383 tempc = NOON; | |
384 break; | |
385 case _HE: | |
386 case _HE_: | |
387 tempc = F_HE; | |
388 break; | |
389 case _YE: | |
390 case _IE: | |
391 case _YEE: | |
392 if (p_ri) | |
393 { | |
394 inc_cursor(); | |
395 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) | |
396 tempc = (curc == _YE ? YE_ : | |
397 (curc == _IE ? IE_ : YEE_)); | |
398 else | |
399 tempc = (curc == _YE ? YE : | |
400 (curc == _IE ? IE : YEE)); | |
401 dec_cursor(); | |
402 } | |
403 else | |
404 { | |
405 if (curwin->w_cursor.col) | |
406 { | |
407 dec_cursor(); | |
408 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) | |
409 tempc = (curc == _YE ? YE_ : | |
410 (curc == _IE ? IE_ : YEE_)); | |
411 else | |
412 tempc = (curc == _YE ? YE : | |
413 (curc == _IE ? IE : YEE)); | |
414 inc_cursor(); | |
415 } | |
416 else | |
417 tempc = (curc == _YE ? YE : | |
418 (curc == _IE ? IE : YEE)); | |
419 } | |
420 break; | |
421 default: | |
422 tempc = 0; | |
423 } | |
424 | |
425 if (tempc) | |
426 put_and_redo(tempc); | |
427 } | |
428 | |
429 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
430 * Change the char. under the cursor to a _X_ or X_ type |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
431 */ |
7 | 432 static void |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
433 chg_c_to_X_orX_(void) |
7 | 434 { |
435 int tempc; | |
436 | |
437 switch (gchar_cursor()) | |
438 { | |
439 case ALEF: | |
440 tempc = ALEF_; | |
441 break; | |
442 case ALEF_U_H: | |
443 tempc = ALEF_U_H_; | |
444 break; | |
445 case _AYN: | |
446 tempc = _AYN_; | |
447 break; | |
448 case AYN: | |
449 tempc = AYN_; | |
450 break; | |
451 case _GHAYN: | |
452 tempc = _GHAYN_; | |
453 break; | |
454 case GHAYN: | |
455 tempc = GHAYN_; | |
456 break; | |
457 case _HE: | |
458 tempc = _HE_; | |
459 break; | |
460 case YE: | |
461 tempc = YE_; | |
462 break; | |
463 case IE: | |
464 tempc = IE_; | |
465 break; | |
466 case TEE: | |
467 tempc = TEE_; | |
468 break; | |
469 case YEE: | |
470 tempc = YEE_; | |
471 break; | |
472 default: | |
473 tempc = 0; | |
474 } | |
475 | |
476 if (tempc) | |
477 put_and_redo(tempc); | |
478 } | |
479 | |
480 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
481 * Change the char. under the cursor to a _X_ or _X type |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
482 */ |
7 | 483 static void |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
484 chg_c_to_X_or_X(void) |
7 | 485 { |
486 int tempc; | |
487 | |
488 tempc = gchar_cursor(); | |
489 | |
1880 | 490 if (curwin->w_cursor.col + 1 < (colnr_T)STRLEN(ml_get_curline())) |
7 | 491 { |
492 inc_cursor(); | |
493 | |
494 if ((tempc == F_HE) && (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))) | |
495 { | |
496 tempc = _HE_; | |
497 | |
498 dec_cursor(); | |
499 | |
500 put_and_redo(tempc); | |
501 return; | |
502 } | |
503 | |
504 dec_cursor(); | |
505 } | |
506 | |
507 if ((tempc = toF_Xor_X_(tempc)) != 0) | |
508 put_and_redo(tempc); | |
509 } | |
510 | |
511 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
512 * Change the character left to the cursor to a _X_ or X_ type |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
513 */ |
7 | 514 static void |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
515 chg_l_to_X_orX_(void) |
7 | 516 { |
517 int tempc; | |
518 | |
1880 | 519 if (curwin->w_cursor.col != 0 && |
520 (curwin->w_cursor.col + 1 == (colnr_T)STRLEN(ml_get_curline()))) | |
7 | 521 return; |
522 | |
523 if (!curwin->w_cursor.col && p_ri) | |
524 return; | |
525 | |
526 if (p_ri) | |
527 dec_cursor(); | |
528 else | |
529 inc_cursor(); | |
530 | |
531 switch (gchar_cursor()) | |
532 { | |
533 case ALEF: | |
534 tempc = ALEF_; | |
535 break; | |
536 case ALEF_U_H: | |
537 tempc = ALEF_U_H_; | |
538 break; | |
539 case _AYN: | |
540 tempc = _AYN_; | |
541 break; | |
542 case AYN: | |
543 tempc = AYN_; | |
544 break; | |
545 case _GHAYN: | |
546 tempc = _GHAYN_; | |
547 break; | |
548 case GHAYN: | |
549 tempc = GHAYN_; | |
550 break; | |
551 case _HE: | |
552 tempc = _HE_; | |
553 break; | |
554 case YE: | |
555 tempc = YE_; | |
556 break; | |
557 case IE: | |
558 tempc = IE_; | |
559 break; | |
560 case TEE: | |
561 tempc = TEE_; | |
562 break; | |
563 case YEE: | |
564 tempc = YEE_; | |
565 break; | |
566 default: | |
567 tempc = 0; | |
568 } | |
569 | |
570 if (tempc) | |
571 put_and_redo(tempc); | |
572 | |
573 if (p_ri) | |
574 inc_cursor(); | |
575 else | |
576 dec_cursor(); | |
577 } | |
578 | |
579 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
580 * Change the character left to the cursor to a X or _X type |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
581 */ |
7 | 582 static void |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
583 chg_l_toXor_X(void) |
7 | 584 { |
585 int tempc; | |
586 | |
1880 | 587 if (curwin->w_cursor.col != 0 && |
588 (curwin->w_cursor.col + 1 == (colnr_T)STRLEN(ml_get_curline()))) | |
7 | 589 return; |
590 | |
591 if (!curwin->w_cursor.col && p_ri) | |
592 return; | |
593 | |
594 if (p_ri) | |
595 dec_cursor(); | |
596 else | |
597 inc_cursor(); | |
598 | |
599 switch (gchar_cursor()) | |
600 { | |
601 case ALEF_: | |
602 tempc = ALEF; | |
603 break; | |
604 case ALEF_U_H_: | |
605 tempc = ALEF_U_H; | |
606 break; | |
607 case _AYN_: | |
608 tempc = _AYN; | |
609 break; | |
610 case AYN_: | |
611 tempc = AYN; | |
612 break; | |
613 case _GHAYN_: | |
614 tempc = _GHAYN; | |
615 break; | |
616 case GHAYN_: | |
617 tempc = GHAYN; | |
618 break; | |
619 case _HE_: | |
620 tempc = _HE; | |
621 break; | |
622 case YE_: | |
623 tempc = YE; | |
624 break; | |
625 case IE_: | |
626 tempc = IE; | |
627 break; | |
628 case TEE_: | |
629 tempc = TEE; | |
630 break; | |
631 case YEE_: | |
632 tempc = YEE; | |
633 break; | |
634 default: | |
635 tempc = 0; | |
636 } | |
637 | |
638 if (tempc) | |
639 put_and_redo(tempc); | |
640 | |
641 if (p_ri) | |
642 inc_cursor(); | |
643 else | |
644 dec_cursor(); | |
645 } | |
646 | |
647 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
648 * Change the character right to the cursor to a _X or _X_ type |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
649 */ |
7 | 650 static void |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
651 chg_r_to_Xor_X_(void) |
7 | 652 { |
653 int tempc, c; | |
654 | |
655 if (curwin->w_cursor.col) | |
656 { | |
657 if (!p_ri) | |
658 dec_cursor(); | |
659 | |
660 tempc = gchar_cursor(); | |
661 | |
662 if ((c = toF_Xor_X_(tempc)) != 0) | |
663 put_and_redo(c); | |
664 | |
665 if (!p_ri) | |
666 inc_cursor(); | |
667 | |
668 } | |
669 } | |
670 | |
671 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
672 * Map Farsi keyboard when in fkmap mode. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
673 */ |
7 | 674 int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
675 fkmap(int c) |
7 | 676 { |
677 int tempc; | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
678 int insert_mode = (State & INSERT); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
679 static int revins = 0; |
7 | 680 |
681 if (IS_SPECIAL(c)) | |
682 return c; | |
683 | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
684 if (insert_mode) |
7 | 685 { |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
686 if (VIM_ISDIGIT(c) || ((c == '.' || c == '+' || c == '-' || |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
687 c == '^' || c == '%' || c == '#' || c == '=') && revins)) |
7 | 688 { |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
689 /* Numbers are entered left-to-right. */ |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
690 if (!revins) |
7 | 691 { |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
692 if (curwin->w_cursor.col) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
693 { |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
694 if (!p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
695 dec_cursor(); |
7 | 696 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
697 chg_c_toX_orX (); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
698 chg_l_toXor_X (); |
7 | 699 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
700 if (!p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
701 inc_cursor(); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
702 } |
7 | 703 } |
704 | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
705 arrow_used = TRUE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
706 (void)stop_arrow(); |
7 | 707 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
708 if (!curwin->w_p_rl && revins) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
709 inc_cursor(); |
7 | 710 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
711 ++revins; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
712 p_ri = 1; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
713 } |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
714 else if (revins) |
7 | 715 { |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
716 /* Stop entering number. */ |
7 | 717 arrow_used = TRUE; |
718 (void)stop_arrow(); | |
719 | |
720 revins = 0; | |
721 if (curwin->w_p_rl) | |
722 { | |
723 while ((F_isdigit(gchar_cursor()) | |
724 || (gchar_cursor() == F_PERIOD | |
725 || gchar_cursor() == F_PLUS | |
726 || gchar_cursor() == F_MINUS | |
727 || gchar_cursor() == F_MUL | |
728 || gchar_cursor() == F_DIVIDE | |
729 || gchar_cursor() == F_PERCENT | |
730 || gchar_cursor() == F_EQUALS)) | |
731 && gchar_cursor() != NUL) | |
732 ++curwin->w_cursor.col; | |
733 } | |
734 else | |
735 { | |
736 if (curwin->w_cursor.col) | |
737 while ((F_isdigit(gchar_cursor()) | |
738 || (gchar_cursor() == F_PERIOD | |
739 || gchar_cursor() == F_PLUS | |
740 || gchar_cursor() == F_MINUS | |
741 || gchar_cursor() == F_MUL | |
742 || gchar_cursor() == F_DIVIDE | |
743 || gchar_cursor() == F_PERCENT | |
744 || gchar_cursor() == F_EQUALS)) | |
745 && --curwin->w_cursor.col) | |
746 ; | |
747 | |
748 if (!F_isdigit(gchar_cursor())) | |
749 ++curwin->w_cursor.col; | |
750 } | |
751 } | |
752 } | |
753 | |
754 if (!revins) | |
755 { | |
756 if (curwin->w_p_rl) | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
757 p_ri = 0; |
7 | 758 if (!curwin->w_p_rl) |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
759 p_ri = 1; |
7 | 760 } |
761 | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
762 if ((c < 0x100) && (isalpha(c) || c == '&' || c == '^' || c == ';' || |
7 | 763 c == '\''|| c == ',' || c == '[' || |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
764 c == ']' || c == '{' || c == '}')) |
7 | 765 chg_r_to_Xor_X_(); |
766 | |
767 tempc = 0; | |
768 | |
769 switch (c) | |
770 { | |
771 case '`': | |
772 case ' ': | |
773 case '.': | |
774 case '!': | |
775 case '"': | |
776 case '$': | |
777 case '%': | |
778 case '^': | |
779 case '&': | |
780 case '/': | |
781 case '(': | |
782 case ')': | |
783 case '=': | |
784 case '\\': | |
785 case '?': | |
786 case '+': | |
787 case '-': | |
788 case '_': | |
789 case '*': | |
790 case ':': | |
791 case '#': | |
792 case '~': | |
793 case '@': | |
794 case '<': | |
795 case '>': | |
796 case '{': | |
797 case '}': | |
798 case '|': | |
799 case '0': | |
800 case '1': | |
801 case '2': | |
802 case '3': | |
803 case '4': | |
804 case '5': | |
805 case '6': | |
806 case '7': | |
807 case '8': | |
808 case '9': | |
809 case 'B': | |
810 case 'E': | |
811 case 'F': | |
812 case 'H': | |
813 case 'I': | |
814 case 'K': | |
815 case 'L': | |
816 case 'M': | |
817 case 'O': | |
818 case 'P': | |
819 case 'Q': | |
820 case 'R': | |
821 case 'T': | |
822 case 'U': | |
823 case 'W': | |
824 case 'Y': | |
825 case NL: | |
826 case TAB: | |
827 | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
828 if (p_ri && c == NL && curwin->w_cursor.col && insert_mode) |
7 | 829 { |
830 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
831 * If the char before the cursor is _X_ or X_ do not change |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
832 * the one under the cursor with X type. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
833 */ |
7 | 834 dec_cursor(); |
835 | |
836 if (F_isalpha(gchar_cursor())) | |
837 { | |
838 inc_cursor(); | |
839 return NL; | |
840 } | |
841 | |
842 inc_cursor(); | |
843 } | |
844 | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
845 if (!p_ri && !curwin->w_cursor.col) |
7 | 846 { |
847 switch (c) | |
848 { | |
849 case '0': return FARSI_0; | |
850 case '1': return FARSI_1; | |
851 case '2': return FARSI_2; | |
852 case '3': return FARSI_3; | |
853 case '4': return FARSI_4; | |
854 case '5': return FARSI_5; | |
855 case '6': return FARSI_6; | |
856 case '7': return FARSI_7; | |
857 case '8': return FARSI_8; | |
858 case '9': return FARSI_9; | |
859 case 'B': return F_PSP; | |
860 case 'E': return JAZR_N; | |
861 case 'F': return ALEF_D_H; | |
862 case 'H': return ALEF_A; | |
863 case 'I': return TASH; | |
864 case 'K': return F_LQUOT; | |
865 case 'L': return F_RQUOT; | |
866 case 'M': return HAMZE; | |
867 case 'O': return '['; | |
868 case 'P': return ']'; | |
869 case 'Q': return OO; | |
870 case 'R': return MAD_N; | |
871 case 'T': return OW; | |
872 case 'U': return MAD; | |
873 case 'W': return OW_OW; | |
874 case 'Y': return JAZR; | |
875 case '`': return F_PCN; | |
876 case '!': return F_EXCL; | |
877 case '@': return F_COMMA; | |
878 case '#': return F_DIVIDE; | |
879 case '$': return F_CURRENCY; | |
880 case '%': return F_PERCENT; | |
881 case '^': return F_MUL; | |
882 case '&': return F_BCOMMA; | |
883 case '*': return F_STAR; | |
884 case '(': return F_LPARENT; | |
885 case ')': return F_RPARENT; | |
886 case '-': return F_MINUS; | |
887 case '_': return F_UNDERLINE; | |
888 case '=': return F_EQUALS; | |
889 case '+': return F_PLUS; | |
890 case '\\': return F_BSLASH; | |
891 case '|': return F_PIPE; | |
892 case ':': return F_DCOLON; | |
893 case '"': return F_SEMICOLON; | |
894 case '.': return F_PERIOD; | |
895 case '/': return F_SLASH; | |
896 case '<': return F_LESS; | |
897 case '>': return F_GREATER; | |
898 case '?': return F_QUESTION; | |
899 case ' ': return F_BLANK; | |
900 } | |
901 break; | |
902 } | |
903 | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
904 if (insert_mode) |
7 | 905 { |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
906 if (!p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
907 dec_cursor(); |
7 | 908 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
909 switch ((tempc = gchar_cursor())) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
910 { |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
911 case _BE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
912 case _PE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
913 case _TE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
914 case _SE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
915 case _JIM: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
916 case _CHE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
917 case _HE_J: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
918 case _XE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
919 case _SIN: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
920 case _SHIN: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
921 case _SAD: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
922 case _ZAD: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
923 case _FE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
924 case _GHAF: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
925 case _KAF: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
926 case _KAF_H: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
927 case _GAF: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
928 case _LAM: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
929 case _MIM: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
930 case _NOON: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
931 case _HE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
932 case _HE_: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
933 case _TA: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
934 case _ZA: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
935 put_curr_and_l_to_X(toF_TyA(tempc)); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
936 break; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
937 case _AYN: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
938 case _AYN_: |
7 | 939 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
940 if (!p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
941 if (!curwin->w_cursor.col) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
942 { |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
943 put_curr_and_l_to_X(AYN); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
944 break; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
945 } |
7 | 946 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
947 if (p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
948 inc_cursor(); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
949 else |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
950 dec_cursor(); |
7 | 951 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
952 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
953 tempc = AYN_; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
954 else |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
955 tempc = AYN; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
956 |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
957 if (p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
958 dec_cursor(); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
959 else |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
960 inc_cursor(); |
7 | 961 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
962 put_curr_and_l_to_X(tempc); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
963 |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
964 break; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
965 case _GHAYN: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
966 case _GHAYN_: |
7 | 967 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
968 if (!p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
969 if (!curwin->w_cursor.col) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
970 { |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
971 put_curr_and_l_to_X(GHAYN); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
972 break; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
973 } |
7 | 974 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
975 if (p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
976 inc_cursor(); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
977 else |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
978 dec_cursor(); |
7 | 979 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
980 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
981 tempc = GHAYN_; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
982 else |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
983 tempc = GHAYN; |
7 | 984 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
985 if (p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
986 dec_cursor(); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
987 else |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
988 inc_cursor(); |
7 | 989 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
990 put_curr_and_l_to_X(tempc); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
991 break; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
992 case _YE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
993 case _IE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
994 case _YEE: |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
995 if (!p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
996 if (!curwin->w_cursor.col) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
997 { |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
998 put_curr_and_l_to_X((tempc == _YE ? YE : |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
999 (tempc == _IE ? IE : YEE))); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1000 break; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1001 } |
7 | 1002 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1003 if (p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1004 inc_cursor(); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1005 else |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1006 dec_cursor(); |
7 | 1007 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1008 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1009 tempc = (tempc == _YE ? YE_ : |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1010 (tempc == _IE ? IE_ : YEE_)); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1011 else |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1012 tempc = (tempc == _YE ? YE : |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1013 (tempc == _IE ? IE : YEE)); |
7 | 1014 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1015 if (p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1016 dec_cursor(); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1017 else |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1018 inc_cursor(); |
7 | 1019 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1020 put_curr_and_l_to_X(tempc); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1021 break; |
7 | 1022 } |
1023 | |
1024 if (!p_ri) | |
1025 inc_cursor(); | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1026 } |
7 | 1027 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1028 tempc = 0; |
7 | 1029 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1030 switch (c) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1031 { |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1032 case '0': return FARSI_0; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1033 case '1': return FARSI_1; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1034 case '2': return FARSI_2; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1035 case '3': return FARSI_3; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1036 case '4': return FARSI_4; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1037 case '5': return FARSI_5; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1038 case '6': return FARSI_6; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1039 case '7': return FARSI_7; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1040 case '8': return FARSI_8; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1041 case '9': return FARSI_9; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1042 case 'B': return F_PSP; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1043 case 'E': return JAZR_N; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1044 case 'F': return ALEF_D_H; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1045 case 'H': return ALEF_A; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1046 case 'I': return TASH; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1047 case 'K': return F_LQUOT; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1048 case 'L': return F_RQUOT; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1049 case 'M': return HAMZE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1050 case 'O': return '['; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1051 case 'P': return ']'; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1052 case 'Q': return OO; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1053 case 'R': return MAD_N; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1054 case 'T': return OW; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1055 case 'U': return MAD; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1056 case 'W': return OW_OW; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1057 case 'Y': return JAZR; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1058 case '`': return F_PCN; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1059 case '!': return F_EXCL; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1060 case '@': return F_COMMA; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1061 case '#': return F_DIVIDE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1062 case '$': return F_CURRENCY; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1063 case '%': return F_PERCENT; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1064 case '^': return F_MUL; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1065 case '&': return F_BCOMMA; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1066 case '*': return F_STAR; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1067 case '(': return F_LPARENT; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1068 case ')': return F_RPARENT; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1069 case '-': return F_MINUS; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1070 case '_': return F_UNDERLINE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1071 case '=': return F_EQUALS; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1072 case '+': return F_PLUS; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1073 case '\\': return F_BSLASH; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1074 case '|': return F_PIPE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1075 case ':': return F_DCOLON; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1076 case '"': return F_SEMICOLON; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1077 case '.': return F_PERIOD; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1078 case '/': return F_SLASH; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1079 case '<': return F_LESS; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1080 case '>': return F_GREATER; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1081 case '?': return F_QUESTION; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1082 case ' ': return F_BLANK; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1083 } |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1084 break; |
7 | 1085 |
1086 case 'a': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1087 tempc = _SHIN; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1088 break; |
7 | 1089 case 'A': |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1090 tempc = WAW_H; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1091 break; |
7 | 1092 case 'b': |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1093 tempc = ZAL; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1094 break; |
7 | 1095 case 'c': |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1096 tempc = ZE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1097 break; |
7 | 1098 case 'C': |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1099 tempc = JE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1100 break; |
7 | 1101 case 'd': |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1102 tempc = _YE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1103 break; |
7 | 1104 case 'D': |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1105 tempc = _YEE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1106 break; |
7 | 1107 case 'e': |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1108 tempc = _SE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1109 break; |
7 | 1110 case 'f': |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1111 tempc = _BE; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1112 break; |
7 | 1113 case 'g': |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1114 tempc = _LAM; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1115 break; |
7 | 1116 case 'G': |
1117 if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1118 { |
7 | 1119 |
1120 if (gchar_cursor() == _LAM) | |
1121 chg_c_toX_orX (); | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1122 else if (p_ri) |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1123 chg_c_to_X_or_X (); |
7 | 1124 } |
1125 | |
1126 if (!p_ri) | |
1127 if (!curwin->w_cursor.col) | |
1128 return ALEF_U_H; | |
1129 | |
1130 if (!p_ri) | |
1131 dec_cursor(); | |
1132 | |
1133 if (gchar_cursor() == _LAM) | |
1134 { | |
1135 chg_c_toX_orX (); | |
1136 chg_l_toXor_X (); | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1137 tempc = ALEF_U_H; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1138 } |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1139 else if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1140 { |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1141 tempc = ALEF_U_H_; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1142 chg_l_toXor_X (); |
7 | 1143 } |
1144 else | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1145 tempc = ALEF_U_H; |
7 | 1146 |
1147 if (!p_ri) | |
1148 inc_cursor(); | |
1149 | |
1150 return tempc; | |
1151 case 'h': | |
1152 if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) | |
1153 { | |
1154 if (p_ri) | |
1155 chg_c_to_X_or_X (); | |
1156 | |
1157 } | |
1158 | |
1159 if (!p_ri) | |
1160 if (!curwin->w_cursor.col) | |
1161 return ALEF; | |
1162 | |
1163 if (!p_ri) | |
1164 dec_cursor(); | |
1165 | |
1166 if (gchar_cursor() == _LAM) | |
1167 { | |
1168 chg_l_toXor_X(); | |
1169 del_char(FALSE); | |
1170 AppendCharToRedobuff(K_BS); | |
1171 | |
1172 if (!p_ri) | |
1173 dec_cursor(); | |
1174 | |
8238
d7e1526ae1b9
commit https://github.com/vim/vim/commit/68c85fcdf31c104db21c96cd5871724e458c95ff
Christian Brabandt <cb@256bit.org>
parents:
7819
diff
changeset
|
1175 tempc = LA; |
7 | 1176 } |
1177 else | |
1178 { | |
1179 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) | |
1180 { | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1181 tempc = ALEF_; |
7 | 1182 chg_l_toXor_X (); |
1183 } | |
1184 else | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1185 tempc = ALEF; |
7 | 1186 } |
1187 | |
1188 if (!p_ri) | |
1189 inc_cursor(); | |
1190 | |
1191 return tempc; | |
1192 case 'i': | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1193 if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1194 { |
7 | 1195 if (!p_ri && !F_is_TyE(tempc)) |
1196 chg_c_to_X_orX_ (); | |
1197 if (p_ri) | |
1198 chg_c_to_X_or_X (); | |
1199 | |
1200 } | |
1201 | |
1202 if (!p_ri && !curwin->w_cursor.col) | |
1203 return _HE; | |
1204 | |
1205 if (!p_ri) | |
1206 dec_cursor(); | |
1207 | |
1208 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1209 tempc = _HE_; |
7 | 1210 else |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1211 tempc = _HE; |
7 | 1212 |
1213 if (!p_ri) | |
1214 inc_cursor(); | |
1215 break; | |
1216 case 'j': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1217 tempc = _TE; |
7 | 1218 break; |
1219 case 'J': | |
1220 if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1221 { |
7 | 1222 if (p_ri) |
1223 chg_c_to_X_or_X (); | |
1224 | |
1225 } | |
1226 | |
1227 if (!p_ri) | |
1228 if (!curwin->w_cursor.col) | |
1229 return TEE; | |
1230 | |
1231 if (!p_ri) | |
1232 dec_cursor(); | |
1233 | |
1234 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) | |
1235 { | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1236 tempc = TEE_; |
7 | 1237 chg_l_toXor_X (); |
1238 } | |
1239 else | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1240 tempc = TEE; |
7 | 1241 |
1242 if (!p_ri) | |
1243 inc_cursor(); | |
1244 | |
1245 return tempc; | |
1246 case 'k': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1247 tempc = _NOON; |
7 | 1248 break; |
1249 case 'l': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1250 tempc = _MIM; |
7 | 1251 break; |
1252 case 'm': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1253 tempc = _PE; |
7 | 1254 break; |
1255 case 'n': | |
1256 case 'N': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1257 tempc = DAL; |
7 | 1258 break; |
1259 case 'o': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1260 tempc = _XE; |
7 | 1261 break; |
1262 case 'p': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1263 tempc = _HE_J; |
7 | 1264 break; |
1265 case 'q': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1266 tempc = _ZAD; |
7 | 1267 break; |
1268 case 'r': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1269 tempc = _GHAF; |
7 | 1270 break; |
1271 case 's': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1272 tempc = _SIN; |
7 | 1273 break; |
1274 case 'S': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1275 tempc = _IE; |
7 | 1276 break; |
1277 case 't': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1278 tempc = _FE; |
7 | 1279 break; |
1280 case 'u': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1281 if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1282 { |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1283 if (!p_ri && !F_is_TyE(tempc)) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1284 chg_c_to_X_orX_ (); |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1285 if (p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1286 chg_c_to_X_or_X (); |
7 | 1287 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1288 } |
7 | 1289 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1290 if (!p_ri && !curwin->w_cursor.col) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1291 return _AYN; |
7 | 1292 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1293 if (!p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1294 dec_cursor(); |
7 | 1295 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1296 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1297 tempc = _AYN_; |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1298 else |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1299 tempc = _AYN; |
7 | 1300 |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1301 if (!p_ri) |
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1302 inc_cursor(); |
7 | 1303 break; |
1304 case 'v': | |
1305 case 'V': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1306 tempc = RE; |
7 | 1307 break; |
1308 case 'w': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1309 tempc = _SAD; |
7 | 1310 break; |
1311 case 'x': | |
1312 case 'X': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1313 tempc = _TA; |
7 | 1314 break; |
1315 case 'y': | |
1316 if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1317 { |
7 | 1318 if (!p_ri && !F_is_TyE(tempc)) |
1319 chg_c_to_X_orX_ (); | |
1320 if (p_ri) | |
1321 chg_c_to_X_or_X (); | |
1322 | |
1323 } | |
1324 | |
1325 if (!p_ri && !curwin->w_cursor.col) | |
1326 return _GHAYN; | |
1327 | |
1328 if (!p_ri) | |
1329 dec_cursor(); | |
1330 | |
1331 if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) | |
1332 tempc = _GHAYN_; | |
1333 else | |
1334 tempc = _GHAYN; | |
1335 | |
1336 if (!p_ri) | |
1337 inc_cursor(); | |
1338 | |
1339 break; | |
1340 case 'z': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1341 tempc = _ZA; |
7 | 1342 break; |
1343 case 'Z': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1344 tempc = _KAF_H; |
7 | 1345 break; |
1346 case ';': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1347 tempc = _KAF; |
7 | 1348 break; |
1349 case '\'': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1350 tempc = _GAF; |
7 | 1351 break; |
1352 case ',': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1353 tempc = WAW; |
7 | 1354 break; |
1355 case '[': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1356 tempc = _JIM; |
7 | 1357 break; |
1358 case ']': | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1359 tempc = _CHE; |
7 | 1360 break; |
1361 } | |
1362 | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1363 if (F_isalpha(tempc) || F_isdigit(tempc)) |
7 | 1364 { |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1365 if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1366 { |
7 | 1367 if (!p_ri && !F_is_TyE(tempc)) |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1368 chg_c_to_X_orX_(); |
7 | 1369 if (p_ri) |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1370 chg_c_to_X_or_X(); |
7 | 1371 } |
1372 | |
1373 if (curwin->w_cursor.col) | |
1374 { | |
1375 if (!p_ri) | |
1376 dec_cursor(); | |
1377 | |
1378 if (F_is_TyE(tempc)) | |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1379 chg_l_toXor_X(); |
7 | 1380 else |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1381 chg_l_to_X_orX_(); |
7 | 1382 |
1383 if (!p_ri) | |
1384 inc_cursor(); | |
1385 } | |
1386 } | |
1387 if (tempc) | |
1388 return tempc; | |
1389 return c; | |
1390 } | |
1391 | |
1392 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1393 * Convert a none leading Farsi char into a leading type. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1394 */ |
7 | 1395 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1396 toF_leading(int c) |
7 | 1397 { |
1398 switch (c) | |
1399 { | |
1400 case ALEF_: return ALEF; | |
1401 case ALEF_U_H_: return ALEF_U_H; | |
1402 case BE: return _BE; | |
1403 case PE: return _PE; | |
1404 case TE: return _TE; | |
1405 case SE: return _SE; | |
1406 case JIM: return _JIM; | |
1407 case CHE: return _CHE; | |
1408 case HE_J: return _HE_J; | |
1409 case XE: return _XE; | |
1410 case SIN: return _SIN; | |
1411 case SHIN: return _SHIN; | |
1412 case SAD: return _SAD; | |
1413 case ZAD: return _ZAD; | |
1414 | |
1415 case AYN: | |
1416 case AYN_: | |
1417 case _AYN_: return _AYN; | |
1418 | |
1419 case GHAYN: | |
1420 case GHAYN_: | |
1421 case _GHAYN_: return _GHAYN; | |
1422 | |
1423 case FE: return _FE; | |
1424 case GHAF: return _GHAF; | |
1425 case KAF: return _KAF; | |
1426 case GAF: return _GAF; | |
1427 case LAM: return _LAM; | |
1428 case MIM: return _MIM; | |
1429 case NOON: return _NOON; | |
1430 | |
1431 case _HE_: | |
1432 case F_HE: return _HE; | |
1433 | |
1434 case YE: | |
1435 case YE_: return _YE; | |
1436 | |
1437 case IE_: | |
1438 case IE: return _IE; | |
1439 | |
1440 case YEE: | |
1441 case YEE_: return _YEE; | |
1442 } | |
1443 return c; | |
1444 } | |
1445 | |
1446 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1447 * Convert a given Farsi char into right joining type. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1448 */ |
7 | 1449 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1450 toF_Rjoin(int c) |
7 | 1451 { |
1452 switch (c) | |
1453 { | |
1454 case ALEF: return ALEF_; | |
1455 case ALEF_U_H: return ALEF_U_H_; | |
1456 case BE: return _BE; | |
1457 case PE: return _PE; | |
1458 case TE: return _TE; | |
1459 case SE: return _SE; | |
1460 case JIM: return _JIM; | |
1461 case CHE: return _CHE; | |
1462 case HE_J: return _HE_J; | |
1463 case XE: return _XE; | |
1464 case SIN: return _SIN; | |
1465 case SHIN: return _SHIN; | |
1466 case SAD: return _SAD; | |
1467 case ZAD: return _ZAD; | |
1468 | |
1469 case AYN: | |
1470 case AYN_: | |
1471 case _AYN: return _AYN_; | |
1472 | |
1473 case GHAYN: | |
1474 case GHAYN_: | |
1475 case _GHAYN_: return _GHAYN_; | |
1476 | |
1477 case FE: return _FE; | |
1478 case GHAF: return _GHAF; | |
1479 case KAF: return _KAF; | |
1480 case GAF: return _GAF; | |
1481 case LAM: return _LAM; | |
1482 case MIM: return _MIM; | |
1483 case NOON: return _NOON; | |
1484 | |
1485 case _HE: | |
1486 case F_HE: return _HE_; | |
1487 | |
1488 case YE: | |
1489 case YE_: return _YE; | |
1490 | |
1491 case IE_: | |
1492 case IE: return _IE; | |
1493 | |
1494 case TEE: return TEE_; | |
1495 | |
1496 case YEE: | |
1497 case YEE_: return _YEE; | |
1498 } | |
1499 return c; | |
1500 } | |
1501 | |
1502 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1503 * Can a given Farsi character join via its left edj. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1504 */ |
7 | 1505 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1506 canF_Ljoin(int c) |
7 | 1507 { |
1508 switch (c) | |
1509 { | |
1510 case _BE: | |
1511 case BE: | |
1512 case PE: | |
1513 case _PE: | |
1514 case TE: | |
1515 case _TE: | |
1516 case SE: | |
1517 case _SE: | |
1518 case JIM: | |
1519 case _JIM: | |
1520 case CHE: | |
1521 case _CHE: | |
1522 case HE_J: | |
1523 case _HE_J: | |
1524 case XE: | |
1525 case _XE: | |
1526 case SIN: | |
1527 case _SIN: | |
1528 case SHIN: | |
1529 case _SHIN: | |
1530 case SAD: | |
1531 case _SAD: | |
1532 case ZAD: | |
1533 case _ZAD: | |
1534 case _TA: | |
1535 case _ZA: | |
1536 case AYN: | |
1537 case _AYN: | |
1538 case _AYN_: | |
1539 case AYN_: | |
1540 case GHAYN: | |
1541 case GHAYN_: | |
1542 case _GHAYN_: | |
1543 case _GHAYN: | |
1544 case FE: | |
1545 case _FE: | |
1546 case GHAF: | |
1547 case _GHAF: | |
1548 case _KAF_H: | |
1549 case KAF: | |
1550 case _KAF: | |
1551 case GAF: | |
1552 case _GAF: | |
1553 case LAM: | |
1554 case _LAM: | |
1555 case MIM: | |
1556 case _MIM: | |
1557 case NOON: | |
1558 case _NOON: | |
1559 case IE: | |
1560 case _IE: | |
1561 case IE_: | |
1562 case YE: | |
1563 case _YE: | |
1564 case YE_: | |
1565 case YEE: | |
1566 case _YEE: | |
1567 case YEE_: | |
1568 case F_HE: | |
1569 case _HE: | |
1570 case _HE_: | |
1571 return TRUE; | |
1572 } | |
1573 return FALSE; | |
1574 } | |
1575 | |
1576 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1577 * Can a given Farsi character join via its right edj. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1578 */ |
7 | 1579 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1580 canF_Rjoin(int c) |
7 | 1581 { |
1582 switch (c) | |
1583 { | |
1584 case ALEF: | |
1585 case ALEF_: | |
1586 case ALEF_U_H: | |
1587 case ALEF_U_H_: | |
1588 case DAL: | |
1589 case ZAL: | |
1590 case RE: | |
1591 case JE: | |
1592 case ZE: | |
1593 case TEE: | |
1594 case TEE_: | |
1595 case WAW: | |
1596 case WAW_H: | |
1597 return TRUE; | |
1598 } | |
1599 | |
1600 return canF_Ljoin(c); | |
1601 | |
1602 } | |
1603 | |
1604 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1605 * is a given Farsi character a terminating type. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1606 */ |
7 | 1607 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1608 F_isterm(int c) |
7 | 1609 { |
1610 switch (c) | |
1611 { | |
1612 case ALEF: | |
1613 case ALEF_: | |
1614 case ALEF_U_H: | |
1615 case ALEF_U_H_: | |
1616 case DAL: | |
1617 case ZAL: | |
1618 case RE: | |
1619 case JE: | |
1620 case ZE: | |
1621 case WAW: | |
1622 case WAW_H: | |
1623 case TEE: | |
1624 case TEE_: | |
1625 return TRUE; | |
1626 } | |
1627 | |
1628 return FALSE; | |
1629 } | |
1630 | |
1631 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1632 * Convert the given Farsi character into a ending type . |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1633 */ |
7 | 1634 static int |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1635 toF_ending(int c) |
7 | 1636 { |
1637 switch (c) | |
1638 { | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1639 case _BE: return BE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1640 case _PE: return PE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1641 case _TE: return TE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1642 case _SE: return SE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1643 case _JIM: return JIM; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1644 case _CHE: return CHE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1645 case _HE_J: return HE_J; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1646 case _XE: return XE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1647 case _SIN: return SIN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1648 case _SHIN: return SHIN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1649 case _SAD: return SAD; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1650 case _ZAD: return ZAD; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1651 case _AYN: return AYN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1652 case _AYN_: return AYN_; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1653 case _GHAYN: return GHAYN; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1654 case _GHAYN_: return GHAYN_; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1655 case _FE: return FE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1656 case _GHAF: return GHAF; |
7 | 1657 case _KAF_H: |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1658 case _KAF: return KAF; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1659 case _GAF: return GAF; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1660 case _LAM: return LAM; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1661 case _MIM: return MIM; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1662 case _NOON: return NOON; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1663 case _YE: return YE_; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1664 case YE_: return YE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1665 case _YEE: return YEE_; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1666 case YEE_: return YEE; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1667 case TEE: return TEE_; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1668 case _IE: return IE_; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1669 case IE_: return IE; |
7 | 1670 case _HE: |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1671 case _HE_: return F_HE; |
7 | 1672 } |
1673 return c; | |
1674 } | |
1675 | |
1676 /* | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1677 * Convert the Farsi 3342 standard into Farsi VIM. |
10745
265268ea1adc
patch 8.0.0262: Farsi support is barely tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1678 */ |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1679 static void |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1680 conv_to_pvim(void) |
7 | 1681 { |
1682 char_u *ptr; | |
1683 int lnum, llen, i; | |
1684 | |
1685 for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) | |
1686 { | |
1687 ptr = ml_get((linenr_T)lnum); | |
1688 | |
1689 llen = (int)STRLEN(ptr); | |
1690 | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1691 for (i = 0; i < llen-1; i++) |
7 | 1692 { |
1693 if (canF_Ljoin(ptr[i]) && canF_Rjoin(ptr[i+1])) | |
1694 { | |
1695 ptr[i] = toF_leading(ptr[i]); | |
1696 ++i; | |
1697 | |
11317
e45c6e4d78af
patch 8.0.0544: cppcheck warnings
Christian Brabandt <cb@256bit.org>
parents:
11158
diff
changeset
|
1698 while (i < llen && canF_Rjoin(ptr[i])) |
7 | 1699 { |
1700 ptr[i] = toF_Rjoin(ptr[i]); | |
1701 if (F_isterm(ptr[i]) || !F_isalpha(ptr[i])) | |
1702 break; | |
1703 ++i; | |
1704 } | |
1705 if (!F_isalpha(ptr[i]) || !canF_Rjoin(ptr[i])) | |
1706 ptr[i-1] = toF_ending(ptr[i-1]); | |
1707 } | |
1708 else | |
1709 ptr[i] = toF_TyA(ptr[i]); | |
1710 } | |
1711 } | |
1712 | |
1713 /* | |
1714 * Following lines contains Farsi encoded character. | |
1715 */ | |
1716 | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1717 do_cmdline_cmd((char_u *)"%s/\202\231/\232/ge"); |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1718 do_cmdline_cmd((char_u *)"%s/\201\231/\370\334/ge"); |
7 | 1719 |
1720 /* Assume the screen has been messed up: clear it and redraw. */ | |
1721 redraw_later(CLEAR); | |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
10747
diff
changeset
|
1722 MSG_ATTR(farsi_text_1, HL_ATTR(HLF_S)); |
7 | 1723 } |
1724 | |
1725 /* | |
4352 | 1726 * Convert the Farsi VIM into Farsi 3342 standard. |
7 | 1727 */ |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1728 static void |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1729 conv_to_pstd(void) |
7 | 1730 { |
1731 char_u *ptr; | |
1732 int lnum, llen, i; | |
1733 | |
1734 /* | |
1735 * Following line contains Farsi encoded character. | |
1736 */ | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1737 do_cmdline_cmd((char_u *)"%s/\232/\202\231/ge"); |
7 | 1738 |
1739 for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) | |
1740 { | |
1741 ptr = ml_get((linenr_T)lnum); | |
1742 llen = (int)STRLEN(ptr); | |
1743 | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
1744 for (i = 0; i < llen; i++) |
7 | 1745 ptr[i] = toF_TyA(ptr[i]); |
1746 } | |
1747 | |
1748 /* Assume the screen has been messed up: clear it and redraw. */ | |
1749 redraw_later(CLEAR); | |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
10747
diff
changeset
|
1750 MSG_ATTR(farsi_text_2, HL_ATTR(HLF_S)); |
7 | 1751 } |
1752 | |
1753 /* | |
1754 * left-right swap the characters in buf[len]. | |
1755 */ | |
1756 static void | |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1757 lrswapbuf(char_u *buf, int len) |
7 | 1758 { |
1759 char_u *s, *e; | |
1760 int c; | |
1761 | |
1762 s = buf; | |
1763 e = buf + len - 1; | |
1764 | |
1765 while (e > s) | |
1766 { | |
1767 c = *s; | |
1768 *s = *e; | |
1769 *e = c; | |
1770 ++s; | |
1771 --e; | |
1772 } | |
1773 } | |
1774 | |
1775 /* | |
1776 * swap all the characters in reverse direction | |
1777 */ | |
1778 char_u * | |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1779 lrswap(char_u *ibuf) |
7 | 1780 { |
1781 if (ibuf != NULL && *ibuf != NUL) | |
1782 lrswapbuf(ibuf, (int)STRLEN(ibuf)); | |
1783 return ibuf; | |
1784 } | |
1785 | |
1786 /* | |
1787 * swap all the Farsi characters in reverse direction | |
1788 */ | |
1789 char_u * | |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1790 lrFswap(char_u *cmdbuf, int len) |
7 | 1791 { |
1792 int i, cnt; | |
1793 | |
1794 if (cmdbuf == NULL) | |
1795 return cmdbuf; | |
1796 | |
1797 if (len == 0 && (len = (int)STRLEN(cmdbuf)) == 0) | |
1798 return cmdbuf; | |
1799 | |
1800 for (i = 0; i < len; i++) | |
1801 { | |
1802 for (cnt = 0; i + cnt < len | |
1803 && (F_isalpha(cmdbuf[i + cnt]) | |
1804 || F_isdigit(cmdbuf[i + cnt]) | |
1805 || cmdbuf[i + cnt] == ' '); ++cnt) | |
1806 ; | |
1807 | |
1808 lrswapbuf(cmdbuf + i, cnt); | |
1809 i += cnt; | |
1810 } | |
1811 return cmdbuf; | |
1812 } | |
1813 | |
1814 /* | |
1624 | 1815 * Reverse the characters in the search path and substitute section |
1816 * accordingly. | |
1817 * TODO: handle different separator characters. Use skip_regexp(). | |
7 | 1818 */ |
1819 char_u * | |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1820 lrF_sub(char_u *ibuf) |
7 | 1821 { |
1822 char_u *p, *ep; | |
1823 int i, cnt; | |
1824 | |
1825 p = ibuf; | |
1826 | |
388 | 1827 /* Find the boundary of the search path */ |
396 | 1828 while (((p = vim_strchr(p + 1, '/')) != NULL) && p[-1] == '\\') |
7 | 1829 ; |
1830 | |
1831 if (p == NULL) | |
1832 return ibuf; | |
1833 | |
1834 /* Reverse the Farsi characters in the search path. */ | |
1835 lrFswap(ibuf, (int)(p-ibuf)); | |
1836 | |
388 | 1837 /* Now find the boundary of the substitute section */ |
7 | 1838 if ((ep = (char_u *)strrchr((char *)++p, '/')) != NULL) |
1839 cnt = (int)(ep - p); | |
1840 else | |
1841 cnt = (int)STRLEN(p); | |
1842 | |
1843 /* Reverse the characters in the substitute section and take care of '\' */ | |
1844 for (i = 0; i < cnt-1; i++) | |
1845 if (p[i] == '\\') | |
1846 { | |
1847 p[i] = p[i+1] ; | |
1848 p[++i] = '\\'; | |
1849 } | |
1850 | |
1851 lrswapbuf(p, cnt); | |
1852 | |
1853 return ibuf; | |
1854 } | |
1855 | |
1856 /* | |
1857 * Map Farsi keyboard when in cmd_fkmap mode. | |
1858 */ | |
1859 int | |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
1860 cmdl_fkmap(int c) |
7 | 1861 { |
1862 int tempc; | |
1863 | |
1864 switch (c) | |
1865 { | |
1866 case '0': | |
1867 case '1': | |
1868 case '2': | |
1869 case '3': | |
1870 case '4': | |
1871 case '5': | |
1872 case '6': | |
1873 case '7': | |
1874 case '8': | |
1875 case '9': | |
1876 case '`': | |
1877 case ' ': | |
1878 case '.': | |
1879 case '!': | |
1880 case '"': | |
1881 case '$': | |
1882 case '%': | |
1883 case '^': | |
1884 case '&': | |
1885 case '/': | |
1886 case '(': | |
1887 case ')': | |
1888 case '=': | |
1889 case '\\': | |
1890 case '?': | |
1891 case '+': | |
1892 case '-': | |
1893 case '_': | |
1894 case '*': | |
1895 case ':': | |
1896 case '#': | |
1897 case '~': | |
1898 case '@': | |
1899 case '<': | |
1900 case '>': | |
1901 case '{': | |
1902 case '}': | |
1903 case '|': | |
1904 case 'B': | |
1905 case 'E': | |
1906 case 'F': | |
1907 case 'H': | |
1908 case 'I': | |
1909 case 'K': | |
1910 case 'L': | |
1911 case 'M': | |
1912 case 'O': | |
1913 case 'P': | |
1914 case 'Q': | |
1915 case 'R': | |
1916 case 'T': | |
1917 case 'U': | |
1918 case 'W': | |
1919 case 'Y': | |
1920 case NL: | |
1921 case TAB: | |
1922 | |
10747
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1923 switch ((tempc = cmd_gchar(AT_CURSOR))) |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1924 { |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1925 case _BE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1926 case _PE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1927 case _TE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1928 case _SE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1929 case _JIM: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1930 case _CHE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1931 case _HE_J: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1932 case _XE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1933 case _SIN: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1934 case _SHIN: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1935 case _SAD: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1936 case _ZAD: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1937 case _AYN: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1938 case _GHAYN: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1939 case _FE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1940 case _GHAF: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1941 case _KAF: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1942 case _GAF: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1943 case _LAM: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1944 case _MIM: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1945 case _NOON: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1946 case _HE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1947 case _HE_: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1948 cmd_pchar(toF_TyA(tempc), AT_CURSOR); |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1949 break; |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1950 case _AYN_: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1951 cmd_pchar(AYN_, AT_CURSOR); |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1952 break; |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1953 case _GHAYN_: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1954 cmd_pchar(GHAYN_, AT_CURSOR); |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1955 break; |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1956 case _IE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1957 if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1)) |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1958 cmd_pchar(IE_, AT_CURSOR); |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1959 else |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1960 cmd_pchar(IE, AT_CURSOR); |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1961 break; |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1962 case _YEE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1963 if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1)) |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1964 cmd_pchar(YEE_, AT_CURSOR); |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1965 else |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1966 cmd_pchar(YEE, AT_CURSOR); |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1967 break; |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1968 case _YE: |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1969 if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1)) |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1970 cmd_pchar(YE_, AT_CURSOR); |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1971 else |
b8a79277269a
patch 8.0.0263: Farsi support is not tested enough
Christian Brabandt <cb@256bit.org>
parents:
10745
diff
changeset
|
1972 cmd_pchar(YE, AT_CURSOR); |
7 | 1973 } |
1974 | |
1975 switch (c) | |
1976 { | |
1977 case '0': return FARSI_0; | |
1978 case '1': return FARSI_1; | |
1979 case '2': return FARSI_2; | |
1980 case '3': return FARSI_3; | |
1981 case '4': return FARSI_4; | |
1982 case '5': return FARSI_5; | |
1983 case '6': return FARSI_6; | |
1984 case '7': return FARSI_7; | |
1985 case '8': return FARSI_8; | |
1986 case '9': return FARSI_9; | |
1987 case 'B': return F_PSP; | |
1988 case 'E': return JAZR_N; | |
1989 case 'F': return ALEF_D_H; | |
1990 case 'H': return ALEF_A; | |
1991 case 'I': return TASH; | |
1992 case 'K': return F_LQUOT; | |
1993 case 'L': return F_RQUOT; | |
1994 case 'M': return HAMZE; | |
1995 case 'O': return '['; | |
1996 case 'P': return ']'; | |
1997 case 'Q': return OO; | |
1998 case 'R': return MAD_N; | |
1999 case 'T': return OW; | |
2000 case 'U': return MAD; | |
2001 case 'W': return OW_OW; | |
2002 case 'Y': return JAZR; | |
2003 case '`': return F_PCN; | |
2004 case '!': return F_EXCL; | |
2005 case '@': return F_COMMA; | |
2006 case '#': return F_DIVIDE; | |
2007 case '$': return F_CURRENCY; | |
2008 case '%': return F_PERCENT; | |
2009 case '^': return F_MUL; | |
2010 case '&': return F_BCOMMA; | |
2011 case '*': return F_STAR; | |
2012 case '(': return F_LPARENT; | |
2013 case ')': return F_RPARENT; | |
2014 case '-': return F_MINUS; | |
2015 case '_': return F_UNDERLINE; | |
2016 case '=': return F_EQUALS; | |
2017 case '+': return F_PLUS; | |
2018 case '\\': return F_BSLASH; | |
2019 case '|': return F_PIPE; | |
2020 case ':': return F_DCOLON; | |
2021 case '"': return F_SEMICOLON; | |
2022 case '.': return F_PERIOD; | |
2023 case '/': return F_SLASH; | |
2024 case '<': return F_LESS; | |
2025 case '>': return F_GREATER; | |
2026 case '?': return F_QUESTION; | |
2027 case ' ': return F_BLANK; | |
2028 } | |
2029 | |
2030 break; | |
2031 | |
2032 case 'a': return _SHIN; | |
2033 case 'A': return WAW_H; | |
2034 case 'b': return ZAL; | |
2035 case 'c': return ZE; | |
2036 case 'C': return JE; | |
2037 case 'd': return _YE; | |
2038 case 'D': return _YEE; | |
2039 case 'e': return _SE; | |
2040 case 'f': return _BE; | |
2041 case 'g': return _LAM; | |
2042 case 'G': | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2043 if (cmd_gchar(AT_CURSOR) == _LAM) |
7 | 2044 { |
2045 cmd_pchar(LAM, AT_CURSOR); | |
2046 return ALEF_U_H; | |
2047 } | |
2048 | |
2049 if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR)) | |
2050 return ALEF_U_H_; | |
2051 else | |
2052 return ALEF_U_H; | |
2053 case 'h': | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2054 if (cmd_gchar(AT_CURSOR) == _LAM) |
7 | 2055 { |
2056 cmd_pchar(LA, AT_CURSOR); | |
2057 redrawcmdline(); | |
2058 return K_IGNORE; | |
2059 } | |
2060 | |
2061 if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR)) | |
2062 return ALEF_; | |
2063 else | |
2064 return ALEF; | |
2065 case 'i': | |
2066 if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR)) | |
2067 return _HE_; | |
2068 else | |
2069 return _HE; | |
2070 case 'j': return _TE; | |
2071 case 'J': | |
2072 if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR)) | |
2073 return TEE_; | |
2074 else | |
2075 return TEE; | |
2076 case 'k': return _NOON; | |
2077 case 'l': return _MIM; | |
2078 case 'm': return _PE; | |
2079 case 'n': | |
2080 case 'N': return DAL; | |
2081 case 'o': return _XE; | |
2082 case 'p': return _HE_J; | |
2083 case 'q': return _ZAD; | |
2084 case 'r': return _GHAF; | |
2085 case 's': return _SIN; | |
2086 case 'S': return _IE; | |
2087 case 't': return _FE; | |
2088 case 'u': | |
2089 if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR)) | |
2090 return _AYN_; | |
2091 else | |
2092 return _AYN; | |
2093 case 'v': | |
2094 case 'V': return RE; | |
2095 case 'w': return _SAD; | |
2096 case 'x': | |
2097 case 'X': return _TA; | |
2098 case 'y': | |
2099 if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR)) | |
2100 return _GHAYN_; | |
2101 else | |
2102 return _GHAYN; | |
2103 case 'z': | |
2104 case 'Z': return _ZA; | |
2105 case ';': return _KAF; | |
2106 case '\'': return _GAF; | |
2107 case ',': return WAW; | |
2108 case '[': return _JIM; | |
2109 case ']': return _CHE; | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2110 } |
7 | 2111 |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2112 return c; |
7 | 2113 } |
2114 | |
2115 /* | |
2116 * F_isalpha returns TRUE if 'c' is a Farsi alphabet | |
2117 */ | |
2118 int | |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
2119 F_isalpha(int c) |
7 | 2120 { |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2121 return ((c >= TEE_ && c <= _YE) |
7 | 2122 || (c >= ALEF_A && c <= YE) |
2123 || (c >= _IE && c <= YE_)); | |
2124 } | |
2125 | |
2126 /* | |
2127 * F_isdigit returns TRUE if 'c' is a Farsi digit | |
2128 */ | |
2129 int | |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
2130 F_isdigit(int c) |
7 | 2131 { |
2132 return (c >= FARSI_0 && c <= FARSI_9); | |
2133 } | |
2134 | |
2135 /* | |
2136 * F_ischar returns TRUE if 'c' is a Farsi character. | |
2137 */ | |
2138 int | |
7819
f86adafb28d4
commit https://github.com/vim/vim/commit/78c0b7d43e5048fd71d12816659667834170c76d
Christian Brabandt <cb@256bit.org>
parents:
7801
diff
changeset
|
2139 F_ischar(int c) |
7 | 2140 { |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2141 return (c >= TEE_ && c <= YE_); |
7 | 2142 } |
2143 | |
2144 void | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2145 farsi_f8(cmdarg_T *cap UNUSED) |
7 | 2146 { |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2147 if (p_altkeymap) |
7 | 2148 { |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2149 if (curwin->w_farsi & W_R_L) |
7 | 2150 { |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2151 p_fkmap = 0; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2152 do_cmdline_cmd((char_u *)"set norl"); |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2153 MSG(""); |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2154 } |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2155 else |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2156 { |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2157 p_fkmap = 1; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2158 do_cmdline_cmd((char_u *)"set rl"); |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2159 MSG(""); |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2160 } |
7 | 2161 |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2162 curwin->w_farsi = curwin->w_farsi ^ W_R_L; |
7 | 2163 } |
2164 } | |
9399
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2165 |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2166 void |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2167 farsi_f9(cmdarg_T *cap UNUSED) |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2168 { |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2169 if (p_altkeymap && curwin->w_p_rl) |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2170 { |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2171 curwin->w_farsi = curwin->w_farsi ^ W_CONV; |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2172 if (curwin->w_farsi & W_CONV) |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2173 conv_to_pvim(); |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2174 else |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2175 conv_to_pstd(); |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2176 } |
43b8570abbec
commit https://github.com/vim/vim/commit/ee2615af64fdcee87d8e4b13b65356e77fbd969b
Christian Brabandt <cb@256bit.org>
parents:
8238
diff
changeset
|
2177 } |
9403
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
9399
diff
changeset
|
2178 |
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
9399
diff
changeset
|
2179 #endif /* FEAT_FKMAP */ |