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.
This commit is contained in:
bfredl
2024-11-11 13:06:37 +01:00
parent eaf5ae6cc6
commit ff7518b83c
35 changed files with 113 additions and 112 deletions

View File

@@ -952,7 +952,7 @@ int showmode(void)
// Position on the last line in the window, column 0
msg_pos_mode();
int hl_id = HLF_CM + 1; // Highlight mode
int hl_id = HLF_CM; // Highlight mode
// When the screen is too narrow to show the entire mode message,
// avoid scrolling and truncate instead.
@@ -987,7 +987,7 @@ int showmode(void)
}
if (edit_submode_extra != NULL) {
msg_puts_hl(" ", hl_id, false); // Add a space in between.
int sub_id = edit_submode_highl < HLF_COUNT ? (int)edit_submode_highl + 1 : hl_id;
int sub_id = edit_submode_highl < HLF_COUNT ? (int)edit_submode_highl : hl_id;
msg_puts_hl(edit_submode_extra, sub_id, false);
}
}
@@ -1133,7 +1133,7 @@ void clearmode(void)
msg_ext_ui_flush();
msg_pos_mode();
if (reg_recording != 0) {
recording_mode(HLF_CM + 1);
recording_mode(HLF_CM);
}
msg_clr_eos();
msg_ext_flush_showmode();