sled

Једноставни уређивач текста
git clone https://git.sr.ht/~strahinja/sled
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување e472a36f5ea77dc4adfc3e1813b0865583160285
родитељ 504bf7d201667cf53f994ed32c0e7549ea4f7a44
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Sat,  7 Sep 2024 12:27:19 +0200

Update patches

Diffstat:
Mpatch/bw-theme.patch | 101++++++++++++++++++++++++++++++++++---------------------------------------------
Mpatch/dark-theme.patch | 130+++++++++++++++++++++++++++++++------------------------------------------------
Mpatch/light-theme.patch | 130+++++++++++++++++++++++++++++++------------------------------------------------
Mpatch/syntax.patch | 208++++++++++++++++++++++++++++++++++++++-----------------------------------------
измењених датотека: 4, додавања: 244(+), брисања: 325(-)

diff --git a/patch/bw-theme.patch b/patch/bw-theme.patch @@ -1,72 +1,57 @@ -From efb3f72f149cdd378b76203f99f0d31d06a988f0 Mon Sep 17 00:00:00 2001 +From 744a42da5c6578c1febcfe3f260ed63b9cbcba94 Mon Sep 17 00:00:00 2001 From: Страхиња Радић <sr@strahinja.org> -Date: Thu Aug 8 10:09:03 2024 UTC +Date: Sat Sep 7 10:00:11 2024 UTC Subject: [PATCH] Set black and white theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- - config.def.h | 19+ 19- - 1 file changed, 19 insertions(+), 19 deletions(-) + config.def.h | 12+ 15- + 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/config.def.h b/config.def.h -index 043d9169e..efb3f72f1 100644 +index 504bf7d20..744a42da5 100644 --- a/config.def.h +++ b/config.def.h -@@ -5,33 +5,33 @@ - #define DLG_FG TB_BLACK - #define DLG_BG TB_WHITE - #define ERROR_FG TB_WHITE | TB_BOLD --#define ERROR_BG TB_RED -+#define ERROR_BG TB_BLACK - #define ACTION_FG TB_BLACK - #define ACTION_BG TB_WHITE - #define INPUT_FG TB_BLACK - #define INPUT_BG TB_WHITE - #define INPUT_EDIT_FG TB_WHITE - #define INPUT_EDIT_BG TB_BLACK --#define LINENO_FG TB_BLACK --#define LINENO_BG TB_CYAN --#define PROMPT_FG TB_YELLOW | TB_BOLD --#define PROMPT_BG TB_MAGENTA --#define SEARCH_FG TB_WHITE | TB_BOLD --#define SEARCH_BG TB_GREEN --#define SEL_FG TB_BLACK --#define SEL_BG TB_WHITE -+#define LINENO_FG TB_WHITE | TB_BOLD -+#define LINENO_BG TB_DEFAULT -+#define PROMPT_FG TB_BLACK -+#define PROMPT_BG TB_WHITE -+#define SEARCH_FG TB_BLACK | TB_BOLD -+#define SEARCH_BG TB_WHITE -+#define SEL_FG TB_REVERSE -+#define SEL_BG TB_REVERSE - #define SHADOW_FG TB_BLACK - #define SHADOW_BG TB_BLACK | TB_BOLD --#define STATUS_1_FG TB_WHITE | TB_BOLD --#define STATUS_1_BG TB_BLUE --#define STATUS_2_FG TB_YELLOW | TB_BOLD --#define STATUS_2_BG TB_BLUE --#define STATUS_3_FG TB_WHITE --#define STATUS_3_BG TB_BLUE --#define STATUS_4_FG TB_WHITE | TB_BOLD --#define STATUS_4_BG TB_BLUE --#define STATUS_5_FG TB_WHITE --#define STATUS_5_BG TB_BLUE -+#define STATUS_1_FG TB_BLACK -+#define STATUS_1_BG TB_WHITE -+#define STATUS_2_FG TB_BLACK -+#define STATUS_2_BG TB_WHITE -+#define STATUS_3_FG TB_BLACK -+#define STATUS_3_BG TB_WHITE -+#define STATUS_4_FG TB_BLACK -+#define STATUS_4_BG TB_WHITE -+#define STATUS_5_FG TB_BLACK -+#define STATUS_5_BG TB_WHITE - #define TEXT_FG TB_DEFAULT - #define TEXT_BG TB_DEFAULT - #define TITLE_FG TB_BLACK +@@ -6,25 +6,22 @@ + static const struct Color colors[] = { + [C_DLG] = { .fg = TB_BLACK, .bg = TB_WHITE }, + [C_ERROR] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_RED }, ++ .bg = TB_BLACK }, + [C_ACTION] = { .fg = TB_BLACK, .bg = TB_WHITE }, + [C_INPUT] = { .fg = TB_BLACK, .bg = TB_WHITE }, + [C_INPUT_EDIT] = { .fg = TB_WHITE, .bg = TB_BLACK }, +- [C_LINENO] = { .fg = TB_BLACK, .bg = TB_CYAN }, +- [C_PROMPT] = { .fg = TB_YELLOW | TB_BOLD, +- .bg = TB_MAGENTA }, +- [C_SEARCH] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_GREEN }, +- [C_SEL] = { .fg = TB_BLACK, .bg = TB_WHITE }, ++ [C_LINENO] = { .fg = TB_WHITE | TB_BOLD, ++ .bg = TB_DEFAULT }, ++ [C_PROMPT] = { .fg = TB_BLACK, .bg = TB_WHITE }, ++ [C_SEARCH] = { .fg = TB_BLACK | TB_BOLD, ++ .bg = TB_WHITE }, ++ [C_SEL] = { .fg = TB_REVERSE, .bg = TB_REVERSE }, + [C_SHADOW] = { .fg = TB_BLACK, .bg = TB_BLACK | TB_BOLD}, +- [C_STATUS_1] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_BLUE }, +- [C_STATUS_2] = { .fg = TB_YELLOW | TB_BOLD, +- .bg = TB_BLUE }, +- [C_STATUS_3] = { .fg = TB_WHITE, .bg = TB_BLUE }, +- [C_STATUS_4] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_BLUE }, +- [C_STATUS_5] = { .fg = TB_WHITE, .bg = TB_BLUE }, ++ [C_STATUS_1] = { .fg = TB_BLACK, .bg = TB_WHITE }, ++ [C_STATUS_2] = { .fg = TB_BLACK, .bg = TB_WHITE }, ++ [C_STATUS_3] = { .fg = TB_BLACK, .bg = TB_WHITE }, ++ [C_STATUS_4] = { .fg = TB_BLACK, .bg = TB_WHITE }, ++ [C_STATUS_5] = { .fg = TB_BLACK, .bg = TB_WHITE }, + [C_TEXT] = { .fg = TB_DEFAULT, .bg = TB_DEFAULT }, + [C_TITLE] = { .fg = TB_BLACK, .bg = TB_WHITE }, + }; -- 2.44.1 diff --git a/patch/dark-theme.patch b/patch/dark-theme.patch @@ -1,97 +1,69 @@ -From 032f35d59a9e8855cb5d3195095619f7095aec3b Mon Sep 17 00:00:00 2001 +From 0ce620d838cec52583c50fa808af0e9dab38760c Mon Sep 17 00:00:00 2001 From: Страхиња Радић <sr@strahinja.org> -Date: Thu Aug 8 10:08:47 2024 UTC +Date: Sat Sep 7 10:09:58 2024 UTC Subject: [PATCH] Set dark theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- - config.def.h | 34+ 34- + config.def.h | 17+ 23- sled.c | 1+ 0- - 2 files changed, 35 insertions(+), 34 deletions(-) + 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/config.def.h b/config.def.h -index 043d9169e..032f35d59 100644 +index 504bf7d20..0ce620d83 100644 --- a/config.def.h +++ b/config.def.h -@@ -2,40 +2,40 @@ - * any later version. Copyright (C) 2022-2024 Страхиња Радић. - * See the file LICENSE for exact copyright and license details. */ +@@ -4,29 +4,23 @@ --#define DLG_FG TB_BLACK --#define DLG_BG TB_WHITE --#define ERROR_FG TB_WHITE | TB_BOLD --#define ERROR_BG TB_RED --#define ACTION_FG TB_BLACK --#define ACTION_BG TB_WHITE --#define INPUT_FG TB_BLACK --#define INPUT_BG TB_WHITE --#define INPUT_EDIT_FG TB_WHITE --#define INPUT_EDIT_BG TB_BLACK --#define LINENO_FG TB_BLACK --#define LINENO_BG TB_CYAN --#define PROMPT_FG TB_YELLOW | TB_BOLD --#define PROMPT_BG TB_MAGENTA --#define SEARCH_FG TB_WHITE | TB_BOLD --#define SEARCH_BG TB_GREEN --#define SEL_FG TB_BLACK --#define SEL_BG TB_WHITE --#define SHADOW_FG TB_BLACK --#define SHADOW_BG TB_BLACK | TB_BOLD --#define STATUS_1_FG TB_WHITE | TB_BOLD --#define STATUS_1_BG TB_BLUE --#define STATUS_2_FG TB_YELLOW | TB_BOLD --#define STATUS_2_BG TB_BLUE --#define STATUS_3_FG TB_WHITE --#define STATUS_3_BG TB_BLUE --#define STATUS_4_FG TB_WHITE | TB_BOLD --#define STATUS_4_BG TB_BLUE --#define STATUS_5_FG TB_WHITE --#define STATUS_5_BG TB_BLUE --#define TEXT_FG TB_DEFAULT --#define TEXT_BG TB_DEFAULT --#define TITLE_FG TB_BLACK --#define TITLE_BG TB_WHITE -+#define DLG_FG 0xfb -+#define DLG_BG 0xef -+#define ERROR_FG 0x0f -+#define ERROR_BG 0x58 -+#define ACTION_FG 0xfb -+#define ACTION_BG 0xef -+#define INPUT_FG 0x0f -+#define INPUT_BG 0xef -+#define INPUT_EDIT_FG 0xe8 -+#define INPUT_EDIT_BG 0xf7 -+#define LINENO_FG 0xfb -+#define LINENO_BG 0xec -+#define PROMPT_FG 0xe3 -+#define PROMPT_BG 0x7d -+#define SEARCH_FG 0x10 -+#define SEARCH_BG 0x24 -+#define SEL_FG 0xef -+#define SEL_BG 0xfb -+#define SHADOW_FG 0x10 -+#define SHADOW_BG 0x10 -+#define STATUS_1_FG 0x0f -+#define STATUS_1_BG 0xef -+#define STATUS_2_FG 0xe3 -+#define STATUS_2_BG 0xef -+#define STATUS_3_FG 0x0f -+#define STATUS_3_BG 0xef -+#define STATUS_4_FG 0xe3 -+#define STATUS_4_BG 0xef -+#define STATUS_5_FG 0xfb -+#define STATUS_5_BG 0xef -+#define TEXT_FG 0x0f -+#define TEXT_BG 0xe8 -+#define TITLE_FG 0x0f -+#define TITLE_BG 0xef + /* clang-format off */ + static const struct Color colors[] = { +- [C_DLG] = { .fg = TB_BLACK, .bg = TB_WHITE }, +- [C_ERROR] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_RED }, +- [C_ACTION] = { .fg = TB_BLACK, .bg = TB_WHITE }, +- [C_INPUT] = { .fg = TB_BLACK, .bg = TB_WHITE }, +- [C_INPUT_EDIT] = { .fg = TB_WHITE, .bg = TB_BLACK }, +- [C_LINENO] = { .fg = TB_BLACK, .bg = TB_CYAN }, +- [C_PROMPT] = { .fg = TB_YELLOW | TB_BOLD, +- .bg = TB_MAGENTA }, +- [C_SEARCH] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_GREEN }, +- [C_SEL] = { .fg = TB_BLACK, .bg = TB_WHITE }, +- [C_SHADOW] = { .fg = TB_BLACK, .bg = TB_BLACK | TB_BOLD}, +- [C_STATUS_1] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_BLUE }, +- [C_STATUS_2] = { .fg = TB_YELLOW | TB_BOLD, +- .bg = TB_BLUE }, +- [C_STATUS_3] = { .fg = TB_WHITE, .bg = TB_BLUE }, +- [C_STATUS_4] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_BLUE }, +- [C_STATUS_5] = { .fg = TB_WHITE, .bg = TB_BLUE }, +- [C_TEXT] = { .fg = TB_DEFAULT, .bg = TB_DEFAULT }, +- [C_TITLE] = { .fg = TB_BLACK, .bg = TB_WHITE }, ++ [C_DLG] = { .fg = 0xfb, .bg = 0xef }, ++ [C_ERROR] = { .fg = 0x0f, .bg = 0x58 }, ++ [C_ACTION] = { .fg = 0xfb, .bg = 0xef }, ++ [C_INPUT] = { .fg = 0x0f, .bg = 0xef }, ++ [C_INPUT_EDIT] = { .fg = 0xe8, .bg = 0xf7 }, ++ [C_LINENO] = { .fg = 0xfb, .bg = 0xec }, ++ [C_PROMPT] = { .fg = 0xe3, .bg = 0x7d }, ++ [C_SEARCH] = { .fg = 0x10, .bg = 0x24 }, ++ [C_SEL] = { .fg = 0xef, .bg = 0xfb }, ++ [C_SHADOW] = { .fg = 0x10, .bg = 0x10 }, ++ [C_STATUS_1] = { .fg = 0x0f, .bg = 0xef }, ++ [C_STATUS_2] = { .fg = 0xe3, .bg = 0xef }, ++ [C_STATUS_3] = { .fg = 0x0f, .bg = 0xef }, ++ [C_STATUS_4] = { .fg = 0xe3, .bg = 0xef }, ++ [C_STATUS_5] = { .fg = 0xfb, .bg = 0xef }, ++ [C_TEXT] = { .fg = 0x0f, .bg = 0xe8 }, ++ [C_TITLE] = { .fg = 0x0f, .bg = 0xef }, + }; + /* clang-format on */ - extern const int backup_fail; - extern const char* backup_suffix; diff --git a/sled.c b/sled.c -index 043d9169e..032f35d59 100644 +index 504bf7d20..0ce620d83 100644 --- a/sled.c +++ b/sled.c @@ -3210,6 +3210,7 @@ main_skip_backups: diff --git a/patch/light-theme.patch b/patch/light-theme.patch @@ -1,97 +1,69 @@ -From 36c366ef070b1df95f6f12a4333ab324b25e96eb Mon Sep 17 00:00:00 2001 +From be1314e35d0efb2ae94f012693f749eb6c69cbc3 Mon Sep 17 00:00:00 2001 From: Страхиња Радић <sr@strahinja.org> -Date: Thu Aug 8 10:04:21 2024 UTC +Date: Sat Sep 7 10:05:55 2024 UTC Subject: [PATCH] Set light theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- - config.def.h | 34+ 34- + config.def.h | 17+ 23- sled.c | 1+ 0- - 2 files changed, 35 insertions(+), 34 deletions(-) + 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/config.def.h b/config.def.h -index 39043fce0..36c366ef0 100644 +index 504bf7d20..be1314e35 100644 --- a/config.def.h +++ b/config.def.h -@@ -2,40 +2,40 @@ - * any later version. Copyright (C) 2022-2024 Страхиња Радић. - * See the file LICENSE for exact copyright and license details. */ +@@ -4,29 +4,23 @@ --#define DLG_FG TB_BLACK --#define DLG_BG TB_WHITE --#define ERROR_FG TB_WHITE | TB_BOLD --#define ERROR_BG TB_RED --#define ACTION_FG TB_BLACK --#define ACTION_BG TB_WHITE --#define INPUT_FG TB_BLACK --#define INPUT_BG TB_WHITE --#define INPUT_EDIT_FG TB_WHITE --#define INPUT_EDIT_BG TB_BLACK --#define LINENO_FG TB_BLACK --#define LINENO_BG TB_CYAN --#define PROMPT_FG TB_YELLOW | TB_BOLD --#define PROMPT_BG TB_MAGENTA --#define SEARCH_FG TB_WHITE | TB_BOLD --#define SEARCH_BG TB_GREEN --#define SEL_FG TB_BLACK --#define SEL_BG TB_WHITE --#define SHADOW_FG TB_BLACK --#define SHADOW_BG TB_BLACK | TB_BOLD --#define STATUS_1_FG TB_WHITE | TB_BOLD --#define STATUS_1_BG TB_BLUE --#define STATUS_2_FG TB_YELLOW | TB_BOLD --#define STATUS_2_BG TB_BLUE --#define STATUS_3_FG TB_WHITE --#define STATUS_3_BG TB_BLUE --#define STATUS_4_FG TB_WHITE | TB_BOLD --#define STATUS_4_BG TB_BLUE --#define STATUS_5_FG TB_WHITE --#define STATUS_5_BG TB_BLUE --#define TEXT_FG TB_DEFAULT --#define TEXT_BG TB_DEFAULT --#define TITLE_FG TB_BLACK --#define TITLE_BG TB_WHITE -+#define DLG_FG 0x10 -+#define DLG_BG 0x2d -+#define ERROR_FG 0xbe -+#define ERROR_BG 0xa0 -+#define ACTION_FG 0x07 -+#define ACTION_BG 0x2d -+#define INPUT_FG 0x10 -+#define INPUT_BG 0x2d -+#define INPUT_EDIT_FG 0x10 -+#define INPUT_EDIT_BG 0xe1 -+#define LINENO_FG 0x3f -+#define LINENO_BG 0x56 -+#define PROMPT_FG 0x10 -+#define PROMPT_BG 0xdc -+#define SEARCH_FG 0x10 -+#define SEARCH_BG 0x2a -+#define SEL_FG 0x5a -+#define SEL_BG 0x6f -+#define SHADOW_FG 0xf0 -+#define SHADOW_BG 0xf0 -+#define STATUS_1_FG 0xeb -+#define STATUS_1_BG 0x2d -+#define STATUS_2_FG 0x5d -+#define STATUS_2_BG 0x2d -+#define STATUS_3_FG 0xeb -+#define STATUS_3_BG 0x2d -+#define STATUS_4_FG 0x5d -+#define STATUS_4_BG 0x2d -+#define STATUS_5_FG 0x08 -+#define STATUS_5_BG 0x2d -+#define TEXT_FG 0xeb -+#define TEXT_BG 0xfe -+#define TITLE_FG 0x5d -+#define TITLE_BG 0x2d + /* clang-format off */ + static const struct Color colors[] = { +- [C_DLG] = { .fg = TB_BLACK, .bg = TB_WHITE }, +- [C_ERROR] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_RED }, +- [C_ACTION] = { .fg = TB_BLACK, .bg = TB_WHITE }, +- [C_INPUT] = { .fg = TB_BLACK, .bg = TB_WHITE }, +- [C_INPUT_EDIT] = { .fg = TB_WHITE, .bg = TB_BLACK }, +- [C_LINENO] = { .fg = TB_BLACK, .bg = TB_CYAN }, +- [C_PROMPT] = { .fg = TB_YELLOW | TB_BOLD, +- .bg = TB_MAGENTA }, +- [C_SEARCH] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_GREEN }, +- [C_SEL] = { .fg = TB_BLACK, .bg = TB_WHITE }, +- [C_SHADOW] = { .fg = TB_BLACK, .bg = TB_BLACK | TB_BOLD}, +- [C_STATUS_1] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_BLUE }, +- [C_STATUS_2] = { .fg = TB_YELLOW | TB_BOLD, +- .bg = TB_BLUE }, +- [C_STATUS_3] = { .fg = TB_WHITE, .bg = TB_BLUE }, +- [C_STATUS_4] = { .fg = TB_WHITE | TB_BOLD, +- .bg = TB_BLUE }, +- [C_STATUS_5] = { .fg = TB_WHITE, .bg = TB_BLUE }, +- [C_TEXT] = { .fg = TB_DEFAULT, .bg = TB_DEFAULT }, +- [C_TITLE] = { .fg = TB_BLACK, .bg = TB_WHITE }, ++ [C_DLG] = { .fg = 0x10, .bg = 0x2d }, ++ [C_ERROR] = { .fg = 0xbe, .bg = 0xa0 }, ++ [C_ACTION] = { .fg = 0x07, .bg = 0x2d }, ++ [C_INPUT] = { .fg = 0x10, .bg = 0x2d }, ++ [C_INPUT_EDIT] = { .fg = 0x10, .bg = 0xe1 }, ++ [C_LINENO] = { .fg = 0x3f, .bg = 0x56 }, ++ [C_PROMPT] = { .fg = 0x10, .bg = 0xdc }, ++ [C_SEARCH] = { .fg = 0x10, .bg = 0x2a }, ++ [C_SEL] = { .fg = 0x5a, .bg = 0x6f }, ++ [C_SHADOW] = { .fg = 0xf0, .bg = 0xf0 }, ++ [C_STATUS_1] = { .fg = 0xeb, .bg = 0x2d }, ++ [C_STATUS_2] = { .fg = 0x5d, .bg = 0x2d }, ++ [C_STATUS_3] = { .fg = 0xeb, .bg = 0x2d }, ++ [C_STATUS_4] = { .fg = 0x5d, .bg = 0x2d }, ++ [C_STATUS_5] = { .fg = 0x08, .bg = 0x2d }, ++ [C_TEXT] = { .fg = 0xeb, .bg = 0xfe }, ++ [C_TITLE] = { .fg = 0x5d, .bg = 0x2d }, + }; + /* clang-format on */ - extern const int backup_fail; - extern const char* backup_suffix; diff --git a/sled.c b/sled.c -index 39043fce0..36c366ef0 100644 +index 504bf7d20..be1314e35 100644 --- a/sled.c +++ b/sled.c @@ -3210,6 +3210,7 @@ main_skip_backups: diff --git a/patch/syntax.patch b/patch/syntax.patch @@ -1,6 +1,6 @@ -From 719547d874c3e54c78812730aa48971c58d5055e Mon Sep 17 00:00:00 2001 +From 4673c3e20138dd0ded6c3edf95c47cedd6987b7f Mon Sep 17 00:00:00 2001 From: Страхиња Радић <sr@strahinja.org> -Date: Fri Aug 9 10:10:56 2024 UTC +Date: Sat Sep 7 10:20:17 2024 UTC Subject: [PATCH] Add syntax highlighting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -8,31 +8,31 @@ Content-Transfer-Encoding: 8bit --- config.def.h | 7+ 0- - draw.c | 668+ 34- - draw.h | 82+ 6- + draw.c | 663+ 30- + draw.h | 77+ 6- sled.c | 82+ 16- - 4 files changed, 839 insertions(+), 56 deletions(-) + 4 files changed, 829 insertions(+), 52 deletions(-) diff --git a/config.def.h b/config.def.h -index 91cb8cdd8..719547d87 100644 +index 504bf7d20..4673c3e20 100644 --- a/config.def.h +++ b/config.def.h -@@ -239,6 +239,13 @@ static const struct Key command_keys[] = { +@@ -232,6 +232,13 @@ static const struct Key command_keys[] = { #endif /* SLED_C_GLOBALS */ /* clang-format off */ +static const struct Color syntax_colors[] = { -+ [SE_DEFAULT] = { .fg = TEXT_FG, .bg = TEXT_BG }, -+ [SE_COMMENT] = { .fg = TB_GREEN, .bg = TEXT_BG }, -+ [SE_KEYWORD] = { .fg = TB_CYAN | TB_BOLD, .bg = TEXT_BG }, -+ [SE_OPERATOR] = { .fg = TB_YELLOW | TB_BOLD, .bg = TEXT_BG }, -+ [SE_LITERAL] = { .fg = TB_MAGENTA | TB_BOLD, .bg = TEXT_BG }, ++ [SE_DEFAULT] = { .fg = TB_DEFAULT, .bg = TB_DEFAULT }, ++ [SE_COMMENT] = { .fg = TB_GREEN, .bg = TB_DEFAULT }, ++ [SE_KEYWORD] = { .fg = TB_CYAN | TB_BOLD, .bg = TB_DEFAULT }, ++ [SE_OPERATOR] = { .fg = TB_YELLOW | TB_BOLD, .bg = TB_DEFAULT }, ++ [SE_LITERAL] = { .fg = TB_MAGENTA | TB_BOLD, .bg = TB_DEFAULT }, +}; static const struct StatusSegment status_segments[] = { - {.format = "%s%s", - .callback = format_filename, + {.format = "%s%s", + .callback = format_filename, diff --git a/draw.c b/draw.c -index 91cb8cdd8..719547d87 100644 +index 504bf7d20..4673c3e20 100644 --- a/draw.c +++ b/draw.c @@ -3,6 +3,7 @@ @@ -212,109 +212,104 @@ index 91cb8cdd8..719547d87 100644 void get_selection(int* ssr, int* ssc, int* ser, int* sec, const struct DrawState* state); -@@ -265,15 +414,15 @@ draw_help(const struct DrawState* state) - endy = h > maxy - 1 ? maxy - 2 : starty + h; +@@ -269,14 +418,14 @@ draw_help(const struct DrawState* state) - draw_box(startx, endx, starty, endy, DLG_FG, DLG_BG); -- if (draw_string(startx, starty, TITLE_FG, TITLE_BG, help_title, -+ if (draw_string(startx, starty, TITLE_FG, TITLE_BG, help_title, NULL, 0, - strlen(help_title) + 2, w, 1, 1, CENTER, 0, 0, NULL, 0, 0, - 0, 0, 0, 0)) + draw_box(startx, endx, starty, endy, colors[C_DLG].fg, colors[C_DLG].bg); + if (draw_string(startx, starty, colors[C_TITLE].fg, colors[C_TITLE].bg, +- help_title, strlen(help_title) + 2, w, 1, 1, CENTER, 0, 0, +- NULL, 0, 0, 0, 0, 0, 0)) ++ help_title, NULL, 0, strlen(help_title) + 2, w, 1, 1, ++ CENTER, 0, 0, NULL, 0, 0, 0, 0, 0, 0)) return 1; while ((size_t)row < LEN(help)) { - if (draw_string(startx + 1, starty + 1 + row, DLG_FG, DLG_BG, -- help[row], w - 2, w - 2, 1, 1, LEFT, 0, 1, NULL, 0, -- 0, 0, 0, 0, 0)) -+ help[row], NULL, 0, w - 2, w - 2, 1, 1, LEFT, 0, 1, -+ NULL, 0, 0, 0, 0, 0, 0)) + if (draw_string(startx + 1, starty + 1 + row, colors[C_DLG].fg, +- colors[C_DLG].bg, help[row], w - 2, w - 2, 1, 1, +- LEFT, 0, 1, NULL, 0, 0, 0, 0, 0, 0)) ++ colors[C_DLG].bg, help[row], NULL, 0, w - 2, w - 2, ++ 1, 1, LEFT, 0, 1, NULL, 0, 0, 0, 0, 0, 0)) return 1; row++; } -@@ -308,15 +457,16 @@ draw_input_dialog(const struct DrawState* state) - INPUT_EDIT_BG); +@@ -312,16 +461,16 @@ draw_input_dialog(const struct DrawState* state) + colors[C_INPUT_EDIT].fg, colors[C_INPUT_EDIT].bg); if (state->input_title) - if (draw_string(startx, starty, TITLE_FG, TITLE_BG, -- state->input_title, strlen(state->input_title) + 2, -- w, 1, 1, CENTER, 0, 0, NULL, 0, 0, 0, 0, 0, 0)) -+ state->input_title, NULL, 0, -+ strlen(state->input_title) + 2, w, 1, 1, CENTER, 0, -+ 0, NULL, 0, 0, 0, 0, 0, 0)) + if (draw_string(startx, starty, colors[C_TITLE].fg, +- colors[C_TITLE].bg, state->input_title, ++ colors[C_TITLE].bg, state->input_title, NULL, 0, + strlen(state->input_title) + 2, w, 1, 1, CENTER, 0, + 0, NULL, 0, 0, 0, 0, 0, 0)) return 1; dlen = display_length(state->input, len); if (dlen > state->input_first_shown_column) - u32_draw_string(startx + 1, starty + 1, INPUT_EDIT_FG, -- INPUT_EDIT_BG, state->input, w - 2, w - 2, 1, 1, LEFT, -- state->input_first_shown_column, 1, NULL, 0, 0, 0, 0, 0, -- 0); -+ INPUT_EDIT_BG, state->input, NULL, 0, w - 2, w - 2, 1, -+ 1, LEFT, state->input_first_shown_column, 1, NULL, 0, 0, -+ 0, 0, 0, 0); + u32_draw_string(startx + 1, starty + 1, colors[C_INPUT_EDIT].fg, +- colors[C_INPUT_EDIT].bg, state->input, w - 2, w - 2, 1, +- 1, LEFT, state->input_first_shown_column, 1, NULL, 0, 0, +- 0, 0, 0, 0); ++ colors[C_INPUT_EDIT].bg, state->input, NULL, 0, w - 2, ++ w - 2, 1, 1, LEFT, state->input_first_shown_column, 1, ++ NULL, 0, 0, 0, 0, 0, 0); tb_set_cursor(startx + 2 + state->input_display_column - state->input_first_shown_column, starty + 1); -@@ -337,7 +487,7 @@ draw_line_number(const struct DrawState* state, const - pnumbuf = numbuf_end - numbuf > state->line_numbers_width +@@ -343,7 +492,7 @@ draw_line_number(const struct DrawState* state, const ? numbuf_end - state->line_numbers_width : numbuf; -- draw_string(0, cy, LINENO_FG, LINENO_BG, pnumbuf, -+ draw_string(0, cy, LINENO_FG, LINENO_BG, pnumbuf, NULL, 0, - numbuf_end - numbuf + 1, state->line_numbers_width, 0, - 0, RIGHT, 0, 1, NULL, 0, 0, 0, 0, 0, 0); + draw_string(0, cy, colors[C_LINENO].fg, colors[C_LINENO].bg, +- pnumbuf, numbuf_end - numbuf + 1, ++ pnumbuf, NULL, 0, numbuf_end - numbuf + 1, + state->line_numbers_width, 0, 0, RIGHT, 0, 1, NULL, 0, + 0, 0, 0, 0, 0); } -@@ -417,9 +567,10 @@ draw_screen(const struct DrawState* state) - u32_draw_string(state->line_numbers +@@ -424,8 +573,9 @@ draw_screen(const struct DrawState* state) ? state->line_numbers_width + 2 : 0, -- cy, TEXT_FG, TEXT_BG, current->text, maxx, maxx, -- 0, 0, LEFT, fsc, 0, state->search, SEARCH_FG, -- SEARCH_BG, ssi, sei, SEL_FG, SEL_BG); -+ cy, TEXT_FG, TEXT_BG, current->text, -+ current->syntax, current->syntax_size, maxx, -+ maxx, 0, 0, LEFT, fsc, 0, state->search, -+ SEARCH_FG, SEARCH_BG, ssi, sei, SEL_FG, SEL_BG); + cy, colors[C_TEXT].fg, colors[C_TEXT].bg, +- current->text, maxx, maxx, 0, 0, LEFT, fsc, 0, +- state->search, colors[C_SEARCH].fg, ++ current->text, current->syntax, ++ current->syntax_size, maxx, maxx, 0, 0, LEFT, ++ fsc, 0, state->search, colors[C_SEARCH].fg, + colors[C_SEARCH].bg, ssi, sei, colors[C_SEL].fg, + colors[C_SEL].bg); i++; - cy++; - } -@@ -449,22 +600,22 @@ draw_status(const struct DrawState* state) +@@ -457,7 +607,7 @@ draw_status(const struct DrawState* state) if (IN(state->mode, M_PROMPT) && *state->prompt) { - if (draw_string(0, state->maxy - 1, PROMPT_FG, PROMPT_BG, -- state->prompt, strlen(state->prompt) + 2, maxx, 1, -- 1, CENTER, 0, 1, NULL, 0, 0, 0, 0, 0, 0)) -+ state->prompt, NULL, 0, strlen(state->prompt) + 2, -+ maxx, 1, 1, CENTER, 0, 1, NULL, 0, 0, 0, 0, 0, 0)) + if (draw_string(0, state->maxy - 1, colors[C_PROMPT].fg, +- colors[C_PROMPT].bg, state->prompt, ++ colors[C_PROMPT].bg, state->prompt, NULL, 0, + strlen(state->prompt) + 2, maxx, 1, 1, CENTER, 0, 1, + NULL, 0, 0, 0, 0, 0, 0)) return 1; - } +@@ -465,7 +615,7 @@ draw_status(const struct DrawState* state) else if (state->action && *state->action) { - if (draw_string(0, state->maxy - 1, ACTION_FG, ACTION_BG, -- state->action, strlen(state->action) + 2, maxx, 1, -- 1, CENTER, 0, 1, NULL, 0, 0, 0, 0, 0, 0)) -+ state->action, NULL, 0, strlen(state->action) + 2, -+ maxx, 1, 1, CENTER, 0, 1, NULL, 0, 0, 0, 0, 0, 0)) + if (draw_string(0, state->maxy - 1, colors[C_ACTION].fg, +- colors[C_ACTION].bg, state->action, ++ colors[C_ACTION].bg, state->action, NULL, 0, + strlen(state->action) + 2, maxx, 1, 1, CENTER, 0, 1, + NULL, 0, 0, 0, 0, 0, 0)) return 1; - } +@@ -473,7 +623,7 @@ draw_status(const struct DrawState* state) else if (state->error && *state->error) { - if (draw_string(0, state->maxy - 1, ERROR_FG, ERROR_BG, -- state->error, strlen(state->error) + 2, maxx, 1, 1, -- CENTER, 0, 1, NULL, 0, 0, 0, 0, 0, 0)) -+ state->error, NULL, 0, strlen(state->error) + 2, -+ maxx, 1, 1, CENTER, 0, 1, NULL, 0, 0, 0, 0, 0, 0)) + if (draw_string(0, state->maxy - 1, colors[C_ERROR].fg, +- colors[C_ERROR].bg, state->error, ++ colors[C_ERROR].bg, state->error, NULL, 0, + strlen(state->error) + 2, maxx, 1, 1, CENTER, 0, 1, + NULL, 0, 0, 0, 0, 0, 0)) return 1; - } - else -@@ -487,7 +638,7 @@ draw_status(const struct DrawState* state) - if (pseg == status_segments + LEN(status_segments) - 1) +@@ -499,7 +649,7 @@ draw_status(const struct DrawState* state) seg_size = maxx - 1 - current_start; if (draw_string(current_start, state->maxy - 1, -- pseg->fg, pseg->bg, buf, -+ pseg->fg, pseg->bg, buf, NULL, 0, + colors[pseg->color_index].fg, +- colors[pseg->color_index].bg, buf, ++ colors[pseg->color_index].bg, buf, NULL, 0, MIN(seg_size, (ssize_t)(strlen(buf) + 2)), last ? seg_size + 1 : seg_size, 1, 1, pseg->alignment, 0, 1, NULL, 0, 0, 0, 0, 0, -@@ -522,8 +673,9 @@ draw_status(const struct DrawState* state) +@@ -534,8 +684,9 @@ draw_status(const struct DrawState* state) * */ int draw_string(const int x, const int y, const uint16_t fg, const uint16_t bg, @@ -326,7 +321,7 @@ index 91cb8cdd8..719547d87 100644 const uint32_t* srch, const uint16_t sfg, const uint16_t sbg, const int ssi, const int sei, const uint16_t slfg, const uint16_t slbg) { -@@ -533,8 +685,8 @@ draw_string(const int x, const int y, const uint16_t f +@@ -545,8 +696,8 @@ draw_string(const int x, const int y, const uint16_t f if (!us) return 1; u8_string_to_unicode(us, s, mc); @@ -337,7 +332,7 @@ index 91cb8cdd8..719547d87 100644 free(us); return 0; } -@@ -639,14 +791,41 @@ free_bufferline(struct BufferLine* bl) +@@ -651,14 +802,41 @@ free_bufferline(struct BufferLine* bl) bl->length = 0; bl->fg = 0; bl->bg = 0; @@ -379,7 +374,7 @@ index 91cb8cdd8..719547d87 100644 for (row = 0; row < state->buffer_size; row++) free_bufferline(state->buffer + row); free(state->buffer); -@@ -672,11 +851,13 @@ init_bufferline(struct BufferLine* bl) +@@ -684,11 +862,13 @@ init_bufferline(struct BufferLine* bl) { if (!bl) return; @@ -398,7 +393,7 @@ index 91cb8cdd8..719547d87 100644 } void -@@ -702,6 +883,14 @@ init_drawstate(struct DrawState* state, char* error, c +@@ -714,6 +894,14 @@ init_drawstate(struct DrawState* state, char* error, c state->orig_real_filename = NULL; state->backup_filename = NULL; state->rfn_len = 0; @@ -413,7 +408,7 @@ index 91cb8cdd8..719547d87 100644 } state->input = NULL; state->search = NULL; -@@ -760,7 +949,429 @@ recalculate_size(struct DrawState* state) +@@ -772,7 +960,429 @@ recalculate_size(struct DrawState* state) recalculate_line_numbers(state); } @@ -843,7 +838,7 @@ index 91cb8cdd8..719547d87 100644 redraw_status(struct DrawState* state) { assert(state != NULL); -@@ -791,7 +1402,8 @@ redraw_status(struct DrawState* state) +@@ -803,7 +1413,8 @@ redraw_status(struct DrawState* state) * */ void u32_draw_string(const int x, const int y, const uint16_t fg, const uint16_t bg, @@ -853,7 +848,7 @@ index 91cb8cdd8..719547d87 100644 const int p_r, const Alignment align, const int ds, const int fill, const uint32_t* srch, const uint16_t sfg, const uint16_t sbg, const int ssi, const int sei, const uint16_t slfg, const uint16_t slbg) -@@ -829,6 +1441,8 @@ u32_draw_string(const int x, const int y, const uint16 +@@ -841,6 +1452,8 @@ u32_draw_string(const int x, const int y, const uint16 int w = 0; /* actual on-screen rune width */ @@ -862,7 +857,7 @@ index 91cb8cdd8..719547d87 100644 const int ts = TAB_SIZE; const uint32_t* ps = s; /* pointer to current character in -@@ -837,11 +1451,23 @@ u32_draw_string(const int x, const int y, const uint16 +@@ -849,11 +1462,23 @@ u32_draw_string(const int x, const int y, const uint16 uint16_t cfg = fg; /* current fg */ uint16_t cbg = bg; /* current bg */ @@ -886,7 +881,7 @@ index 91cb8cdd8..719547d87 100644 c = mc - p_l - p_r; if (align == LEFT) -@@ -873,7 +1499,12 @@ u32_draw_string(const int x, const int y, const uint16 +@@ -885,7 +1510,12 @@ u32_draw_string(const int x, const int y, const uint16 */ while (*ps && sc < c) { @@ -900,7 +895,7 @@ index 91cb8cdd8..719547d87 100644 { cfg = slfg; cbg = slbg; -@@ -890,6 +1521,9 @@ u32_draw_string(const int x, const int y, const uint16 +@@ -902,6 +1532,9 @@ u32_draw_string(const int x, const int y, const uint16 } } @@ -910,7 +905,7 @@ index 91cb8cdd8..719547d87 100644 if (*ps == '\t') { if (ssc < ds) -@@ -1005,11 +1639,11 @@ u32_draw_string(const int x, const int y, const uint16 +@@ -1017,11 +1650,11 @@ u32_draw_string(const int x, const int y, const uint16 } ssc += w; } @@ -927,7 +922,7 @@ index 91cb8cdd8..719547d87 100644 } diff --git a/draw.h b/draw.h -index 91cb8cdd8..719547d87 100644 +index 504bf7d20..4673c3e20 100644 --- a/draw.h +++ b/draw.h @@ -1,6 +1,7 @@ @@ -938,9 +933,9 @@ index 91cb8cdd8..719547d87 100644 #include <stddef.h> #include <sys/types.h> #include <termios.h> -@@ -37,17 +38,74 @@ enum { - - typedef enum { LEFT, CENTER, RIGHT } Alignment; +@@ -62,17 +63,69 @@ struct Color { + uint16_t bg; + }; +typedef enum { FT_GENERIC, FT_C, FT_SHELL } FileType; + @@ -991,11 +986,6 @@ index 91cb8cdd8..719547d87 100644 int row; }; -+struct Color { -+ uint16_t fg; -+ uint16_t bg; -+}; -+ +struct SyntaxRegion { + ssize_t start; + ssize_t length; @@ -1013,7 +1003,7 @@ index 91cb8cdd8..719547d87 100644 }; struct DrawState { -@@ -87,12 +145,20 @@ struct DrawState { +@@ -112,12 +165,20 @@ struct DrawState { int dirty; int new_file; int recalculate_size; @@ -1034,7 +1024,7 @@ index 91cb8cdd8..719547d87 100644 }; struct Key { -@@ -109,6 +175,13 @@ struct StatusSegment { +@@ -133,6 +194,13 @@ struct StatusSegment { Alignment alignment; }; @@ -1048,7 +1038,7 @@ index 91cb8cdd8..719547d87 100644 void assign_coord(struct Coord* dest, const struct Coord src); ssize_t buffer_length(uint32_t* buffer, const ssize_t max_index); int calculate_help_width(const struct DrawState* state); -@@ -125,7 +198,8 @@ void draw_rect(const int startx, const int endx, const +@@ -149,7 +217,8 @@ void draw_rect(const int startx, const int endx, const int draw_screen(const struct DrawState* state); int draw_status(const struct DrawState* state); int draw_string(const int x, const int y, const uint16_t fg, const uint16_t bg, @@ -1058,7 +1048,7 @@ index 91cb8cdd8..719547d87 100644 const int padding_left, const int padding_right, const Alignment align, const int ds, const int fill, const uint32_t* srch, const uint16_t sfg, const uint16_t sbg, const int ssi, const int sei, const uint16_t slfg, -@@ -148,10 +222,12 @@ void init_drawstate(struct DrawState* state, char* err +@@ -172,10 +241,12 @@ void init_drawstate(struct DrawState* state, char* err const int skip_filenames_init); void recalculate_line_numbers(struct DrawState* state); void recalculate_size(struct DrawState* state); @@ -1077,7 +1067,7 @@ index 91cb8cdd8..719547d87 100644 + const uint16_t sbg, const int ssi, const int sei, const uint16_t slfg, + const uint16_t slbg); diff --git a/sled.c b/sled.c -index 91cb8cdd8..719547d87 100644 +index 504bf7d20..4673c3e20 100644 --- a/sled.c +++ b/sled.c @@ -67,6 +67,18 @@ extern const char* prompt_reread_dirty;