Merge pull request #4234 from watiko/vim-7.4.977

vim-patch:7.4.{818,883,977}
This commit is contained in:
Justin M. Keyes
2016-02-17 04:10:50 -05:00
5 changed files with 88 additions and 33 deletions

View File

@@ -7783,7 +7783,7 @@ static void nv_open(cmdarg_T *cap)
n_opencmd(cap); n_opencmd(cap);
} }
// calculate start/end virtual columns for operating in block mode // Calculate start/end virtual columns for operating in block mode.
static void get_op_vcol( static void get_op_vcol(
oparg_T *oap, oparg_T *oap,
colnr_T redo_VIsual_vcol, colnr_T redo_VIsual_vcol,
@@ -7793,7 +7793,8 @@ static void get_op_vcol(
colnr_T start; colnr_T start;
colnr_T end; colnr_T end;
if (VIsual_mode != Ctrl_V) { if (VIsual_mode != Ctrl_V
|| (!initial && oap->end.col < curwin->w_width)) {
return; return;
} }

View File

@@ -2432,13 +2432,18 @@ win_line (
} }
} }
/* find start of trailing whitespace */ if (wp->w_p_list) {
if (wp->w_p_list && lcs_trail) { if (lcs_space || lcs_trail) {
trailcol = (colnr_T)STRLEN(ptr); extra_check = true;
while (trailcol > (colnr_T)0 && ascii_iswhite(ptr[trailcol - 1])) }
--trailcol; // find start of trailing whitespace
trailcol += (colnr_T) (ptr - line); if (lcs_trail) {
extra_check = TRUE; trailcol = (colnr_T)STRLEN(ptr);
while (trailcol > (colnr_T)0 && ascii_iswhite(ptr[trailcol - 1])) {
trailcol--;
}
trailcol += (colnr_T) (ptr - line);
}
} }
/* /*
@@ -3210,27 +3215,7 @@ win_line (
} }
} }
++ptr; ptr++;
// 'list': change char 160 to lcs_nbsp and space to lcs_space.
if (wp->w_p_list
&& (((c == 160 || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
&& lcs_nbsp)
|| (c == ' ' && lcs_space && ptr - line <= trailcol))) {
c = (c == ' ') ? lcs_space : lcs_nbsp;
if (area_attr == 0 && search_attr == 0) {
n_attr = 1;
extra_attr = hl_attr(HLF_8);
saved_attr2 = char_attr; /* save current attr */
}
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1) {
mb_utf8 = TRUE;
u8cc[0] = 0;
c = 0xc0;
} else
mb_utf8 = FALSE;
}
if (extra_check) { if (extra_check) {
bool can_spell = true; bool can_spell = true;
@@ -3377,6 +3362,28 @@ win_line (
} }
} }
// 'list': change char 160 to lcs_nbsp and space to lcs_space.
if (wp->w_p_list
&& (((c == 160
|| (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
&& lcs_nbsp)
|| (c == ' ' && lcs_space && ptr - line <= trailcol))) {
c = (c == ' ') ? lcs_space : lcs_nbsp;
if (area_attr == 0 && search_attr == 0) {
n_attr = 1;
extra_attr = hl_attr(HLF_8);
saved_attr2 = char_attr; // save current attr
}
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1) {
mb_utf8 = true;
u8cc[0] = 0;
c = 0xc0;
} else {
mb_utf8 = false;
}
}
if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') { if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') {
c = lcs_trail; c = lcs_trail;
if (!attr_pri) { if (!attr_pri) {

View File

@@ -24,20 +24,24 @@ STARTTEST
: $put =g:line : $put =g:line
: wincmd p : wincmd p
:endfu :endfu
:"
:let g:test="Test 1: set linebreak" :let g:test="Test 1: set linebreak"
:redraw! :redraw!
:let line=ScreenChar(winwidth(0)) :let line=ScreenChar(winwidth(0))
:call DoRecordScreen() :call DoRecordScreen()
:"
:let g:test="Test 2: set linebreak + set list" :let g:test="Test 2: set linebreak + set list"
:set linebreak list listchars= :set linebreak list listchars=
:redraw! :redraw!
:let line=ScreenChar(winwidth(0)) :let line=ScreenChar(winwidth(0))
:call DoRecordScreen() :call DoRecordScreen()
:"
:let g:test ="Test 3: set linebreak nolist" :let g:test ="Test 3: set linebreak nolist"
:set nolist linebreak :set nolist linebreak
:redraw! :redraw!
:let line=ScreenChar(winwidth(0)) :let line=ScreenChar(winwidth(0))
:call DoRecordScreen() :call DoRecordScreen()
:"
:let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!" :let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!"
:set nolist linebreak ts=8 :set nolist linebreak ts=8
:let line="1\t".repeat('a', winwidth(0)-2) :let line="1\t".repeat('a', winwidth(0)-2)
@@ -51,6 +55,7 @@ STARTTEST
:$put =line :$put =line
:$ :$
:norm! zt :norm! zt
:"
:let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)" :let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)"
:set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab :set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab
:syn match ConcealVar contained /_/ conceal :syn match ConcealVar contained /_/ conceal
@@ -58,6 +63,7 @@ STARTTEST
:let line=ScreenChar(winwidth(0)) :let line=ScreenChar(winwidth(0))
:call DoRecordScreen() :call DoRecordScreen()
:set cpo&vim linebreak :set cpo&vim linebreak
:"
:let g:test ="Test 6: set linebreak with visual block mode" :let g:test ="Test 6: set linebreak with visual block mode"
:let line="REMOVE: this not" :let line="REMOVE: this not"
:$put =g:test :$put =g:test
@@ -67,20 +73,47 @@ STARTTEST
:1/^REMOVE: :1/^REMOVE:
0jf x:$put 0jf x:$put
:set cpo&vim linebreak :set cpo&vim linebreak
:"
:let g:test ="Test 7: set linebreak with visual block mode and v_b_A" :let g:test ="Test 7: set linebreak with visual block mode and v_b_A"
:$put =g:test :$put =g:test
Golong line: 40afoobar aTARGET at end Golong line: 40afoobar aTARGET at end
:exe "norm! $3B\<C-v>eAx\<Esc>" :exe "norm! $3B\<C-v>eAx\<Esc>"
:set cpo&vim linebreak sbr= :set cpo&vim linebreak sbr=
:"
:let g:test ="Test 8: set linebreak with visual char mode and changing block" :let g:test ="Test 8: set linebreak with visual char mode and changing block"
:$put =g:test :$put =g:test
Go1111-1111-1111-11-1111-1111-11110f-lv3lc2222bgj. Go1111-1111-1111-11-1111-1111-11110f-lv3lc2222bgj.
:"
:let g:test ="Test 9: using redo after block visual mode" :let g:test ="Test 9: using redo after block visual mode"
:$put =g:test :$put =g:test
Go Go
aaa aaa
aaa aaa
a2k2j~e. a2k2j~e.
:"
:let g:test ="Test 10: using normal commands after block-visual"
:$put =g:test
:set linebreak
Go
abcd{ef
ghijklm
no}pqrs2k0f{c%
:"
:let g:test ="Test 11: using block replace mode after wrapping"
:$put =g:test
:set linebreak wrap
Go150aayypk147|jr0
:"
:let g:test ="Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$"
:set list listchars=space:_,trail:-,tab:>-,eol:$
:$put =g:test
:let line="a aaaaaaaaaaaaaaaaaaaaaa\ta "
:$put =line
:$
:norm! zt
:redraw!
:let line=ScreenChar(winwidth(0))
:call DoRecordScreen()
:%w! test.out :%w! test.out
:qa! :qa!
ENDTEST ENDTEST

View File

@@ -46,3 +46,17 @@ Test 9: using redo after block visual mode
AaA AaA
AaA AaA
A A
Test 10: using normal commands after block-visual
abcdpqrs
Test 11: using block replace mode after wrapping
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0aaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0aaa
Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$
a aaaaaaaaaaaaaaaaaaaaaa a
Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$
a_
aaaaaaaaaaaaaaaaaaaa
aa>-----a-$
~

View File

@@ -311,7 +311,7 @@ static int included_patches[] = {
980, 980,
// 979 NA // 979 NA
978, 978,
// 977, 977,
// 976 NA // 976 NA
975, 975,
// 974, // 974,
@@ -405,7 +405,7 @@ static int included_patches[] = {
// 886 NA // 886 NA
// 885, // 885,
// 884 NA // 884 NA
// 883, 883,
// 882, // 882,
// 881, // 881,
// 880 NA // 880 NA
@@ -470,7 +470,7 @@ static int included_patches[] = {
// 821 NA // 821 NA
820, 820,
// 819, // 819,
// 818, 818,
817, 817,
816, 816,
815, 815,