mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 05:28:33 +00:00
vim-patch:9.1.0423: getregionpos() wrong with blockwise mode and multibyte
Problem: getregionpos() wrong with blockwise mode and multibyte.
Solution: Use textcol and textlen instead of start_vcol and end_vcol.
Handle coladd properly (zeertzjq).
Also remove unnecessary buflist_findnr() in add_regionpos_range(), as
getregionpos() has already switched buffer.
closes: vim/vim#14805
c95e64f41f
This commit is contained in:
@@ -4258,6 +4258,7 @@ void charwise_block_prep(pos_T start, pos_T end, struct block_def *bdp, linenr_T
|
||||
char *p = ml_get(lnum);
|
||||
bdp->startspaces = 0;
|
||||
bdp->endspaces = 0;
|
||||
bdp->start_char_vcols = 0;
|
||||
|
||||
if (lnum == start.lnum) {
|
||||
startcol = start.col;
|
||||
@@ -4265,7 +4266,8 @@ void charwise_block_prep(pos_T start, pos_T end, struct block_def *bdp, linenr_T
|
||||
getvcol(curwin, &start, &cs, NULL, &ce);
|
||||
if (ce != cs && start.coladd > 0) {
|
||||
// Part of a tab selected -- but don't double-count it.
|
||||
bdp->startspaces = (ce - cs + 1) - start.coladd;
|
||||
bdp->start_char_vcols = ce - cs + 1;
|
||||
bdp->startspaces = bdp->start_char_vcols - start.coladd;
|
||||
if (bdp->startspaces < 0) {
|
||||
bdp->startspaces = 0;
|
||||
}
|
||||
@@ -4303,6 +4305,7 @@ void charwise_block_prep(pos_T start, pos_T end, struct block_def *bdp, linenr_T
|
||||
} else {
|
||||
bdp->textlen = endcol - startcol + inclusive;
|
||||
}
|
||||
bdp->textcol = startcol;
|
||||
bdp->textstart = p + startcol;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user