From e049c6e4c08a141c94218672e770f86f91c27a11 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 12 Oct 2024 10:57:31 -0700 Subject: feat(ui): statusline text inherits highlights #29976 Changes apply to the winbar, statusline, and tabline text. --- src/nvim/statusline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/statusline.c') diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index 07bb7dd69a..6b8f5e27a3 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -430,7 +430,7 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler) if (hltab[n].userhl == 0) { curattr = attr; } else if (hltab[n].userhl < 0) { - curattr = syn_id2attr(-hltab[n].userhl); + curattr = hl_combine_attr(attr, syn_id2attr(-hltab[n].userhl)); } else if (wp != NULL && wp != curwin && wp->w_status_height != 0) { curattr = highlight_stlnc[hltab[n].userhl - 1]; } else { -- cgit From 4f9260d06a48216862ebb34fc33744486b058f58 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Fri, 8 Mar 2024 14:44:58 +0100 Subject: feat(ext_messages): add hl_id to ext_messages chunks Problem: Ext_messages chunks only contain the highlight attr id, which is not very useful for vim.ui_attach() consumers. Solotion: Add highlight group id to message chunks, which can easily be used to highlight text in the TUI through nvim_buf_set_extmark(): hl_group = synIDattr(id, "name"). --- src/nvim/statusline.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/statusline.c') diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index 6b8f5e27a3..d9ac1aa347 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -582,9 +582,11 @@ void win_redr_ruler(win_T *wp) if (ui_has(kUIMessages) && !part_of_status) { MAXSIZE_TEMP_ARRAY(content, 1); - MAXSIZE_TEMP_ARRAY(chunk, 2); + MAXSIZE_TEMP_ARRAY(chunk, 3); ADD_C(chunk, INTEGER_OBJ(attr)); ADD_C(chunk, CSTR_AS_OBJ(buffer)); + ADD_C(chunk, INTEGER_OBJ(HLF_MSG + 1)); + assert(attr == HL_ATTR(HLF_MSG)); ADD_C(content, ARRAY_OBJ(chunk)); ui_call_msg_ruler(content); did_show_ext_ruler = true; -- cgit From ff7518b83cb270f8fcaded19bf640cf4bdfb0ff0 Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 11 Nov 2024 13:06:37 +0100 Subject: refactor(highlight): make enum of builtin highlights start with 1 This makes it possible to use HLF_ values directly as highlight id:s and avoids +1 adjustments especially around messages. --- src/nvim/statusline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/statusline.c') diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index d9ac1aa347..ba64633df7 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -585,7 +585,7 @@ void win_redr_ruler(win_T *wp) MAXSIZE_TEMP_ARRAY(chunk, 3); ADD_C(chunk, INTEGER_OBJ(attr)); ADD_C(chunk, CSTR_AS_OBJ(buffer)); - ADD_C(chunk, INTEGER_OBJ(HLF_MSG + 1)); + ADD_C(chunk, INTEGER_OBJ(HLF_MSG)); assert(attr == HL_ATTR(HLF_MSG)); ADD_C(content, ARRAY_OBJ(chunk)); ui_call_msg_ruler(content); @@ -1632,7 +1632,7 @@ stcsign: schar_T fold_buf[9]; fill_foldcolumn(wp, stcp->foldinfo, (linenr_T)get_vim_var_nr(VV_LNUM), 0, fdc, NULL, fold_buf); - stl_items[curitem].minwid = -((stcp->use_cul ? HLF_CLF : HLF_FC) + 1); + stl_items[curitem].minwid = -(stcp->use_cul ? HLF_CLF : HLF_FC); size_t buflen = 0; // TODO(bfredl): this is very backwards. we must support schar_T // being used directly in 'statuscolumn' @@ -1653,7 +1653,7 @@ stcsign: buf_tmp[signlen++] = ' '; buf_tmp[signlen++] = ' '; buf_tmp[signlen] = NUL; - stl_items[curitem].minwid = -((stcp->use_cul ? HLF_CLS : HLF_SC) + 1); + stl_items[curitem].minwid = -(stcp->use_cul ? HLF_CLS : HLF_SC); } } stl_items[curitem++].type = Highlight; -- cgit From f85bc41c800d7f5c0256f29aa347a53600a7c8d5 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Sun, 17 Nov 2024 00:32:36 +0100 Subject: feat(ui): don't show unfocusable windows in :tabs, 'tabline' #27984 Problem: Floating windows with focusable set to false can reasonably be expected to be UI elements but are listed in some outputs that should contain only regular windows. Solution: Hide unfocusable floating windows from the default tabline and :tabs. --- src/nvim/statusline.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/statusline.c') diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index ba64633df7..4e78067d46 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -760,7 +760,9 @@ void draw_tabline(void) bool modified = false; for (wincount = 0; wp != NULL; wp = wp->w_next, wincount++) { - if (bufIsChanged(wp->w_buffer)) { + if (!wp->w_config.focusable) { + wincount--; + } else if (bufIsChanged(wp->w_buffer)) { modified = true; } } -- cgit