1
0
forked from aniani/vim

patch 8.1.0722: cannot build without the virtualedit feature

Problem:    Cannot build without the virtualedit feature.
Solution:   Make getviscol2() always available.
This commit is contained in:
Bram Moolenaar
2019-01-11 16:16:01 +01:00
parent 429ab1761e
commit 977239ef52
4 changed files with 33 additions and 19 deletions

View File

@@ -47,22 +47,6 @@ getviscol(void)
return (int)x; return (int)x;
} }
/*
* Get the screen position of character col with a coladd in the cursor line.
*/
int
getviscol2(colnr_T col, colnr_T coladd)
{
colnr_T x;
pos_T pos;
pos.lnum = curwin->w_cursor.lnum;
pos.col = col;
pos.coladd = coladd;
getvvcol(curwin, &pos, &x, NULL, NULL);
return (int)x;
}
/* /*
* Go to column "wcol", and add/insert white space as necessary to get the * Go to column "wcol", and add/insert white space as necessary to get the
* cursor in that column. * cursor in that column.
@@ -85,6 +69,24 @@ coladvance_force(colnr_T wcol)
} }
#endif #endif
/*
* Get the screen position of character col with a coladd in the cursor line.
*/
int
getviscol2(colnr_T col, colnr_T coladd)
{
colnr_T x;
pos_T pos;
pos.lnum = curwin->w_cursor.lnum;
pos.col = col;
#ifdef FEAT_VIRTUALEDIT
pos.coladd = coladd;
#endif
getvvcol(curwin, &pos, &x, NULL, NULL);
return (int)x;
}
/* /*
* Try to advance the Cursor to the specified screen column. * Try to advance the Cursor to the specified screen column.
* If virtual editing: fine tune the cursor position. * If virtual editing: fine tune the cursor position.

View File

@@ -2754,7 +2754,12 @@ op_insert(oparg_T *oap, long count1)
) )
{ {
int t = getviscol2(curbuf->b_op_start_orig.col, int t = getviscol2(curbuf->b_op_start_orig.col,
curbuf->b_op_start_orig.coladd); #ifdef FEAT_VIRTUALEDIT
curbuf->b_op_start_orig.coladd
#else
0
#endif
);
oap->start.col = curbuf->b_op_start_orig.col; oap->start.col = curbuf->b_op_start_orig.col;
pre_textlen -= t - oap->start_vcol; pre_textlen -= t - oap->start_vcol;
oap->start_vcol = t; oap->start_vcol = t;
@@ -2771,7 +2776,12 @@ op_insert(oparg_T *oap, long count1)
) )
{ {
int t = getviscol2(curbuf->b_op_start_orig.col, int t = getviscol2(curbuf->b_op_start_orig.col,
curbuf->b_op_start_orig.coladd); #ifdef FEAT_VIRTUALEDIT
curbuf->b_op_start_orig.coladd
#else
0
#endif
);
oap->start.col = curbuf->b_op_start_orig.col; oap->start.col = curbuf->b_op_start_orig.col;
/* reset pre_textlen to the value of OP_INSERT */ /* reset pre_textlen to the value of OP_INSERT */
pre_textlen += bd.textlen; pre_textlen += bd.textlen;

View File

@@ -1,8 +1,8 @@
/* misc2.c */ /* misc2.c */
int virtual_active(void); int virtual_active(void);
int getviscol(void); int getviscol(void);
int getviscol2(colnr_T col, colnr_T coladd);
int coladvance_force(colnr_T wcol); int coladvance_force(colnr_T wcol);
int getviscol2(colnr_T col, colnr_T coladd);
int coladvance(colnr_T wcol); int coladvance(colnr_T wcol);
int getvpos(pos_T *pos, colnr_T wcol); int getvpos(pos_T *pos, colnr_T wcol);
int inc_cursor(void); int inc_cursor(void);

View File

@@ -795,6 +795,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 */
/**/
722,
/**/ /**/
721, 721,
/**/ /**/