mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(statusline): missing offset when showing 'keymap' (#27270)
This commit is contained in:
		| @@ -151,14 +151,14 @@ void win_redr_status(win_T *wp) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     grid_line_start(&default_grid, is_stl_global ? (Rows - (int)p_ch - 1) : W_ENDROW(wp)); |     grid_line_start(&default_grid, is_stl_global ? (Rows - (int)p_ch - 1) : W_ENDROW(wp)); | ||||||
|     int col = is_stl_global ? 0 : wp->w_wincol; |     const int off = is_stl_global ? 0 : wp->w_wincol; | ||||||
|  |  | ||||||
|     int width = grid_line_puts(col, p, -1, attr); |     int width = grid_line_puts(off, p, -1, attr); | ||||||
|     grid_line_fill(width + col, this_ru_col + col, fillchar, attr); |     grid_line_fill(off + width, off + this_ru_col, fillchar, attr); | ||||||
|  |  | ||||||
|     if (get_keymap_str(wp, "<%s>", NameBuff, MAXPATHL) |     if (get_keymap_str(wp, "<%s>", NameBuff, MAXPATHL) | ||||||
|         && this_ru_col - len > (int)(strlen(NameBuff) + 1)) { |         && this_ru_col - len > (int)strlen(NameBuff) + 1) { | ||||||
|       grid_line_puts((int)((size_t)this_ru_col - strlen(NameBuff) - 1), NameBuff, -1, attr); |       grid_line_puts(off + this_ru_col - (int)strlen(NameBuff) - 1, NameBuff, -1, attr); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     win_redr_ruler(wp); |     win_redr_ruler(wp); | ||||||
| @@ -168,7 +168,7 @@ void win_redr_status(win_T *wp) | |||||||
|       const int sc_width = MIN(10, this_ru_col - len - 2); |       const int sc_width = MIN(10, this_ru_col - len - 2); | ||||||
|  |  | ||||||
|       if (sc_width > 0) { |       if (sc_width > 0) { | ||||||
|         grid_line_puts(wp->w_wincol + this_ru_col - sc_width - 1, showcmd_buf, sc_width, attr); |         grid_line_puts(off + this_ru_col - sc_width - 1, showcmd_buf, sc_width, attr); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -615,8 +615,8 @@ void win_redr_ruler(win_T *wp) | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     int w = grid_line_puts(this_ru_col + off, buffer, -1, attr); |     int w = grid_line_puts(off + this_ru_col, buffer, -1, attr); | ||||||
|     grid_line_fill(this_ru_col + off + w, off + width, fillchar, attr); |     grid_line_fill(off + this_ru_col + w, off + width, fillchar, attr); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -720,3 +720,58 @@ it('uses "stl" and "stlnc" fillchars even if they are the same #19803', function | |||||||
|   ]], |   ]], | ||||||
|   } |   } | ||||||
| end) | end) | ||||||
|  |  | ||||||
|  | it('showcmdloc=statusline works with vertical splits', function() | ||||||
|  |   clear() | ||||||
|  |   local screen = Screen.new(53, 4) | ||||||
|  |   screen:set_default_attr_ids { | ||||||
|  |     [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText | ||||||
|  |     [2] = { bold = true, reverse = true }, -- StatusLine | ||||||
|  |     [3] = { reverse = true }, -- StatusLineNC | ||||||
|  |   } | ||||||
|  |   screen:attach() | ||||||
|  |   command('rightbelow vsplit') | ||||||
|  |   command('set showcmd showcmdloc=statusline') | ||||||
|  |   feed('1234') | ||||||
|  |   screen:expect([[ | ||||||
|  |                               │^                          | | ||||||
|  |     {1:~                         }│{1:~                         }| | ||||||
|  |     {3:[No Name]                  }{2:[No Name]      1234       }| | ||||||
|  |                                                          | | ||||||
|  |   ]]) | ||||||
|  |   feed('<Esc>') | ||||||
|  |   command('set laststatus=3') | ||||||
|  |   feed('1234') | ||||||
|  |   screen:expect([[ | ||||||
|  |                               │^                          | | ||||||
|  |     {1:~                         }│{1:~                         }| | ||||||
|  |     {2:[No Name]                                 1234       }| | ||||||
|  |                                                          | | ||||||
|  |   ]]) | ||||||
|  | end) | ||||||
|  |  | ||||||
|  | it('keymap is shown with vertical splits #27269', function() | ||||||
|  |   clear() | ||||||
|  |   local screen = Screen.new(53, 4) | ||||||
|  |   screen:set_default_attr_ids { | ||||||
|  |     [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText | ||||||
|  |     [2] = { bold = true, reverse = true }, -- StatusLine | ||||||
|  |     [3] = { reverse = true }, -- StatusLineNC | ||||||
|  |   } | ||||||
|  |   screen:attach() | ||||||
|  |   command('setlocal keymap=dvorak') | ||||||
|  |   command('rightbelow vsplit') | ||||||
|  |   screen:expect([[ | ||||||
|  |                               │^                          | | ||||||
|  |     {1:~                         }│{1:~                         }| | ||||||
|  |     {3:[No Name]         <en-dv>  }{2:[No Name]         <en-dv> }| | ||||||
|  |                                                          | | ||||||
|  |   ]]) | ||||||
|  |   command('set laststatus=3') | ||||||
|  |   screen:expect([[ | ||||||
|  |                               │^                          | | ||||||
|  |     {1:~                         }│{1:~                         }| | ||||||
|  |     {2:[No Name]                                    <en-dv> }| | ||||||
|  |                                                          | | ||||||
|  |   ]]) | ||||||
|  | end) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 zeertzjq
					zeertzjq