patch 9.1.0030: Cannot use terminal alternate font
Problem: Cannot use terminal alternate fonts (PMunch)
Solution: Support terminal alternate fonts using
CSI SGR 10-20 and t_CF code (PMunch)
Add support for alternate font highlighting
This adds support for alternate font highlighting using CSI SGR 10-20.
Few terminals currently support this, but with added tool support this
should improve over time. The change here is more or less taken from how
colors are configured and applied, but there might be some parts I
missed while implementing it. Changing fonts is done through the new
`:hi ctermfont` attribute which takes a number, 0 is the normal font, and
the numbers 1-9 select an "alternative" font. Which fonts are in use is
up to the terminal.
fixes: #13513
closes: #13537
Signed-off-by: PMunch <peterme@peterme.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/termdefs.h b/src/termdefs.h
index 9f72dc1..f28fd19 100644
--- a/src/termdefs.h
+++ b/src/termdefs.h
@@ -114,10 +114,11 @@
KS_SSI, // save icon text
KS_SRI, // restore icon text
KS_FD, // disable focus event tracking
- KS_FE // enable focus event tracking
+ KS_FE, // enable focus event tracking
+ KS_CF // set terminal alternate font
};
-#define KS_LAST KS_FE
+#define KS_LAST KS_CF
/*
* the terminal capabilities are stored in this array
@@ -191,6 +192,7 @@
#define T_CAF (TERM_STR(KS_CAF)) // set foreground color (ANSI)
#define T_CAB (TERM_STR(KS_CAB)) // set background color (ANSI)
#define T_CAU (TERM_STR(KS_CAU)) // set underline color (ANSI)
+#define T_CFO (TERM_STR(KS_CF)) // set alternate font
#define T_LE (TERM_STR(KS_LE)) // cursor left
#define T_ND (TERM_STR(KS_ND)) // cursor right
#define T_CIS (TERM_STR(KS_CIS)) // set icon text start