mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:8.2.2935: calculating register width is not always needed
Problem: Calculating register width is not always needed. (Christian
Brabandt)
Solution: Only calculate the width when the type is MBLOCK.
6c4c404c58
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -5236,10 +5236,11 @@ static void str_to_reg(yankreg_T *y_ptr, MotionType yank_type, const char *str,
|
|||||||
// Find the end of each line and save it into the array.
|
// Find the end of each line and save it into the array.
|
||||||
if (str_list) {
|
if (str_list) {
|
||||||
for (char **ss = (char **)str; *ss != NULL; ss++, lnum++) {
|
for (char **ss = (char **)str; *ss != NULL; ss++, lnum++) {
|
||||||
int charlen = mb_charlen(*ss);
|
pp[lnum] = cstr_to_string(*ss);
|
||||||
size_t ss_len = strlen(*ss);
|
if (yank_type == kMTBlockWise) {
|
||||||
pp[lnum] = cbuf_to_string(*ss, ss_len);
|
size_t charlen = mb_string2cells(*ss);
|
||||||
maxlen = MAX(maxlen, (size_t)charlen);
|
maxlen = MAX(maxlen, charlen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
size_t line_len;
|
size_t line_len;
|
||||||
@@ -5252,8 +5253,10 @@ static void str_to_reg(yankreg_T *y_ptr, MotionType yank_type, const char *str,
|
|||||||
if (*line_end == '\n') {
|
if (*line_end == '\n') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (yank_type == kMTBlockWise) {
|
||||||
charlen += utf_ptr2cells_len(line_end, (int)(end - line_end));
|
charlen += utf_ptr2cells_len(line_end, (int)(end - line_end));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
assert(line_end - start >= 0);
|
assert(line_end - start >= 0);
|
||||||
line_len = (size_t)(line_end - start);
|
line_len = (size_t)(line_end - start);
|
||||||
maxlen = MAX(maxlen, (size_t)charlen);
|
maxlen = MAX(maxlen, (size_t)charlen);
|
||||||
|
Reference in New Issue
Block a user