patch 9.1.1562: close button always visible in the 'tabline'

Problem:  close button "X" is visible in the non-GUI 'tabline', even
          when the mouse is disabled
Solution: only show the button when 'mouse' contains any of the flags
          "anvi" (Girish Palya)

The tabline always displays an "X" (close) button, and the info popup
shows both a close button and a resize handle—even when the mouse is
disabled. These UI elements are only actionable with the mouse and serve
no purpose for keyboard users who disable the mouse. Displaying
non-functional, clickable elements in a non-GUI environment is
misleading and adds unnecessary visual clutter.

So remove the close button and resize handle when the mouse is disabled.
They appear again when mouse is enabled.

closes: #17765

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-07-17 21:56:16 +02:00
committed by Christian Brabandt
parent b7fc24d3a3
commit fb45809f01
11 changed files with 112 additions and 12 deletions

View File

@ -4284,6 +4284,16 @@ recording_mode(int attr)
msg_puts_attr(s, attr);
}
/*
* Return TRUE if mouse is enabled.
*/
static int
mouse_has_any(void)
{
return mouse_has(MOUSE_NORMAL) || mouse_has(MOUSE_INSERT)
|| mouse_has(MOUSE_VISUAL);
}
/*
* Draw the tab pages line at the top of the Vim window.
*/
@ -4460,7 +4470,7 @@ draw_tabline(void)
}
// Put an "X" for closing the current tab if there are several.
if (tabcount > 1)
if (tabcount > 1 && mouse_has_any())
{
screen_putchar('X', 0, (int)Columns - 1, attr_nosel);
TabPageIdxs[Columns - 1] = -999;