Skip to content

Commit 7dc18d3

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents d5c214c + 3ff2f09 commit 7dc18d3

File tree

4 files changed

+211
-3
lines changed

4 files changed

+211
-3
lines changed

src/arabic.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ static int chg_c_a2s(int cur_c);
2424
static int chg_c_a2i(int cur_c);
2525
static int chg_c_a2m(int cur_c);
2626
static int chg_c_a2f(int cur_c);
27+
#if 0
2728
static int chg_c_i2m(int cur_c);
29+
#endif
2830
static int chg_c_f2m(int cur_c);
2931
static int chg_c_laa2i(int hid_c);
3032
static int chg_c_laa2f(int hid_c);
@@ -418,7 +420,10 @@ chg_c_a2f(int cur_c)
418420

419421
/*
420422
* Change shape - from Initial to Medial
423+
* This code is unreachable, because for the relevant characters ARABIC_CHAR()
424+
* is FALSE;
421425
*/
426+
#if 0
422427
static int
423428
chg_c_i2m(int cur_c)
424429
{
@@ -450,6 +455,7 @@ chg_c_i2m(int cur_c)
450455
}
451456
return 0;
452457
}
458+
#endif
453459

454460

455461
/*
@@ -608,7 +614,11 @@ arabic_shape(
608614
else if (!shape_c || A_is_f(shape_c) || A_is_s(shape_c) || prev_laa)
609615
curr_c = A_is_valid(next_c) ? chg_c_a2i(c) : chg_c_a2s(c);
610616
else if (A_is_valid(next_c))
617+
#if 0
611618
curr_c = A_is_iso(c) ? chg_c_a2m(c) : chg_c_i2m(c);
619+
#else
620+
curr_c = A_is_iso(c) ? chg_c_a2m(c) : 0;
621+
#endif
612622
else if (A_is_valid(prev_c))
613623
curr_c = chg_c_a2f(c);
614624
else

src/testdir/test_arabic.vim

Lines changed: 142 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
" Simplistic testing of Arabic mode.
2+
" NOTE: This just checks if the code works. If you know Arabic please add
3+
" functional tests that check the shaping works with real text.
24

35
if !has('arabic') || !has('multi_byte')
46
finish
@@ -417,7 +419,7 @@ func Test_shape_isolated()
417419
bwipe!
418420
endfunc
419421

420-
func Test_shape_medial()
422+
func Test_shape_iso_to_medial()
421423
new
422424
set arabicshape
423425

@@ -470,3 +472,142 @@ func Test_shape_medial()
470472
bwipe!
471473
endfunc
472474

475+
func Test_shape_final()
476+
new
477+
set arabicshape
478+
479+
" Shaping arabic {testchar} arabic Tests chg_c_a2f().
480+
" pair[0] = testchar, pair[1] = current-result, pair[2] = previous-result
481+
for pair in [[s:a_HAMZA, s:a_s_HAMZA, s:a_s_BEH],
482+
\[s:a_ALEF_MADDA, s:a_f_ALEF_MADDA, s:a_i_BEH],
483+
\[s:a_ALEF_HAMZA_ABOVE, s:a_f_ALEF_HAMZA_ABOVE, s:a_i_BEH],
484+
\[s:a_WAW_HAMZA, s:a_f_WAW_HAMZA, s:a_i_BEH],
485+
\[s:a_ALEF_HAMZA_BELOW, s:a_f_ALEF_HAMZA_BELOW, s:a_i_BEH],
486+
\[s:a_YEH_HAMZA, s:a_f_YEH_HAMZA, s:a_i_BEH],
487+
\[s:a_ALEF, s:a_f_ALEF, s:a_i_BEH],
488+
\[s:a_BEH, s:a_f_BEH, s:a_i_BEH],
489+
\[s:a_TEH_MARBUTA, s:a_f_TEH_MARBUTA, s:a_i_BEH],
490+
\[s:a_TEH, s:a_f_TEH, s:a_i_BEH],
491+
\[s:a_THEH, s:a_f_THEH, s:a_i_BEH],
492+
\[s:a_JEEM, s:a_f_JEEM, s:a_i_BEH],
493+
\[s:a_HAH, s:a_f_HAH, s:a_i_BEH],
494+
\[s:a_KHAH, s:a_f_KHAH, s:a_i_BEH],
495+
\[s:a_DAL, s:a_f_DAL, s:a_i_BEH],
496+
\[s:a_THAL, s:a_f_THAL, s:a_i_BEH],
497+
\[s:a_REH, s:a_f_REH, s:a_i_BEH],
498+
\[s:a_ZAIN, s:a_f_ZAIN, s:a_i_BEH],
499+
\[s:a_SEEN, s:a_f_SEEN, s:a_i_BEH],
500+
\[s:a_SHEEN, s:a_f_SHEEN, s:a_i_BEH],
501+
\[s:a_SAD, s:a_f_SAD, s:a_i_BEH],
502+
\[s:a_DAD, s:a_f_DAD, s:a_i_BEH],
503+
\[s:a_TAH, s:a_f_TAH, s:a_i_BEH],
504+
\[s:a_ZAH, s:a_f_ZAH, s:a_i_BEH],
505+
\[s:a_AIN, s:a_f_AIN, s:a_i_BEH],
506+
\[s:a_GHAIN, s:a_f_GHAIN, s:a_i_BEH],
507+
\[s:a_TATWEEL, s:a_TATWEEL, s:a_i_BEH],
508+
\[s:a_FEH, s:a_f_FEH, s:a_i_BEH],
509+
\[s:a_QAF, s:a_f_QAF, s:a_i_BEH],
510+
\[s:a_KAF, s:a_f_KAF, s:a_i_BEH],
511+
\[s:a_LAM, s:a_f_LAM, s:a_i_BEH],
512+
\[s:a_MEEM, s:a_f_MEEM, s:a_i_BEH],
513+
\[s:a_NOON, s:a_f_NOON, s:a_i_BEH],
514+
\[s:a_HEH, s:a_f_HEH, s:a_i_BEH],
515+
\[s:a_WAW, s:a_f_WAW, s:a_i_BEH],
516+
\[s:a_ALEF_MAKSURA, s:a_f_ALEF_MAKSURA, s:a_i_BEH],
517+
\[s:a_YEH, s:a_f_YEH, s:a_i_BEH],
518+
\ ]
519+
call setline(1, ' ' . pair[0] . s:a_BEH)
520+
call assert_equal([' ' . pair[1] . pair[2]], ScreenLines(1, 3))
521+
endfor
522+
523+
set arabicshape&
524+
bwipe!
525+
endfunc
526+
527+
func Test_shape_final_to_medial()
528+
new
529+
set arabicshape
530+
531+
" Shaping arabic {testchar} arabic Tests chg_c_f2m().
532+
" This does not test much...
533+
" pair[0] = testchar, pair[1] = current-result
534+
for pair in [[s:a_f_YEH_HAMZA, s:a_f_BEH],
535+
\[s:a_f_WAW_HAMZA, s:a_s_BEH],
536+
\[s:a_f_ALEF, s:a_s_BEH],
537+
\[s:a_f_TEH_MARBUTA, s:a_s_BEH],
538+
\[s:a_f_DAL, s:a_s_BEH],
539+
\[s:a_f_THAL, s:a_s_BEH],
540+
\[s:a_f_REH, s:a_s_BEH],
541+
\[s:a_f_ZAIN, s:a_s_BEH],
542+
\[s:a_f_WAW, s:a_s_BEH],
543+
\[s:a_f_ALEF_MAKSURA, s:a_s_BEH],
544+
\[s:a_f_BEH, s:a_f_BEH],
545+
\[s:a_f_TEH, s:a_f_BEH],
546+
\[s:a_f_THEH, s:a_f_BEH],
547+
\[s:a_f_JEEM, s:a_f_BEH],
548+
\[s:a_f_HAH, s:a_f_BEH],
549+
\[s:a_f_KHAH, s:a_f_BEH],
550+
\[s:a_f_SEEN, s:a_f_BEH],
551+
\[s:a_f_SHEEN, s:a_f_BEH],
552+
\[s:a_f_SAD, s:a_f_BEH],
553+
\[s:a_f_DAD, s:a_f_BEH],
554+
\[s:a_f_TAH, s:a_f_BEH],
555+
\[s:a_f_ZAH, s:a_f_BEH],
556+
\[s:a_f_AIN, s:a_f_BEH],
557+
\[s:a_f_GHAIN, s:a_f_BEH],
558+
\[s:a_f_FEH, s:a_f_BEH],
559+
\[s:a_f_QAF, s:a_f_BEH],
560+
\[s:a_f_KAF, s:a_f_BEH],
561+
\[s:a_f_LAM, s:a_f_BEH],
562+
\[s:a_f_MEEM, s:a_f_BEH],
563+
\[s:a_f_NOON, s:a_f_BEH],
564+
\[s:a_f_HEH, s:a_f_BEH],
565+
\[s:a_f_YEH, s:a_f_BEH],
566+
\ ]
567+
call setline(1, ' ' . s:a_BEH . pair[0])
568+
call assert_equal([' ' . pair[1] . pair[0]], ScreenLines(1, 3))
569+
endfor
570+
571+
set arabicshape&
572+
bwipe!
573+
endfunc
574+
575+
func Test_shape_combination_final()
576+
new
577+
set arabicshape
578+
579+
" Shaping arabic {testchar} arabic Tests chg_c_laa2f().
580+
" pair[0] = testchar, pair[1] = current-result
581+
for pair in [[s:a_ALEF_MADDA, s:a_f_LAM_ALEF_MADDA_ABOVE],
582+
\ [s:a_ALEF_HAMZA_ABOVE, s:a_f_LAM_ALEF_HAMZA_ABOVE],
583+
\ [s:a_ALEF_HAMZA_BELOW, s:a_f_LAM_ALEF_HAMZA_BELOW],
584+
\ [s:a_ALEF, s:a_f_LAM_ALEF],
585+
\ ]
586+
" The test char is a composing char, put on s:a_LAM.
587+
call setline(1, ' ' . s:a_LAM . pair[0] . s:a_BEH)
588+
call assert_equal([' ' . pair[1] . s:a_i_BEH], ScreenLines(1, 3))
589+
endfor
590+
591+
set arabicshape&
592+
bwipe!
593+
endfunc
594+
595+
func Test_shape_combination_isolated()
596+
new
597+
set arabicshape
598+
599+
" Shaping arabic {testchar} arabic Tests chg_c_laa2i().
600+
" pair[0] = testchar, pair[1] = current-result
601+
for pair in [[s:a_ALEF_MADDA, s:a_s_LAM_ALEF_MADDA_ABOVE],
602+
\ [s:a_ALEF_HAMZA_ABOVE, s:a_s_LAM_ALEF_HAMZA_ABOVE],
603+
\ [s:a_ALEF_HAMZA_BELOW, s:a_s_LAM_ALEF_HAMZA_BELOW],
604+
\ [s:a_ALEF, s:a_s_LAM_ALEF],
605+
\ ]
606+
" The test char is a composing char, put on s:a_LAM.
607+
call setline(1, ' ' . s:a_LAM . pair[0] . ' ')
608+
call assert_equal([' ' . pair[1] . ' '], ScreenLines(1, 3))
609+
endfor
610+
611+
set arabicshape&
612+
bwipe!
613+
endfunc

src/testdir/test_fold.vim

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ func! Test_address_fold()
99
call setline(1, ['int FuncName() {/*{{{*/', 1, 2, 3, 4, 5, '}/*}}}*/',
1010
\ 'after fold 1', 'after fold 2', 'after fold 3'])
1111
setl fen fdm=marker
12-
" The next ccommands should all copy the same part of the buffer,
13-
" regardless of the adressing type, since the part to be copied
12+
" The next commands should all copy the same part of the buffer,
13+
" regardless of the addressing type, since the part to be copied
1414
" is folded away
1515
:1y
1616
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1))
@@ -360,3 +360,56 @@ func! Test_move_folds_around_indent()
360360
call assert_equal([0, 1, 1, 1, 1, 0, 0, 0, 1, 1], map(range(1, line('$')), 'foldlevel(v:val)'))
361361
bw!
362362
endfunc
363+
364+
func Test_folddoopen_folddoclosed()
365+
new
366+
call setline(1, range(1, 9))
367+
set foldmethod=manual
368+
1,3 fold
369+
6,8 fold
370+
371+
" Test without range.
372+
folddoopen s/$/o/
373+
folddoclosed s/$/c/
374+
call assert_equal(['1c', '2c', '3c',
375+
\ '4o', '5o',
376+
\ '6c', '7c', '8c',
377+
\ '9o'], getline(1, '$'))
378+
379+
" Test with range.
380+
call setline(1, range(1, 9))
381+
1,8 folddoopen s/$/o/
382+
4,$ folddoclosed s/$/c/
383+
call assert_equal(['1', '2', '3',
384+
\ '4o', '5o',
385+
\ '6c', '7c', '8c',
386+
\ '9'], getline(1, '$'))
387+
388+
set foldmethod&
389+
bw!
390+
endfunc
391+
392+
func Test_fold_error()
393+
new
394+
call setline(1, [1, 2])
395+
396+
for fm in ['indent', 'expr', 'syntax', 'diff']
397+
exe 'set foldmethod=' . fm
398+
call assert_fails('norm zf', 'E350:')
399+
call assert_fails('norm zd', 'E351:')
400+
call assert_fails('norm zE', 'E352:')
401+
endfor
402+
403+
set foldmethod=manual
404+
call assert_fails('norm zd', 'E490:')
405+
call assert_fails('norm zo', 'E490:')
406+
call assert_fails('3fold', 'E16:')
407+
408+
set foldmethod=marker
409+
set nomodifiable
410+
call assert_fails('1,2fold', 'E21:')
411+
412+
set modifiable&
413+
set foldmethod&
414+
bw!
415+
endfunc

src/version.c

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

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
497,
784+
/**/
785+
496,
782786
/**/
783787
495,
784788
/**/

0 commit comments

Comments
 (0)