mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
vim-patch:9.1.0446: getregionpos() inconsistent for partly-selected multibyte char (#29032)
Problem: getregionpos() behaves inconsistently for a partly-selected
multibyte char.
Solution: Always use column of the first byte for a partly-selected
multibyte char (zeertzjq).
closes: vim/vim#14851
ef73374dc3
This commit is contained in:
@@ -3042,6 +3042,7 @@ static void f_getregionpos(typval_T *argvars, typval_T *rettv, EvalFuncData fptr
|
||||
|
||||
for (linenr_T lnum = p1.lnum; lnum <= p2.lnum; lnum++) {
|
||||
pos_T ret_p1, ret_p2;
|
||||
char *line = ml_get(lnum);
|
||||
colnr_T line_len = ml_get_len(lnum);
|
||||
|
||||
if (region_type == kMTLineWise) {
|
||||
@@ -3060,7 +3061,7 @@ static void f_getregionpos(typval_T *argvars, typval_T *rettv, EvalFuncData fptr
|
||||
|
||||
if (bd.is_oneChar) { // selection entirely inside one char
|
||||
if (region_type == kMTBlockWise) {
|
||||
ret_p1.col = bd.textcol;
|
||||
ret_p1.col = (colnr_T)(mb_prevptr(line, bd.textstart) - line) + 1;
|
||||
ret_p1.coladd = bd.start_char_vcols - (bd.start_vcol - oa.start_vcol);
|
||||
} else {
|
||||
ret_p1.col = p1.col + 1;
|
||||
@@ -3072,7 +3073,7 @@ static void f_getregionpos(typval_T *argvars, typval_T *rettv, EvalFuncData fptr
|
||||
ret_p1.coladd = oa.start_vcol - bd.start_vcol;
|
||||
bd.is_oneChar = true;
|
||||
} else if (bd.startspaces > 0) {
|
||||
ret_p1.col = bd.textcol;
|
||||
ret_p1.col = (colnr_T)(mb_prevptr(line, bd.textstart) - line) + 1;
|
||||
ret_p1.coladd = bd.start_char_vcols - bd.startspaces;
|
||||
} else {
|
||||
ret_p1.col = bd.textcol + 1;
|
||||
|
Reference in New Issue
Block a user