mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.0.0921: terminal window cursor shape not supported in the GUI
Problem: Terminal window cursor shape not supported in the GUI. Solution: Use the terminal window cursor shape in the GUI.
This commit is contained in:
49
src/gui.c
49
src/gui.c
@@ -1051,8 +1051,12 @@ gui_update_cursor(
|
||||
int cur_width = 0;
|
||||
int cur_height = 0;
|
||||
int old_hl_mask;
|
||||
int idx;
|
||||
cursorentry_T *shape;
|
||||
int id;
|
||||
#ifdef FEAT_TERMINAL
|
||||
guicolor_T shape_fg = INVALCOLOR;
|
||||
guicolor_T shape_bg = INVALCOLOR;
|
||||
#endif
|
||||
guicolor_T cfg, cbg, cc; /* cursor fore-/background color */
|
||||
int cattr; /* cursor attributes */
|
||||
int attr;
|
||||
@@ -1094,20 +1098,35 @@ gui_update_cursor(
|
||||
|
||||
/*
|
||||
* How the cursor is drawn depends on the current mode.
|
||||
* When in a terminal window use the shape/color specified there.
|
||||
*/
|
||||
idx = get_shape_idx(FALSE);
|
||||
if (State & LANGMAP)
|
||||
id = shape_table[idx].id_lm;
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (use_terminal_cursor())
|
||||
shape = term_get_cursor_shape(&shape_fg, &shape_bg);
|
||||
else
|
||||
id = shape_table[idx].id;
|
||||
#endif
|
||||
shape = &shape_table[get_shape_idx(FALSE)];
|
||||
if (State & LANGMAP)
|
||||
id = shape->id_lm;
|
||||
else
|
||||
id = shape->id;
|
||||
|
||||
/* get the colors and attributes for the cursor. Default is inverted */
|
||||
cfg = INVALCOLOR;
|
||||
cbg = INVALCOLOR;
|
||||
cattr = HL_INVERSE;
|
||||
gui_mch_set_blinking(shape_table[idx].blinkwait,
|
||||
shape_table[idx].blinkon,
|
||||
shape_table[idx].blinkoff);
|
||||
gui_mch_set_blinking(shape->blinkwait,
|
||||
shape->blinkon,
|
||||
shape->blinkoff);
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (shape_bg != INVALCOLOR)
|
||||
{
|
||||
cattr = 0;
|
||||
cfg = shape_fg;
|
||||
cbg = shape_bg;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (id > 0)
|
||||
{
|
||||
cattr = syn_id2colors(id, &cfg, &cbg);
|
||||
@@ -1202,7 +1221,7 @@ gui_update_cursor(
|
||||
}
|
||||
|
||||
old_hl_mask = gui.highlight_mask;
|
||||
if (shape_table[idx].shape == SHAPE_BLOCK
|
||||
if (shape->shape == SHAPE_BLOCK
|
||||
#ifdef FEAT_HANGULIN
|
||||
|| composing_hangul
|
||||
#endif
|
||||
@@ -1242,16 +1261,14 @@ gui_update_cursor(
|
||||
* First draw the partial cursor, then overwrite with the text
|
||||
* character, using a transparent background.
|
||||
*/
|
||||
if (shape_table[idx].shape == SHAPE_VER)
|
||||
if (shape->shape == SHAPE_VER)
|
||||
{
|
||||
cur_height = gui.char_height;
|
||||
cur_width = (gui.char_width * shape_table[idx].percentage
|
||||
+ 99) / 100;
|
||||
cur_width = (gui.char_width * shape->percentage + 99) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_height = (gui.char_height * shape_table[idx].percentage
|
||||
+ 99) / 100;
|
||||
cur_height = (gui.char_height * shape->percentage + 99) / 100;
|
||||
cur_width = gui.char_width;
|
||||
}
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -1259,7 +1276,7 @@ gui_update_cursor(
|
||||
LineOffset[gui.row] + screen_Columns) > 1)
|
||||
{
|
||||
/* Double wide character. */
|
||||
if (shape_table[idx].shape != SHAPE_VER)
|
||||
if (shape->shape != SHAPE_VER)
|
||||
cur_width += gui.char_width;
|
||||
# ifdef FEAT_RIGHTLEFT
|
||||
if (CURSOR_BAR_RIGHT)
|
||||
@@ -1728,7 +1745,7 @@ gui_clear_block(
|
||||
void
|
||||
gui_update_cursor_later(void)
|
||||
{
|
||||
OUT_STR(IF_EB("\033|s", ESC_STR "|s"));
|
||||
OUT_STR(IF_EB("\033|s", ESC_STR "|s"));
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user