summaryrefslogtreecommitdiffstats
path: root/src/gui.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-12 22:55:58 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-12 22:55:58 +0200
commit3d9bdfebf1a8c1eec1c3e1cff6fbb60b3d98f02a (patch)
tree0d2c16aa5d073a120e160703ee88e73c07c211b8 /src/gui.c
parent893029ab20a06da9c0cf29661c9f6e2ec5583dce (diff)
patch 8.0.0921: terminal window cursor shape not supported in the GUIv8.0.0921
Problem: Terminal window cursor shape not supported in the GUI. Solution: Use the terminal window cursor shape in the GUI.
Diffstat (limited to 'src/gui.c')
-rw-r--r--src/gui.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/src/gui.c b/src/gui.c
index ff81d0b749..63625bfc40 100644
--- a/src/gui.c
+++ b/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);
+#ifdef FEAT_TERMINAL
+ if (use_terminal_cursor())
+ shape = term_get_cursor_shape(&shape_fg, &shape_bg);
+ else
+#endif
+ shape = &shape_table[get_shape_idx(FALSE)];
if (State & LANGMAP)
- id = shape_table[idx].id_lm;
+ id = shape->id_lm;
else
- id = shape_table[idx].id;
+ 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