diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-02-02 17:47:11 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-02-02 17:47:11 +0000 |
commit | d9c904f85a23a496df4eb6be42aa43f007b22d50 (patch) | |
tree | 596e41c4ce8a6e883e609ad9f09e6925728fdb48 | |
parent | 5bb0758567e953f15335d284f31ae14947339c7a (diff) | |
download | rneovim-d9c904f85a23a496df4eb6be42aa43f007b22d50.tar.gz rneovim-d9c904f85a23a496df4eb6be42aa43f007b22d50.tar.bz2 rneovim-d9c904f85a23a496df4eb6be42aa43f007b22d50.zip |
feat(colorcolchar): implement 'foreground' flag
This flag, denoted by an 'f', will force the character over the
colorcolumn to take on the colorcolumn's highlight, discarding any
highlight the character would have had otherwise.
This is the inverse of the 'background' flag, where the colorcolumn will
take the highlight of the character discarding any highlight it
otherwise would have had.
-rw-r--r-- | src/nvim/buffer_defs.h | 3 | ||||
-rw-r--r-- | src/nvim/drawline.c | 5 | ||||
-rw-r--r-- | src/nvim/window.c | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index dfcbb28c69..5ae6f55ad8 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -94,7 +94,8 @@ typedef uint64_t disptick_T; // display tick type #include "nvim/terminal.h" typedef enum { - kColorcolBehind = 1 + kColorcolBehind = 1, + kColorcolForeground = 2, } colorcol_flags_T; // Structure to define data associated with a colorcolumn. diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index ee6af01942..031ad39f75 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -2610,7 +2610,10 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange, char_attr = hl_combine_attr(win_hl_attr(wp, HLF_CUC), char_attr); } else if (draw_color_col && VCOL_HLC == color_cols->col) { vcol_save_attr = char_attr; - if (!(color_cols->flags & kColorcolBehind)) { + + if (color_cols->flags & kColorcolForeground) { + char_attr = hl_combine_attr(char_attr, color_cols->syn_attr); + } else if (!(color_cols->flags & kColorcolBehind)) { char_attr = hl_combine_attr(color_cols->syn_attr, char_attr); } } diff --git a/src/nvim/window.c b/src/nvim/window.c index 5e99cec015..16405f87b6 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -7498,6 +7498,10 @@ char *check_colorcolumn(win_T *wp) flags |= kColorcolBehind; break; + case 'f': + flags |= kColorcolForeground; + break; + default: return e_invarg; } |