comparison src/edit.c @ 28363:a9a56b567709 v8.2.4707

patch 8.2.4707: redrawing could be a bit more efficient Commit: https://github.com/vim/vim/commit/8c9796085071950f9a03ca0fe116608e4f86aac2 Author: zeertzjq <zeertzjq@outlook.com> Date: Thu Apr 7 15:08:01 2022 +0100 patch 8.2.4707: redrawing could be a bit more efficient Problem: Redrawing could be a bit more efficient. Solution: Optimize redrawing. (closes https://github.com/vim/vim/issues/10105)
author Bram Moolenaar <Bram@vim.org>
date Thu, 07 Apr 2022 16:15:03 +0200
parents 20b28fbf7f03
children 38332c6da029
comparison
equal deleted inserted replaced
28362:867b73034605 28363:a9a56b567709
291 // Check if the cursor line needs redrawing after changing State. If 291 // Check if the cursor line needs redrawing after changing State. If
292 // 'concealcursor' is "n" it needs to be redrawn without concealing. 292 // 'concealcursor' is "n" it needs to be redrawn without concealing.
293 conceal_check_cursor_line(cursor_line_was_concealed); 293 conceal_check_cursor_line(cursor_line_was_concealed);
294 #endif 294 #endif
295 295
296 // Need to recompute the cursor position, it might move when the cursor 296 // need to position cursor again when on a TAB
297 // is on a TAB or special character. 297 if (gchar_cursor() == TAB)
298 // ptr2cells() treats a TAB character as double-width. 298 curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL);
299 if (ptr2cells(ml_get_cursor()) > 1)
300 {
301 curwin->w_valid &= ~VALID_VIRTCOL;
302 curs_columns(TRUE);
303 }
304 299
305 /* 300 /*
306 * Enable langmap or IME, indicated by 'iminsert'. 301 * Enable langmap or IME, indicated by 'iminsert'.
307 * Note that IME may enabled/disabled without us noticing here, thus the 302 * Note that IME may enabled/disabled without us noticing here, thus the
308 * 'iminsert' value may not reflect what is actually used. It is updated 303 * 'iminsert' value may not reflect what is actually used. It is updated
3147 { 3142 {
3148 // Not a multi-byte char, put it back. 3143 // Not a multi-byte char, put it back.
3149 replace_push(c); 3144 replace_push(c);
3150 break; 3145 break;
3151 } 3146 }
3147
3148 buf[0] = c;
3149 for (i = 1; i < n; ++i)
3150 buf[i] = replace_pop();
3151 if (utf_iscomposing(utf_ptr2char(buf)))
3152 ins_bytes_len(buf, n);
3152 else 3153 else
3153 { 3154 {
3154 buf[0] = c; 3155 // Not a composing char, put it back.
3155 for (i = 1; i < n; ++i) 3156 for (i = n - 1; i >= 0; --i)
3156 buf[i] = replace_pop(); 3157 replace_push(buf[i]);
3157 if (utf_iscomposing(utf_ptr2char(buf))) 3158 break;
3158 ins_bytes_len(buf, n);
3159 else
3160 {
3161 // Not a composing char, put it back.
3162 for (i = n - 1; i >= 0; --i)
3163 replace_push(buf[i]);
3164 break;
3165 }
3166 } 3159 }
3160
3167 } 3161 }
3168 } 3162 }
3169 3163
3170 /* 3164 /*
3171 * make the replace stack empty 3165 * make the replace stack empty
3700 im_set_active(FALSE); 3694 im_set_active(FALSE);
3701 #endif 3695 #endif
3702 3696
3703 State = NORMAL; 3697 State = NORMAL;
3704 trigger_modechanged(); 3698 trigger_modechanged();
3705 // need to position cursor again (e.g. when on a TAB ) 3699 // need to position cursor again when on a TAB
3706 changed_cline_bef_curs(); 3700 if (gchar_cursor() == TAB)
3701 curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL);
3707 3702
3708 setmouse(); 3703 setmouse();
3709 #ifdef CURSOR_SHAPE 3704 #ifdef CURSOR_SHAPE
3710 ui_cursor_shape(); // may show different cursor shape 3705 ui_cursor_shape(); // may show different cursor shape
3711 #endif 3706 #endif