Skip to content

Commit 1f45248

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 8dd41d7 + 5b3af14 commit 1f45248

File tree

7 files changed

+124
-8
lines changed

7 files changed

+124
-8
lines changed

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,7 @@ test1 \
21092109

21102110
# Run individual NEW style test, assuming that Vim was already compiled.
21112111
test_arglist \
2112+
test_arabic \
21122113
test_assert \
21132114
test_assign \
21142115
test_autochdir \

src/gen_opt_test.vim

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
" Script to generate testdir/opt_test.vim from option.c
22

3-
if 0
4-
finish
5-
endif
6-
73
set cpo=&vim
4+
5+
" Only do this when build with the +eval feature.
6+
if 1
7+
88
set nomore
99

1010
let script = [
@@ -130,7 +130,6 @@ let test_values = {
130130
\ 'winaltkeys': [['menu', 'no'], ['', 'xxx']],
131131
\
132132
\ 'luadll': [[], []],
133-
\ 'macatsui': [[], []],
134133
\ 'perldll': [[], []],
135134
\ 'pythondll': [[], []],
136135
\ 'pythonthreedll': [[], []],
@@ -196,4 +195,6 @@ call add(script, 'let &lines = save_lines')
196195

197196
call writefile(script, 'testdir/opt_test.vim')
198197

198+
endif
199+
199200
qa!

src/screen.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4189,7 +4189,9 @@ win_line(
41894189
}
41904190
else
41914191
{
4192+
#ifdef FEAT_LINEBREAK
41924193
int c0;
4194+
#endif
41934195

41944196
if (p_extra_free != NULL)
41954197
{
@@ -4199,7 +4201,10 @@ win_line(
41994201
/*
42004202
* Get a character from the line itself.
42014203
*/
4202-
c0 = c = *ptr;
4204+
c = *ptr;
4205+
#ifdef FEAT_LINEBREAK
4206+
c0 = *ptr;
4207+
#endif
42034208
#ifdef FEAT_MBYTE
42044209
if (has_mbyte)
42054210
{
@@ -4216,7 +4221,12 @@ win_line(
42164221
/* Overlong encoded ASCII or ASCII with composing char
42174222
* is displayed normally, except a NUL. */
42184223
if (mb_c < 0x80)
4219-
c0 = c = mb_c;
4224+
{
4225+
c = mb_c;
4226+
# ifdef FEAT_LINEBREAK
4227+
c0 = mb_c;
4228+
# endif
4229+
}
42204230
mb_utf8 = TRUE;
42214231

42224232
/* At start of the line we can have a composing char.

src/testdir/Make_all.mak

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ SCRIPTS_GUI =
133133

134134
# Tests using runtest.vim.vim.
135135
# Keep test_alot*.res as the last one, sort the others.
136-
NEW_TESTS = test_arglist.res \
136+
NEW_TESTS = test_arabic.res \
137+
test_arglist.res \
137138
test_assert.res \
138139
test_autochdir.res \
139140
test_backspace_opt.res \

src/testdir/runtest.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ let s:flaky = [
165165
\ 'Test_collapse_buffers()',
166166
\ 'Test_communicate()',
167167
\ 'Test_nb_basic()',
168+
\ 'Test_oneshot()',
168169
\ 'Test_pipe_through_sort_all()',
169170
\ 'Test_pipe_through_sort_some()',
170171
\ 'Test_reltime()',

src/testdir/test_arabic.vim

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
" Simplistic testing of Arabic mode.
2+
3+
if !has('arabic')
4+
finish
5+
endif
6+
7+
set encoding=utf-8
8+
scriptencoding utf-8
9+
10+
" Return list of utf8 sequences of each character at line lnum.
11+
" Combining characters are treated as a single item.
12+
func GetCharsUtf8(lnum)
13+
call cursor(a:lnum, 1)
14+
let chars = []
15+
let numchars = strchars(getline('.'), 1)
16+
for i in range(1, numchars)
17+
exe 'norm ' i . '|'
18+
call add(chars, execute('norm g8'))
19+
endfor
20+
return chars
21+
endfunc
22+
23+
func Test_arabic_toggle()
24+
set arabic
25+
call assert_equal(1, &rightleft)
26+
call assert_equal(1, &arabicshape)
27+
call assert_equal('arabic', &keymap)
28+
call assert_equal(1, &delcombine)
29+
30+
set iminsert=1 imsearch=1
31+
set arabic&
32+
call assert_equal(0, &rightleft)
33+
call assert_equal(1, &arabicshape)
34+
call assert_equal('arabic', &keymap)
35+
call assert_equal(1, &delcombine)
36+
call assert_equal(0, &iminsert)
37+
call assert_equal(-1, &imsearch)
38+
39+
set arabicshape& keymap= delcombine&
40+
endfunc
41+
42+
func Test_arabic_input()
43+
new
44+
set arabic
45+
" Typing sghl in Arabic insert mode should show the
46+
" Arabic word 'Salaam' i.e. 'peace'.
47+
call feedkeys('isghl', 'tx')
48+
redraw
49+
call assert_equal([
50+
\ "\nd8 b3 ",
51+
\ "\nd9 84 + d8 a7 ",
52+
\ "\nd9 85 "], GetCharsUtf8(1))
53+
54+
" Without shaping, it should give individual Arabic letters.
55+
set noarabicshape
56+
redraw
57+
call assert_equal([
58+
\ "\nd8 b3 ",
59+
\ "\nd9 84 ",
60+
\ "\nd8 a7 ",
61+
\ "\nd9 85 "], GetCharsUtf8(1))
62+
63+
set arabicshape&
64+
set arabic&
65+
bwipe!
66+
endfunc
67+
68+
func Test_arabic_toggle_keymap()
69+
new
70+
set arabic
71+
call feedkeys("i12\<C-^>12\<C-^>12", 'tx')
72+
redraw
73+
call assert_equal('١٢12١٢', getline('.'))
74+
set arabic&
75+
bwipe!
76+
endfunc
77+
78+
func Test_delcombine()
79+
new
80+
set arabic
81+
call feedkeys("isghl\<BS>\<BS>", 'tx')
82+
redraw
83+
call assert_equal(["\nd8 b3 ", "\nd9 84 "], GetCharsUtf8(1))
84+
85+
" Now the same with nodelcombine
86+
set nodelcombine
87+
%d
88+
call feedkeys("isghl\<BS>\<BS>", 'tx')
89+
call assert_equal(["\nd8 b3 "], GetCharsUtf8(1))
90+
set arabic&
91+
bwipe!
92+
endfunc

src/version.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,16 @@ static char *(features[]) =
779779

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
386,
784+
/**/
785+
385,
786+
/**/
787+
384,
788+
/**/
789+
383,
790+
/**/
791+
382,
782792
/**/
783793
381,
784794
/**/

0 commit comments

Comments
 (0)