mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.1948
Problem: Using Ctrl-A with double-byte encoding may result in garbled text.
Solution: Skip to the start of a character. (Hirohito Higashi)
ad5ca9bc1e
This commit is contained in:
parent
7ed1422521
commit
91efe96b96
@ -4455,12 +4455,14 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
|||||||
if (dobin) {
|
if (dobin) {
|
||||||
while (col > 0 && ascii_isbdigit(ptr[col])) {
|
while (col > 0 && ascii_isbdigit(ptr[col])) {
|
||||||
col--;
|
col--;
|
||||||
|
col -= utf_head_off(ptr, ptr + col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dohex) {
|
if (dohex) {
|
||||||
while (col > 0 && ascii_isxdigit(ptr[col])) {
|
while (col > 0 && ascii_isxdigit(ptr[col])) {
|
||||||
col--;
|
col--;
|
||||||
|
col -= utf_head_off(ptr, ptr + col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dobin
|
if (dobin
|
||||||
@ -4468,6 +4470,7 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
|||||||
&& !((col > 0
|
&& !((col > 0
|
||||||
&& (ptr[col] == 'X' || ptr[col] == 'x')
|
&& (ptr[col] == 'X' || ptr[col] == 'x')
|
||||||
&& ptr[col - 1] == '0'
|
&& ptr[col - 1] == '0'
|
||||||
|
&& !utf_head_off(ptr, ptr + col - 1)
|
||||||
&& ascii_isxdigit(ptr[col + 1])))) {
|
&& ascii_isxdigit(ptr[col + 1])))) {
|
||||||
// In case of binary/hexadecimal pattern overlap match, rescan
|
// In case of binary/hexadecimal pattern overlap match, rescan
|
||||||
|
|
||||||
@ -4475,6 +4478,7 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
|||||||
|
|
||||||
while (col > 0 && ascii_isdigit(ptr[col])) {
|
while (col > 0 && ascii_isdigit(ptr[col])) {
|
||||||
col--;
|
col--;
|
||||||
|
col -= utf_head_off(ptr, ptr + col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4482,14 +4486,17 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
|||||||
&& col > 0
|
&& col > 0
|
||||||
&& (ptr[col] == 'X' || ptr[col] == 'x')
|
&& (ptr[col] == 'X' || ptr[col] == 'x')
|
||||||
&& ptr[col - 1] == '0'
|
&& ptr[col - 1] == '0'
|
||||||
|
&& !utf_head_off(ptr, ptr + col - 1)
|
||||||
&& ascii_isxdigit(ptr[col + 1]))
|
&& ascii_isxdigit(ptr[col + 1]))
|
||||||
|| (dobin
|
|| (dobin
|
||||||
&& col > 0
|
&& col > 0
|
||||||
&& (ptr[col] == 'B' || ptr[col] == 'b')
|
&& (ptr[col] == 'B' || ptr[col] == 'b')
|
||||||
&& ptr[col - 1] == '0'
|
&& ptr[col - 1] == '0'
|
||||||
|
&& !utf_head_off(ptr, ptr + col - 1)
|
||||||
&& ascii_isbdigit(ptr[col + 1]))) {
|
&& ascii_isbdigit(ptr[col + 1]))) {
|
||||||
// Found hexadecimal or binary number, move to its start.
|
// Found hexadecimal or binary number, move to its start.
|
||||||
col--;
|
col--;
|
||||||
|
col -= utf_head_off(ptr, ptr + col);
|
||||||
} else {
|
} else {
|
||||||
// Search forward and then backward to find the start of number.
|
// Search forward and then backward to find the start of number.
|
||||||
col = pos->col;
|
col = pos->col;
|
||||||
@ -4511,15 +4518,18 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
|||||||
if (visual) {
|
if (visual) {
|
||||||
while (ptr[col] != NUL && length > 0 && !ascii_isdigit(ptr[col])
|
while (ptr[col] != NUL && length > 0 && !ascii_isdigit(ptr[col])
|
||||||
&& !(doalp && ASCII_ISALPHA(ptr[col]))) {
|
&& !(doalp && ASCII_ISALPHA(ptr[col]))) {
|
||||||
col++;
|
int mb_len = MB_PTR2LEN(ptr + col);
|
||||||
length--;
|
|
||||||
|
col += mb_len;
|
||||||
|
length -= mb_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (col > pos->col && ptr[col - 1] == '-') {
|
if (col > pos->col && ptr[col - 1] == '-'
|
||||||
|
&& !utf_head_off(ptr, ptr + col - 1)) {
|
||||||
negative = true;
|
negative = true;
|
||||||
was_positive = false;
|
was_positive = false;
|
||||||
}
|
}
|
||||||
@ -4565,7 +4575,8 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
|||||||
endpos = curwin->w_cursor;
|
endpos = curwin->w_cursor;
|
||||||
curwin->w_cursor.col = col;
|
curwin->w_cursor.col = col;
|
||||||
} else {
|
} else {
|
||||||
if (col > 0 && ptr[col - 1] == '-' && !visual) {
|
if (col > 0 && ptr[col - 1] == '-'
|
||||||
|
&& !utf_head_off(ptr, ptr + col - 1) && !visual) {
|
||||||
// negative number
|
// negative number
|
||||||
col--;
|
col--;
|
||||||
negative = true;
|
negative = true;
|
||||||
|
@ -492,7 +492,7 @@ static int included_patches[] = {
|
|||||||
// 1951 NA
|
// 1951 NA
|
||||||
1950,
|
1950,
|
||||||
1949,
|
1949,
|
||||||
// 1948,
|
1948,
|
||||||
// 1947 NA
|
// 1947 NA
|
||||||
// 1946 NA
|
// 1946 NA
|
||||||
// 1945 NA
|
// 1945 NA
|
||||||
|
Loading…
Reference in New Issue
Block a user