mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00:00
Merge pull request #25229 from glepnir/20323
fix(highlight): add force in nvim_set_hl
This commit is contained in:
@@ -169,6 +169,7 @@ typedef struct {
|
||||
Integer blend;
|
||||
Boolean fg_indexed;
|
||||
Boolean bg_indexed;
|
||||
Boolean force;
|
||||
} Dict(highlight);
|
||||
|
||||
typedef struct {
|
||||
|
@@ -151,6 +151,7 @@ Dictionary nvim_get_hl(Integer ns_id, Dict(get_highlight) *opts, Arena *arena, E
|
||||
/// - cterm: cterm attribute map, like |highlight-args|. If not set,
|
||||
/// cterm attributes will match those from the attribute map
|
||||
/// documented above.
|
||||
/// - force: if true force update the highlight group when it exists.
|
||||
/// @param[out] err Error details, if any
|
||||
///
|
||||
// TODO(bfredl): val should take update vs reset flag
|
||||
|
@@ -799,11 +799,10 @@ int lookup_color(const int idx, const bool foreground, TriState *const boldp)
|
||||
void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id)
|
||||
{
|
||||
int idx = id - 1; // Index is ID minus one.
|
||||
|
||||
bool is_default = attrs.rgb_ae_attr & HL_DEFAULT;
|
||||
|
||||
// Return if "default" was used and the group already has settings
|
||||
if (is_default && hl_has_settings(idx, true)) {
|
||||
if (is_default && hl_has_settings(idx, true) && !dict->force) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user