sled

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

чување aa89a7ee1e1a041687f8f693044eef82cbb3baf6
родитељ 48d828e53c6ccf3ba27de89d727fb9633273277e
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Wed, 28 Jan 2026 14:57:22 +0100

Update patches

Diffstat:
Mpatch/bw-theme.patch | 6+++---
Mpatch/dark-theme.patch | 19+++++++++----------
Mpatch/light-theme.patch | 19++++++++++---------
Mpatch/syntax.patch | 79+++++++++++++++++++++++++++++++++++++++++--------------------------------------
измењених датотека: 4, додавања: 63(+), брисања: 60(-)

diff --git a/patch/bw-theme.patch b/patch/bw-theme.patch @@ -1,6 +1,6 @@ -From 364246b5b0e7c37a3b2c0550d67605c632d72a59 Mon Sep 17 00:00:00 2001 +From 14e8e9e18cf545b4698b0649386e9b5e923b035e Mon Sep 17 00:00:00 2001 From: Страхиња Радић <sr@strahinja.org> -Date: Sat Nov 2 08:45:40 2024 UTC +Date: Wed Jan 28 13:44:55 2026 UTC Subject: [PATCH] Set black and white theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -11,7 +11,7 @@ Content-Transfer-Encoding: 8bit 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/config.def.h b/config.def.h -index c012a668f..364246b5b 100644 +index 43bc368c3..14e8e9e18 100644 --- a/config.def.h +++ b/config.def.h @@ -6,25 +6,22 @@ diff --git a/patch/dark-theme.patch b/patch/dark-theme.patch @@ -1,18 +1,16 @@ -From 5c3865687fa0debec6192bd58a69d01f969254fb Mon Sep 17 00:00:00 2001 +From 0b440ab77adc80bffe3f70db95461ca1fc139a2e Mon Sep 17 00:00:00 2001 From: Страхиња Радић <sr@strahinja.org> -Date: Sat Nov 2 08:45:04 2024 UTC +Date: Wed Jan 28 13:56:27 2026 UTC Subject: [PATCH] Set dark theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- - config.def.h | 17+ 23- - sled.c | 1+ 0- - 2 files changed, 18 insertions(+), 23 deletions(-) + diff --git a/config.def.h b/config.def.h -index c012a668f..5c3865687 100644 +index ed73e7fdd..0b440ab77 100644 --- a/config.def.h +++ b/config.def.h @@ -4,29 +4,23 @@ @@ -63,14 +61,15 @@ index c012a668f..5c3865687 100644 /* clang-format on */ diff --git a/sled.c b/sled.c -index c012a668f..5c3865687 100644 +index ed73e7fdd..0b440ab77 100644 --- a/sled.c +++ b/sled.c -@@ -3122,6 +3122,7 @@ main_skip_backups: - init_termbox: - if (tb_init()) +@@ -3196,6 +3196,8 @@ init_termbox: goto main_done; + } + + tb_set_output_mode(TB_OUTPUT_256); ++ errno = 0; state.maxx = 0; state.recalculate_size = 1; diff --git a/patch/light-theme.patch b/patch/light-theme.patch @@ -1,6 +1,6 @@ -From f564d4fb92d6daee7cbafed3fd19776ac1c5a764 Mon Sep 17 00:00:00 2001 +From d6a839b7924bf7c019415ee0cf7fd9810f4b7c51 Mon Sep 17 00:00:00 2001 From: Страхиња Радић <sr@strahinja.org> -Date: Sat Nov 2 08:44:22 2024 UTC +Date: Wed Jan 28 13:49:52 2026 UTC Subject: [PATCH] Set light theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -8,11 +8,11 @@ Content-Transfer-Encoding: 8bit --- config.def.h | 17+ 23- - sled.c | 1+ 0- - 2 files changed, 18 insertions(+), 23 deletions(-) + sled.c | 2+ 0- + 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/config.def.h b/config.def.h -index c012a668f..f564d4fb9 100644 +index 0c976b588..d6a839b79 100644 --- a/config.def.h +++ b/config.def.h @@ -4,29 +4,23 @@ @@ -63,14 +63,15 @@ index c012a668f..f564d4fb9 100644 /* clang-format on */ diff --git a/sled.c b/sled.c -index c012a668f..f564d4fb9 100644 +index 0c976b588..d6a839b79 100644 --- a/sled.c +++ b/sled.c -@@ -3122,6 +3122,7 @@ main_skip_backups: - init_termbox: - if (tb_init()) +@@ -3196,6 +3196,8 @@ init_termbox: goto main_done; + } + + tb_set_output_mode(TB_OUTPUT_256); ++ errno = 0; state.maxx = 0; state.recalculate_size = 1; diff --git a/patch/syntax.patch b/patch/syntax.patch @@ -1,6 +1,6 @@ -From 37ca32661192c22cd2a68abe93a27333802f8e4e Mon Sep 17 00:00:00 2001 +From 712442a40714cc79c0a198f849a1ca1ecd860b42 Mon Sep 17 00:00:00 2001 From: Страхиња Радић <sr@strahinja.org> -Date: Wed Dec 31 09:17:44 2025 UTC +Date: Wed Jan 28 13:39:33 2026 UTC Subject: [PATCH] Add syntax highlighting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -10,11 +10,11 @@ Content-Transfer-Encoding: 8bit config.def.h | 7+ 0- draw.c | 618+ 31- draw.h | 76+ 6- - sled.c | 82+ 15- - 4 files changed, 783 insertions(+), 52 deletions(-) + sled.c | 84+ 16- + 4 files changed, 785 insertions(+), 53 deletions(-) diff --git a/config.def.h b/config.def.h -index ef9e7169a..37ca32661 100644 +index 48d828e53..712442a40 100644 --- a/config.def.h +++ b/config.def.h @@ -234,6 +234,13 @@ static const struct Key command_keys[] = { @@ -32,7 +32,7 @@ index ef9e7169a..37ca32661 100644 {.format = "%s%s", .callback = format_filename, diff --git a/draw.c b/draw.c -index ef9e7169a..37ca32661 100644 +index 48d828e53..712442a40 100644 --- a/draw.c +++ b/draw.c @@ -3,6 +3,7 @@ @@ -69,7 +69,7 @@ index ef9e7169a..37ca32661 100644 enum { UNKNOWN_MODE, COMMAND_MODE, -@@ -87,6 +107,95 @@ static const struct { +@@ -89,6 +109,95 @@ static const struct { { .boundary = 99, .width = 3 }, { .boundary = 9, .width = 2 } }; @@ -165,7 +165,7 @@ index ef9e7169a..37ca32661 100644 const char* go_to_dialog_title = "Go to line"; const char* prompt_dirty = "File changed, save [y/n/ESC]?"; const char* prompt_overwrite = "Not empty, overwrite? [y/n/ESC]?"; -@@ -95,6 +204,46 @@ const char* replace_dialog_title = "Replace with"; +@@ -97,6 +206,46 @@ const char* replace_dialog_title = "Replace with"; const char* search_dialog_title = "Search text"; /* clang-format on */ @@ -212,7 +212,7 @@ index ef9e7169a..37ca32661 100644 void get_selection(int* ssr, int* ssc, int* ser, int* sec, const struct DrawState* state); -@@ -268,14 +417,14 @@ draw_help(const struct DrawState* state) +@@ -270,14 +419,14 @@ draw_help(const struct DrawState* state) 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, @@ -231,7 +231,7 @@ index ef9e7169a..37ca32661 100644 return 1; row++; } -@@ -311,16 +460,16 @@ draw_input_dialog(const struct DrawState* state) +@@ -313,16 +462,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, colors[C_TITLE].fg, @@ -252,7 +252,7 @@ index ef9e7169a..37ca32661 100644 tb_set_cursor(startx + 2 + state->input_display_column - state->input_first_shown_column, starty + 1); -@@ -342,7 +491,7 @@ draw_line_number(const struct DrawState* state, const +@@ -344,7 +493,7 @@ draw_line_number(const struct DrawState* state, const ? numbuf_end - state->line_numbers_width : numbuf; draw_string(0, cy, colors[C_LINENO].fg, colors[C_LINENO].bg, @@ -261,7 +261,7 @@ index ef9e7169a..37ca32661 100644 state->line_numbers_width, 0, 0, RIGHT, 0, 1, NULL, 0, 0, 0, 0, 0, 0); } -@@ -423,8 +572,9 @@ draw_screen(const struct DrawState* state) +@@ -425,8 +574,9 @@ draw_screen(const struct DrawState* state) ? state->line_numbers_width + 2 : 0, cy, colors[C_TEXT].fg, colors[C_TEXT].bg, @@ -273,7 +273,7 @@ index ef9e7169a..37ca32661 100644 colors[C_SEARCH].bg, ssi, sei, colors[C_SEL].fg, colors[C_SEL].bg); i++; -@@ -456,7 +606,7 @@ draw_status(const struct DrawState* state) +@@ -458,7 +608,7 @@ draw_status(const struct DrawState* state) if (IN(state->mode, M_PROMPT) && *state->prompt) { if (draw_string(0, state->maxy - 1, colors[C_PROMPT].fg, @@ -282,7 +282,7 @@ index ef9e7169a..37ca32661 100644 strlen(state->prompt) + 2, maxx, 1, 1, CENTER, 0, 1, NULL, 0, 0, 0, 0, 0, 0)) return 1; -@@ -464,15 +614,15 @@ draw_status(const struct DrawState* state) +@@ -466,15 +616,15 @@ draw_status(const struct DrawState* state) else if (state->action) { if (draw_string(0, state->maxy - 1, colors[C_ACTION].fg, @@ -301,7 +301,7 @@ index ef9e7169a..37ca32661 100644 strlen(errors[state->error]) + 2, maxx, 1, 1, CENTER, 0, 1, NULL, 0, 0, 0, 0, 0, 0)) return 1; -@@ -498,7 +648,7 @@ draw_status(const struct DrawState* state) +@@ -500,7 +650,7 @@ draw_status(const struct DrawState* state) seg_size = maxx - 1 - current_start; if (draw_string(current_start, state->maxy - 1, colors[pseg->color_index].fg, @@ -310,7 +310,7 @@ index ef9e7169a..37ca32661 100644 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, -@@ -533,8 +683,9 @@ draw_status(const struct DrawState* state) +@@ -535,8 +685,9 @@ draw_status(const struct DrawState* state) * */ int draw_string(const int x, const int y, const uint16_t fg, const uint16_t bg, @@ -322,7 +322,7 @@ index ef9e7169a..37ca32661 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) { -@@ -544,8 +695,8 @@ draw_string(const int x, const int y, const uint16_t f +@@ -546,8 +697,8 @@ draw_string(const int x, const int y, const uint16_t f if (!us) return 1; u8_string_to_unicode(us, s, mc); @@ -333,7 +333,7 @@ index ef9e7169a..37ca32661 100644 free(us); return 0; } -@@ -651,12 +802,15 @@ free_bufferline(struct BufferLine* bl) +@@ -653,12 +804,15 @@ free_bufferline(struct BufferLine* bl) bl->length = 0; bl->fg = 0; bl->bg = 0; @@ -349,7 +349,7 @@ index ef9e7169a..37ca32661 100644 assert(state != NULL); for (row = 0; row < state->buffer_size; row++) free_bufferline(state->buffer + row); -@@ -670,11 +824,13 @@ init_bufferline(struct BufferLine* bl) +@@ -672,11 +826,13 @@ init_bufferline(struct BufferLine* bl) { if (!bl) return; @@ -368,7 +368,7 @@ index ef9e7169a..37ca32661 100644 } void -@@ -699,6 +855,14 @@ init_drawstate(struct DrawState* state, char* filename +@@ -701,6 +857,14 @@ init_drawstate(struct DrawState* state, char* filename state->orig_real_filename = NULL; state->backup_filename = NULL; state->rfn_len = 0; @@ -383,7 +383,7 @@ index ef9e7169a..37ca32661 100644 } state->input = NULL; state->search = NULL; -@@ -757,7 +921,407 @@ recalculate_size(struct DrawState* state) +@@ -759,7 +923,407 @@ recalculate_size(struct DrawState* state) recalculate_line_numbers(state); } @@ -791,7 +791,7 @@ index ef9e7169a..37ca32661 100644 redraw_status(struct DrawState* state) { assert(state != NULL); -@@ -788,7 +1352,8 @@ redraw_status(struct DrawState* state) +@@ -790,7 +1354,8 @@ redraw_status(struct DrawState* state) * */ void u32_draw_string(const int x, const int y, const uint16_t fg, const uint16_t bg, @@ -801,7 +801,7 @@ index ef9e7169a..37ca32661 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) -@@ -826,6 +1391,8 @@ u32_draw_string(const int x, const int y, const uint16 +@@ -828,6 +1393,8 @@ u32_draw_string(const int x, const int y, const uint16 int w = 0; /* actual on-screen rune width */ @@ -810,7 +810,7 @@ index ef9e7169a..37ca32661 100644 const int ts = TAB_SIZE; const uint32_t* ps = s; /* pointer to current character in -@@ -834,11 +1401,23 @@ u32_draw_string(const int x, const int y, const uint16 +@@ -836,11 +1403,23 @@ u32_draw_string(const int x, const int y, const uint16 uint16_t cfg = fg; /* current fg */ uint16_t cbg = bg; /* current bg */ @@ -834,7 +834,7 @@ index ef9e7169a..37ca32661 100644 c = mc - p_l - p_r; if (align == LEFT) -@@ -870,7 +1449,12 @@ u32_draw_string(const int x, const int y, const uint16 +@@ -872,7 +1451,12 @@ u32_draw_string(const int x, const int y, const uint16 */ while (*ps && sc < c) { @@ -848,7 +848,7 @@ index ef9e7169a..37ca32661 100644 { cfg = slfg; cbg = slbg; -@@ -887,6 +1471,9 @@ u32_draw_string(const int x, const int y, const uint16 +@@ -889,6 +1473,9 @@ u32_draw_string(const int x, const int y, const uint16 } } @@ -858,7 +858,7 @@ index ef9e7169a..37ca32661 100644 if (*ps == '\t') { if (ssc < ds) -@@ -1002,11 +1589,11 @@ u32_draw_string(const int x, const int y, const uint16 +@@ -1004,11 +1591,11 @@ u32_draw_string(const int x, const int y, const uint16 } ssc += w; } @@ -875,7 +875,7 @@ index ef9e7169a..37ca32661 100644 } diff --git a/draw.h b/draw.h -index ef9e7169a..37ca32661 100644 +index 48d828e53..712442a40 100644 --- a/draw.h +++ b/draw.h @@ -63,17 +63,69 @@ struct Color { @@ -1012,7 +1012,7 @@ index ef9e7169a..37ca32661 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 ef9e7169a..37ca32661 100644 +index 48d828e53..712442a40 100644 --- a/sled.c +++ b/sled.c @@ -50,6 +50,18 @@ extern const char* prompt_reread_dirty; @@ -1169,16 +1169,18 @@ index ef9e7169a..37ca32661 100644 return; simple_join_lines_error: -@@ -2868,6 +2893,8 @@ main(int argc, char** argv) - int dir_access; +@@ -2870,7 +2895,9 @@ main(int argc, char** argv) int dir_access_errno; int saved_errno; + int tbires; +- int optind = 1; ++ int optind = 1; + int found_ending = 0; + int i; *prompt = 0; -@@ -2950,6 +2977,40 @@ main(int argc, char** argv) +@@ -2977,6 +3004,40 @@ main_options_loop: init_drawstate(&state, filename, prompt, 0, 0); @@ -1219,21 +1221,22 @@ index ef9e7169a..37ca32661 100644 #ifdef __OpenBSD__ if (unveil(state.filename, "rwc") < 0) { -@@ -3158,9 +3219,10 @@ main_skip_backups: - init_termbox: - if (tb_init()) +@@ -3196,9 +3257,11 @@ init_termbox: goto main_done; + } + - errno = 0; - state.maxx = 0; - state.recalculate_size = 1; -+ errno = 0; -+ state.maxx = 0; ++ errno = 0; ++ state.maxx = 0; ++ state.recalculate_size = 1; + state.recalculate_size = 1; + state.recalculate_syntax = 1; while (state.running) { -@@ -3172,6 +3234,11 @@ init_termbox: +@@ -3210,6 +3273,11 @@ init_termbox: recalculate_size(&state); state.recalculate_size = 0; }