mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
updated for version 7.3.748
Problem: Cannot properly test conceal mode. Solution: Add the screencol() and screenrow() functions. Use them in test88. (Simon Ruderich)
This commit is contained in:
@@ -1903,6 +1903,8 @@ repeat( {expr}, {count}) String repeat {expr} {count} times
|
|||||||
resolve( {filename}) String get filename a shortcut points to
|
resolve( {filename}) String get filename a shortcut points to
|
||||||
reverse( {list}) List reverse {list} in-place
|
reverse( {list}) List reverse {list} in-place
|
||||||
round( {expr}) Float round off {expr}
|
round( {expr}) Float round off {expr}
|
||||||
|
screencol() Number current cursor column
|
||||||
|
screenrow() Number current cursor row
|
||||||
search( {pattern} [, {flags} [, {stopline} [, {timeout}]]])
|
search( {pattern} [, {flags} [, {stopline} [, {timeout}]]])
|
||||||
Number search for {pattern}
|
Number search for {pattern}
|
||||||
searchdecl( {name} [, {global} [, {thisblock}]])
|
searchdecl( {name} [, {global} [, {thisblock}]])
|
||||||
|
28
src/eval.c
28
src/eval.c
@@ -668,6 +668,8 @@ static void f_reverse __ARGS((typval_T *argvars, typval_T *rettv));
|
|||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
static void f_round __ARGS((typval_T *argvars, typval_T *rettv));
|
static void f_round __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
#endif
|
#endif
|
||||||
|
static void f_screencol __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
|
static void f_screenrow __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
static void f_search __ARGS((typval_T *argvars, typval_T *rettv));
|
static void f_search __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
static void f_searchdecl __ARGS((typval_T *argvars, typval_T *rettv));
|
static void f_searchdecl __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
static void f_searchpair __ARGS((typval_T *argvars, typval_T *rettv));
|
static void f_searchpair __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
@@ -8033,6 +8035,8 @@ static struct fst
|
|||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
{"round", 1, 1, f_round},
|
{"round", 1, 1, f_round},
|
||||||
#endif
|
#endif
|
||||||
|
{"screencol", 0, 0, f_screencol},
|
||||||
|
{"screenrow", 0, 0, f_screenrow},
|
||||||
{"search", 1, 4, f_search},
|
{"search", 1, 4, f_search},
|
||||||
{"searchdecl", 1, 3, f_searchdecl},
|
{"searchdecl", 1, 3, f_searchdecl},
|
||||||
{"searchpair", 3, 7, f_searchpair},
|
{"searchpair", 3, 7, f_searchpair},
|
||||||
@@ -15724,6 +15728,30 @@ f_round(argvars, rettv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "screencol()" function
|
||||||
|
*
|
||||||
|
* First column is 1 to be consistent with virtcol().
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
f_screencol(argvars, rettv)
|
||||||
|
typval_T *argvars UNUSED;
|
||||||
|
typval_T *rettv;
|
||||||
|
{
|
||||||
|
rettv->vval.v_number = screen_screencol() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "screenrow()" function
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
f_screenrow(argvars, rettv)
|
||||||
|
typval_T *argvars UNUSED;
|
||||||
|
typval_T *rettv;
|
||||||
|
{
|
||||||
|
rettv->vval.v_number = screen_screenrow() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "search()" function
|
* "search()" function
|
||||||
*/
|
*/
|
||||||
|
@@ -50,4 +50,6 @@ int redrawing __ARGS((void));
|
|||||||
int messaging __ARGS((void));
|
int messaging __ARGS((void));
|
||||||
void showruler __ARGS((int always));
|
void showruler __ARGS((int always));
|
||||||
int number_width __ARGS((win_T *wp));
|
int number_width __ARGS((win_T *wp));
|
||||||
|
int screen_screencol __ARGS((void));
|
||||||
|
int screen_screenrow __ARGS((void));
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
20
src/screen.c
20
src/screen.c
@@ -10264,3 +10264,23 @@ number_width(wp)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the current cursor column. This is the actual position on the
|
||||||
|
* screen. First column is 0.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
screen_screencol()
|
||||||
|
{
|
||||||
|
return screen_cur_col;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the current cursor row. This is the actual position on the screen.
|
||||||
|
* First row is 0.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
screen_screenrow()
|
||||||
|
{
|
||||||
|
return screen_cur_row;
|
||||||
|
}
|
||||||
|
@@ -31,7 +31,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
|||||||
test66.out test67.out test68.out test69.out test70.out \
|
test66.out test67.out test68.out test69.out test70.out \
|
||||||
test71.out test72.out test73.out test74.out test75.out \
|
test71.out test72.out test73.out test74.out test75.out \
|
||||||
test76.out test77.out test78.out test79.out test80.out \
|
test76.out test77.out test78.out test79.out test80.out \
|
||||||
test81.out test82.out test83.out test84.out
|
test81.out test82.out test83.out test84.out test88.out
|
||||||
|
|
||||||
.SUFFIXES: .in .out
|
.SUFFIXES: .in .out
|
||||||
|
|
||||||
@@ -135,3 +135,4 @@ test81.out: test81.in
|
|||||||
test82.out: test82.in
|
test82.out: test82.in
|
||||||
test83.out: test83.in
|
test83.out: test83.in
|
||||||
test84.out: test84.in
|
test84.out: test84.in
|
||||||
|
test88.out: test88.in
|
||||||
|
@@ -30,7 +30,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
|||||||
test68.out test69.out test71.out test72.out test73.out \
|
test68.out test69.out test71.out test72.out test73.out \
|
||||||
test74.out test75.out test76.out test77.out test78.out \
|
test74.out test75.out test76.out test77.out test78.out \
|
||||||
test79.out test80.out test81.out test82.out test83.out \
|
test79.out test80.out test81.out test82.out test83.out \
|
||||||
test84.out test85.out test86.out test87.out
|
test84.out test85.out test86.out test87.out test88.out
|
||||||
|
|
||||||
SCRIPTS32 = test50.out test70.out
|
SCRIPTS32 = test50.out test70.out
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
|||||||
test68.out test69.out test71.out test72.out test73.out \
|
test68.out test69.out test71.out test72.out test73.out \
|
||||||
test74.out test75.out test76.out test77.out test78.out \
|
test74.out test75.out test76.out test77.out test78.out \
|
||||||
test79.out test80.out test81.out test82.out test83.out \
|
test79.out test80.out test81.out test82.out test83.out \
|
||||||
test84.out test85.out test86.out test87.out
|
test84.out test85.out test86.out test87.out test88.out
|
||||||
|
|
||||||
SCRIPTS32 = test50.out test70.out
|
SCRIPTS32 = test50.out test70.out
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
|||||||
test66.out test67.out test68.out test69.out test70.out \
|
test66.out test67.out test68.out test69.out test70.out \
|
||||||
test71.out test72.out test73.out test74.out test75.out \
|
test71.out test72.out test73.out test74.out test75.out \
|
||||||
test76.out test77.out test78.out test79.out test80.out \
|
test76.out test77.out test78.out test79.out test80.out \
|
||||||
test81.out test82.out test83.out test84.out
|
test81.out test82.out test83.out test84.out test88.out
|
||||||
|
|
||||||
.SUFFIXES: .in .out
|
.SUFFIXES: .in .out
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
||||||
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
||||||
#
|
#
|
||||||
# Last change: 2012 Oct 06
|
# Last change: 2012 Dec 05
|
||||||
#
|
#
|
||||||
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
||||||
# Edit the lines in the Configuration section below to select.
|
# Edit the lines in the Configuration section below to select.
|
||||||
@@ -76,7 +76,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
|
|||||||
test66.out test67.out test68.out test69.out \
|
test66.out test67.out test68.out test69.out \
|
||||||
test71.out test72.out test74.out test75.out test76.out \
|
test71.out test72.out test74.out test75.out test76.out \
|
||||||
test77.out test78.out test79.out test80.out test81.out \
|
test77.out test78.out test79.out test80.out test81.out \
|
||||||
test82.out test83.out test84.out
|
test82.out test83.out test84.out test88.out
|
||||||
|
|
||||||
# Known problems:
|
# Known problems:
|
||||||
# Test 30: a problem around mac format - unknown reason
|
# Test 30: a problem around mac format - unknown reason
|
||||||
|
@@ -13,7 +13,7 @@ VIMPROG = ../vim
|
|||||||
|
|
||||||
SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
||||||
test7.out test8.out test9.out test10.out test11.out \
|
test7.out test8.out test9.out test10.out test11.out \
|
||||||
test12.out test13.out test14.out test15.out test17.out \
|
test12.out test13.out test14.out test15.out test17.out \
|
||||||
test18.out test19.out test20.out test21.out test22.out \
|
test18.out test19.out test20.out test21.out test22.out \
|
||||||
test23.out test24.out test25.out test26.out test27.out \
|
test23.out test24.out test25.out test26.out test27.out \
|
||||||
test28.out test29.out test30.out test31.out test32.out \
|
test28.out test29.out test30.out test31.out test32.out \
|
||||||
@@ -27,7 +27,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
|||||||
test69.out test70.out test71.out test72.out test73.out \
|
test69.out test70.out test71.out test72.out test73.out \
|
||||||
test74.out test75.out test76.out test77.out test78.out \
|
test74.out test75.out test76.out test77.out test78.out \
|
||||||
test79.out test80.out test81.out test82.out test83.out \
|
test79.out test80.out test81.out test82.out test83.out \
|
||||||
test84.out test85.out test86.out test87.out
|
test84.out test85.out test86.out test87.out test88.out
|
||||||
|
|
||||||
SCRIPTS_GUI = test16.out
|
SCRIPTS_GUI = test16.out
|
||||||
|
|
||||||
|
85
src/testdir/test88.in
Normal file
85
src/testdir/test88.in
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
vim: set ft=vim
|
||||||
|
|
||||||
|
Tests for correct display (cursor column position) with +conceal and
|
||||||
|
tabulators.
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:so small.vim
|
||||||
|
:if !has('conceal')
|
||||||
|
e! test.ok
|
||||||
|
wq! test.out
|
||||||
|
:endif
|
||||||
|
:" Conceal settings.
|
||||||
|
:set conceallevel=2
|
||||||
|
:set concealcursor=nc
|
||||||
|
:syntax match test /|/ conceal
|
||||||
|
:" Save current cursor position. Only works in <expr> mode, can't be used
|
||||||
|
:" with :normal because it moves the cursor to the command line. Thanks to ZyX
|
||||||
|
:" <zyx.vim@gmail.com> for the idea to use an <expr> mapping.
|
||||||
|
:let positions = []
|
||||||
|
:nnoremap <expr> GG ":let positions += ['".screenrow().":".screencol()."']\n"
|
||||||
|
:" Start test.
|
||||||
|
/^start:
|
||||||
|
:normal ztj
|
||||||
|
GGk
|
||||||
|
:" We should end up in the same column when running these commands on the two
|
||||||
|
:" lines.
|
||||||
|
:normal ft
|
||||||
|
GGk
|
||||||
|
:normal $
|
||||||
|
GGk
|
||||||
|
:normal 0j
|
||||||
|
GGk
|
||||||
|
:normal ft
|
||||||
|
GGk
|
||||||
|
:normal $
|
||||||
|
GGk
|
||||||
|
:normal 0j0j
|
||||||
|
GGk
|
||||||
|
:" Same for next test block.
|
||||||
|
:normal ft
|
||||||
|
GGk
|
||||||
|
:normal $
|
||||||
|
GGk
|
||||||
|
:normal 0j
|
||||||
|
GGk
|
||||||
|
:normal ft
|
||||||
|
GGk
|
||||||
|
:normal $
|
||||||
|
GGk
|
||||||
|
:normal 0j0j
|
||||||
|
GGk
|
||||||
|
:" And check W with multiple tabs and conceals in a line.
|
||||||
|
:normal W
|
||||||
|
GGk
|
||||||
|
:normal W
|
||||||
|
GGk
|
||||||
|
:normal W
|
||||||
|
GGk
|
||||||
|
:normal $
|
||||||
|
GGk
|
||||||
|
:normal 0j
|
||||||
|
GGk
|
||||||
|
:normal W
|
||||||
|
GGk
|
||||||
|
:normal W
|
||||||
|
GGk
|
||||||
|
:normal W
|
||||||
|
GGk
|
||||||
|
:normal $
|
||||||
|
GGk
|
||||||
|
:" Display result.
|
||||||
|
:call append('$', 'end:')
|
||||||
|
:call append('$', positions)
|
||||||
|
:/^end/,$wq! test.out
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
start:
|
||||||
|
.concealed. text
|
||||||
|
|concealed| text
|
||||||
|
|
||||||
|
.concealed. text
|
||||||
|
|concealed| text
|
||||||
|
|
||||||
|
.a. .b. .c. .d.
|
||||||
|
|a| |b| |c| |d|
|
23
src/testdir/test88.ok
Normal file
23
src/testdir/test88.ok
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
end:
|
||||||
|
2:1
|
||||||
|
2:17
|
||||||
|
2:20
|
||||||
|
3:1
|
||||||
|
3:17
|
||||||
|
3:20
|
||||||
|
5:8
|
||||||
|
5:25
|
||||||
|
5:28
|
||||||
|
6:8
|
||||||
|
6:25
|
||||||
|
6:28
|
||||||
|
8:1
|
||||||
|
8:9
|
||||||
|
8:17
|
||||||
|
8:25
|
||||||
|
8:27
|
||||||
|
9:1
|
||||||
|
9:9
|
||||||
|
9:17
|
||||||
|
9:25
|
||||||
|
9:26
|
@@ -725,6 +725,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
748,
|
||||||
/**/
|
/**/
|
||||||
747,
|
747,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user