summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriĆ  Arrufat <adria.arrufat@outlook.com>2024-08-04 20:55:21 +0900
committerAdriĆ  Arrufat <adria.arrufat@outlook.com>2024-08-04 20:55:21 +0900
commit2ab35fbb23baad69792d4cf45a3af83e2227c5af (patch)
treec2aa0fbd991a451f7d3efe768e9cdf7968f75f27 /src
parent10ed78fe8a580b3558348746ee53f81c5b0aeae1 (diff)
Add support for double underline
Diffstat (limited to 'src')
-rw-r--r--src/commands.cc5
-rw-r--r--src/face.hh27
-rw-r--r--src/face_registry.cc2
-rw-r--r--src/json_ui.cc1
-rw-r--r--src/terminal_ui.cc2
5 files changed, 21 insertions, 16 deletions
diff --git a/src/commands.cc b/src/commands.cc
index d22c0647..e4a41ead 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -2482,8 +2482,9 @@ const CommandDesc set_face_cmd = {
" <fg color>[,<bg color>[,<underline color>]][+<attributes>][@<base>]\n"
"colors are either a color name, rgb:######, or rgba:######## values.\n"
"attributes is a combination of:\n"
- " u: underline, c: curly underline, i: italic, b: bold,\n"
- " r: reverse, s: strikethrough, B: blink, d: dim,\n"
+ " u: underline, c: curly underline, U: double underline,\n"
+ " i: italic, b: bold, r: reverse,\n"
+ " s: strikethrough, B: blink, d: dim,\n"
" f: final foreground, g: final background,\n"
" a: final attributes, F: same as +fga\n"
"facespec can as well just be the name of another face.\n"
diff --git a/src/face.hh b/src/face.hh
index 1ed986ef..7e887705 100644
--- a/src/face.hh
+++ b/src/face.hh
@@ -9,19 +9,20 @@ namespace Kakoune
enum class Attribute : int
{
- Normal = 0,
- Underline = 1 << 1,
- CurlyUnderline = 1 << 2,
- Reverse = 1 << 3,
- Blink = 1 << 4,
- Bold = 1 << 5,
- Dim = 1 << 6,
- Italic = 1 << 7,
- Strikethrough = 1 << 8,
- FinalFg = 1 << 9,
- FinalBg = 1 << 10,
- FinalAttr = 1 << 11,
- Final = FinalFg | FinalBg | FinalAttr
+ Normal = 0,
+ Underline = 1 << 1,
+ CurlyUnderline = 1 << 2,
+ DoubleUnderline = 1 << 3,
+ Reverse = 1 << 4,
+ Blink = 1 << 5,
+ Bold = 1 << 6,
+ Dim = 1 << 7,
+ Italic = 1 << 8,
+ Strikethrough = 1 << 9,
+ FinalFg = 1 << 10,
+ FinalBg = 1 << 11,
+ FinalAttr = 1 << 12,
+ Final = FinalFg | FinalBg | FinalAttr
};
constexpr bool with_bit_ops(Meta::Type<Attribute>) { return true; }
diff --git a/src/face_registry.cc b/src/face_registry.cc
index d6c5cd53..ebb71986 100644
--- a/src/face_registry.cc
+++ b/src/face_registry.cc
@@ -50,6 +50,7 @@ FaceSpec parse_face(StringView facedesc)
{
case 'u': face.attributes |= Attribute::Underline; break;
case 'c': face.attributes |= Attribute::CurlyUnderline; break;
+ case 'U': face.attributes |= Attribute::DoubleUnderline; break;
case 'r': face.attributes |= Attribute::Reverse; break;
case 'b': face.attributes |= Attribute::Bold; break;
case 'B': face.attributes |= Attribute::Blink; break;
@@ -78,6 +79,7 @@ String to_string(Attribute attributes)
attrs[] {
{ Attribute::Underline, "u" },
{ Attribute::CurlyUnderline, "c" },
+ { Attribute::DoubleUnderline, "U" },
{ Attribute::Reverse, "r" },
{ Attribute::Blink, "B" },
{ Attribute::Bold, "b" },
diff --git a/src/json_ui.cc b/src/json_ui.cc
index 01768897..66674cf7 100644
--- a/src/json_ui.cc
+++ b/src/json_ui.cc
@@ -39,6 +39,7 @@ String to_json(Attribute attributes)
attrs[] {
{ Attribute::Underline, "underline" },
{ Attribute::CurlyUnderline, "curly_underline" },
+ { Attribute::DoubleUnderline, "double_underline" },
{ Attribute::Reverse, "reverse" },
{ Attribute::Blink, "blink" },
{ Attribute::Bold, "bold" },
diff --git a/src/terminal_ui.cc b/src/terminal_ui.cc
index 33574e90..912dfb57 100644
--- a/src/terminal_ui.cc
+++ b/src/terminal_ui.cc
@@ -224,7 +224,7 @@ void TerminalUI::Screen::set_face(const Face& face, Writer& writer)
static constexpr int fg_table[]{ 39, 30, 31, 32, 33, 34, 35, 36, 37, 90, 91, 92, 93, 94, 95, 96, 97 };
static constexpr int bg_table[]{ 49, 40, 41, 42, 43, 44, 45, 46, 47, 100, 101, 102, 103, 104, 105, 106, 107 };
static constexpr int ul_table[]{ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
- static constexpr const char* attr_table[]{ "0", "4", "4:3", "7", "5", "1", "2", "3", "9" };
+ static constexpr const char* attr_table[]{ "0", "4", "4:3", "21", "7", "5", "1", "2", "3", "9" };
auto set_color = [&](bool fg, const Color& color, bool join) {
if (join)