comparison src/normal.c @ 34625:ad1b0609b2f8 v9.1.0201

patch 9.1.0201: gM not working correctly with virt text Commit: https://github.com/vim/vim/commit/366c81a2005370ac738618d889ec0337397a9f96 Author: Dylan Thacker-Smith <dylan.ah.smith@gmail.com> Date: Sun Mar 24 09:46:56 2024 +0100 patch 9.1.0201: gM not working correctly with virt text Problem: `gM` would include outer virtual text and its padding when getting the line length used to calculate the middle of the line, putting the cursor much closer to virtual text lines. Solution: Exclude outer virtual text in getting the line length for `gM`, so that virtual text doesn't influence where the cursor is moved to (Dylan Thacker-Smith). closes: #14262 Signed-off-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Mar 2024 10:00:07 +0100
parents 65e7eaf68f19
children ca2da8e8fb53
comparison
equal deleted inserted replaced
34624:1b6276bb4ff0 34625:ad1b0609b2f8
6064 6064
6065 case 'M': 6065 case 'M':
6066 { 6066 {
6067 oap->motion_type = MCHAR; 6067 oap->motion_type = MCHAR;
6068 oap->inclusive = FALSE; 6068 oap->inclusive = FALSE;
6069 i = linetabsize(curwin, curwin->w_cursor.lnum); 6069 i = linetabsize_no_outer(curwin, curwin->w_cursor.lnum);
6070 if (cap->count0 > 0 && cap->count0 <= 100) 6070 if (cap->count0 > 0 && cap->count0 <= 100)
6071 coladvance((colnr_T)(i * cap->count0 / 100)); 6071 coladvance((colnr_T)(i * cap->count0 / 100));
6072 else 6072 else
6073 coladvance((colnr_T)(i / 2)); 6073 coladvance((colnr_T)(i / 2));
6074 curwin->w_set_curswant = TRUE; 6074 curwin->w_set_curswant = TRUE;