diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-02-11 13:01:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-11 13:01:31 +0100 |
commit | 564ad60c0624941bdd63a6ed026cd03573c46f5a (patch) | |
tree | f965a496f29fa35d17af6829238bc6e8aa65007e /src/nvim/screen.c | |
parent | dd068928c1c39854a65108366c1a3106cfdb43c5 (diff) | |
parent | 5d8da126d0b5ab7f550a74264ba434a2ad04280e (diff) | |
download | rneovim-564ad60c0624941bdd63a6ed026cd03573c46f5a.tar.gz rneovim-564ad60c0624941bdd63a6ed026cd03573c46f5a.tar.bz2 rneovim-564ad60c0624941bdd63a6ed026cd03573c46f5a.zip |
Merge pull request #7982 from bfredl/hlrefactor
Refactor HlAttrs so that termguicolors is implemented purely on TUI side
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 8a29734025..122f760c51 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -139,11 +139,6 @@ * doesn't fit. */ #define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) -/* - * The attributes that are actually active for writing to the screen. - */ -static int screen_attr = 0; - static match_T search_hl; /* used for 'hlsearch' highlight matching */ static foldinfo_T win_foldinfo; /* info for 'foldcolumn' */ @@ -189,8 +184,6 @@ void redraw_win_later(win_T *wp, int type) void redraw_later_clear(void) { redraw_all_later(CLEAR); - /* Use attributes that is very unlikely to appear in text. */ - screen_attr = HL_BOLD | HL_UNDERLINE | HL_INVERSE; } /* @@ -5847,30 +5840,16 @@ next_search_hl_pos( return 0; } -static void screen_start_highlight(int attr) -{ - screen_attr = attr; - ui_start_highlight(attr); -} - -static void screen_stop_highlight(void) -{ - ui_stop_highlight(); - screen_attr = 0; -} - /* * Put character ScreenLines["off"] on the screen at position "row" and "col", * using the attributes from ScreenAttrs["off"]. */ static void screen_char(unsigned off, int row, int col) { - int attr; - - /* Check for illegal values, just in case (could happen just after - * resizing). */ - if (row >= screen_Rows || col >= screen_Columns) + // Check for illegal values, just in case (could happen just after resizing). + if (row >= screen_Rows || col >= screen_Columns) { return; + } // Outputting the last character on the screen may scrollup the screen. // Don't to it! Mark the character invalid (update it when scrolled up) @@ -5882,17 +5861,8 @@ static void screen_char(unsigned off, int row, int col) return; } - /* - * Stop highlighting first, so it's easier to move the cursor. - */ - attr = ScreenAttrs[off]; - if (screen_attr != attr) - screen_stop_highlight(); - ui_cursor_goto(row, col); - - if (screen_attr != attr) - screen_start_highlight(attr); + ui_set_highlight(ScreenAttrs[off]); if (enc_utf8 && ScreenLinesUC[off] != 0) { char_u buf[MB_MAXBYTES + 1]; @@ -6001,7 +5971,7 @@ void screen_fill(int start_row, int end_row, int start_col, int end_col, int c1, ++off; if (off < end_off) { /* something to be cleared */ col = off - LineOffset[row]; - screen_stop_highlight(); + ui_clear_highlight(); ui_cursor_goto(row, col); // clear rest of this screen line ui_call_eol_clear(); col = end_col - col; @@ -6383,8 +6353,7 @@ static void screenclear2(void) return; } - screen_stop_highlight(); /* don't want highlighting here */ - + ui_clear_highlight(); // don't want highlighting here /* blank out ScreenLines */ for (i = 0; i < Rows; ++i) { |