mirror of
https://github.com/mawww/kakoune.git
synced 2024-09-11 13:00:41 +03:00
Merge 2ab35fbb23
into 238e5e7659
This commit is contained in:
commit
c139975b66
@ -15,7 +15,7 @@ Kakoune won't be able to parse named parameters in requests.
|
||||
Here are the data structures used:
|
||||
|
||||
* Color: a string, either a named color, or #rrggbb, or 'default'
|
||||
* Attribute: one of {underline, reverse, blink, bold, dim, italic, final_fg, final_bg, final_attr}
|
||||
* Attribute: one of {underline, curly_underline, double_underline, reverse, blink, bold, dim, italic, final_fg, final_bg, final_attr}
|
||||
* Face { Color fg; Color bg; Array<Attribute> attributes; }
|
||||
* Atom { Face face; String contents; }
|
||||
* Line : Array of Atom
|
||||
|
@ -6,6 +6,7 @@ released versions.
|
||||
== Development version
|
||||
|
||||
* Expose env vars that are mentionned in the arguments passed to shell expansions
|
||||
* Support for colored double underlines
|
||||
|
||||
== Kakoune 2024.05.18
|
||||
|
||||
|
@ -33,6 +33,9 @@ attributes::
|
||||
*c*:::
|
||||
curly underline
|
||||
Note: This takes precedence over underline if both are specified.
|
||||
*U*:::
|
||||
double underline
|
||||
Note: This takes precedence over underline and curly underline if also specified.
|
||||
*r*:::
|
||||
reverse
|
||||
*b*:::
|
||||
|
@ -2483,8 +2483,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"
|
||||
|
27
src/face.hh
27
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; }
|
||||
|
@ -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" },
|
||||
|
@ -40,6 +40,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" },
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user