From a2d03d9b1acc922e6fe1d7a9bae14027271ae7a6 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 26 Nov 2018 01:26:07 +0100 Subject: refactor: Rename get_term_attr_entry Rename get_term_attr_entry to hl_get_term_attr, similar to hl_get_syn_attr, hl_get_ui_attr. --- src/nvim/highlight.c | 2 +- src/nvim/terminal.c | 2 +- src/nvim/ui_bridge.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index a104137d9e..ae2b90d8a1 100644 --- a/src/nvim/highlight.c +++ b/src/nvim/highlight.c @@ -178,7 +178,7 @@ void update_window_hl(win_T *wp, bool invalid) } /// Get attribute code for forwarded :terminal highlights. -int get_term_attr_entry(HlAttrs *aep) +int hl_get_term_attr(HlAttrs *aep) { return get_attr_entry((HlEntry){ .attr= *aep, .kind = kHlTerminal, .id1 = 0, .id2 = 0 }); diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index d831979022..07722c68ac 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -603,7 +603,7 @@ void terminal_get_line_attributes(Terminal *term, win_T *wp, int linenr, int attr_id = 0; if (hl_attrs || vt_fg != -1 || vt_bg != -1) { - attr_id = get_term_attr_entry(&(HlAttrs) { + attr_id = hl_get_term_attr(&(HlAttrs) { .cterm_ae_attr = (int16_t)hl_attrs, .cterm_fg_color = vt_fg_idx, .cterm_bg_color = vt_bg_idx, diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c index ebd4651f4d..eb592694e6 100644 --- a/src/nvim/ui_bridge.c +++ b/src/nvim/ui_bridge.c @@ -104,7 +104,7 @@ static void ui_thread_run(void *data) static void ui_bridge_stop(UI *b) { - // Detach brigde first, so that "stop" is the last event the TUI loop + // Detach bridge first, so that "stop" is the last event the TUI loop // receives from the main thread. #8041 ui_detach_impl(b); UIBridgeData *bridge = (UIBridgeData *)b; -- cgit From 3283db4ecbe32c6f2bbf1c7ea3032ef4091d5444 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 21 Sep 2018 21:51:49 +0200 Subject: diff/highlight: do not overlay low-priority CursorLine ref #6380 --- src/nvim/highlight_defs.h | 6 +++--- src/nvim/screen.c | 5 +++-- src/nvim/syntax.c | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/highlight_defs.h b/src/nvim/highlight_defs.h index 0790793c94..40025fcbbb 100644 --- a/src/nvim/highlight_defs.h +++ b/src/nvim/highlight_defs.h @@ -22,7 +22,7 @@ typedef enum { /// Stores a complete highlighting entry, including colors and attributes /// for both TUI and GUI. typedef struct attr_entry { - int16_t rgb_ae_attr, cterm_ae_attr; // HL_BOLD, etc. + int16_t rgb_ae_attr, cterm_ae_attr; ///< HlAttrFlags RgbValue rgb_fg_color, rgb_bg_color, rgb_sp_color; int cterm_fg_color, cterm_bg_color; } HlAttrs; @@ -83,8 +83,8 @@ typedef enum { , HLF_TP // tabpage line , HLF_TPS // tabpage line selected , HLF_TPF // tabpage line filler - , HLF_CUC // 'cursurcolumn' - , HLF_CUL // 'cursurline' + , HLF_CUC // 'cursorcolumn' + , HLF_CUL // 'cursorline' , HLF_MC // 'colorcolumn' , HLF_QFL // selected quickfix line , HLF_0 // Whitespace diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 1de5e5cc3d..2a1dae1767 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2826,7 +2826,7 @@ win_line ( draw_state = WL_BRI - 1; } - // draw 'breakindent': indent wrapped text accodringly + // draw 'breakindent': indent wrapped text accordingly if (draw_state == WL_BRI - 1 && n_extra == 0) { draw_state = WL_BRI; // if need_showbreak is set, breakindent also applies @@ -3052,7 +3052,8 @@ win_line ( diff_hlf = HLF_CHD; // changed line } line_attr = win_hl_attr(wp, diff_hlf); - if (wp->w_p_cul && lnum == wp->w_cursor.lnum) { + // Overlay CursorLine onto diff highlight, unless it's low-priority. + if (!line_attr_lowprio && wp->w_p_cul && lnum == wp->w_cursor.lnum) { line_attr = hl_combine_attr(line_attr, win_hl_attr(wp, HLF_CUL)); } } diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 22eabc75c1..2cade9f281 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -61,6 +61,7 @@ struct hl_group { scid_T sg_scriptID; ///< script in which the group was last set // for terminal UIs int sg_cterm; ///< "cterm=" highlighting attr + ///< (combination of \ref HlAttrFlags) int sg_cterm_fg; ///< terminal fg color number + 1 int sg_cterm_bg; ///< terminal bg color number + 1 bool sg_cterm_bold; ///< bold attr was set for light color -- cgit From 60f845ca55a1b8b11a4eb390b1fed93a79e99ad5 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 31 Oct 2018 20:24:24 +0100 Subject: diff/highlight: Show underline for low-priority CursorLine --- src/nvim/highlight.c | 18 ++++++++++++++++++ src/nvim/screen.c | 10 +++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index ae2b90d8a1..89a41e73de 100644 --- a/src/nvim/highlight.c +++ b/src/nvim/highlight.c @@ -177,6 +177,24 @@ void update_window_hl(win_T *wp, bool invalid) } } +/// Gets HL_UNDERLINE highlight. +int hl_get_underline(void) +{ + return get_attr_entry((HlEntry){ + .attr = (HlAttrs){ + .cterm_ae_attr = (int16_t)HL_UNDERLINE, + .cterm_fg_color = 0, + .cterm_bg_color = 0, + .rgb_ae_attr = (int16_t)HL_UNDERLINE, + .rgb_fg_color = 0, + .rgb_bg_color = 0, + }, + .kind = kHlUI, + .id1 = 0, + .id2 = 0, + }); +} + /// Get attribute code for forwarded :terminal highlights. int hl_get_term_attr(HlAttrs *aep) { diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 2a1dae1767..eb24e2af1c 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3052,9 +3052,13 @@ win_line ( diff_hlf = HLF_CHD; // changed line } line_attr = win_hl_attr(wp, diff_hlf); - // Overlay CursorLine onto diff highlight, unless it's low-priority. - if (!line_attr_lowprio && wp->w_p_cul && lnum == wp->w_cursor.lnum) { - line_attr = hl_combine_attr(line_attr, win_hl_attr(wp, HLF_CUL)); + // Overlay CursorLine onto diff-mode highlight. + if (wp->w_p_cul && lnum == wp->w_cursor.lnum) { + line_attr = 0 != line_attr_lowprio // Low-priority CursorLine + ? hl_combine_attr(hl_combine_attr(win_hl_attr(wp, HLF_CUL), + line_attr), + hl_get_underline()) + : hl_combine_attr(line_attr, win_hl_attr(wp, HLF_CUL)); } } -- cgit From 7fdb45e0f8b2dfc367067c62e413dd8082d770d5 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 26 Nov 2018 22:14:18 +0100 Subject: preserve_exit: Ignore SIGHUP closes #9274 ref #9028 If stdin closed then read_error_exit calls preserve_exit. Handling SIGHUP during preserve_exit would cause a premature teardown, and conflicts with e.g. ui_bridge_stop which waits for TUI to teardown. Vim ignores SIGHUP in its prepare_to_exit and getout_preserve_modified routines: /* Ignore SIGHUP, because a dropped connection causes a read error, which * makes Vim exit and then handling SIGHUP causes various reentrance * problems. */ signal(SIGHUP, SIG_IGN); --- src/nvim/misc1.c | 3 +++ src/nvim/ui_bridge.c | 1 + 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 4032210213..d8730ea08a 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -52,6 +52,7 @@ #include "nvim/window.h" #include "nvim/os/os.h" #include "nvim/os/shell.h" +#include "nvim/os/signal.h" #include "nvim/os/input.h" #include "nvim/os/time.h" #include "nvim/event/stream.h" @@ -2653,6 +2654,8 @@ void preserve_exit(void) } really_exiting = true; + // Ignore SIGHUP while we are already exiting. #9274 + signal_reject_deadly(); mch_errmsg(IObuff); mch_errmsg("\n"); ui_flush(); diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c index eb592694e6..bd5d37be73 100644 --- a/src/nvim/ui_bridge.c +++ b/src/nvim/ui_bridge.c @@ -117,6 +117,7 @@ static void ui_bridge_stop(UI *b) if (stopped) { // -V547 break; } + // TODO(justinmk): Remove this. Use a cond-wait above. #9274 loop_poll_events(&main_loop, 10); // Process one event. } uv_thread_join(&bridge->ui_thread); -- cgit