summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-10-15 15:23:58 -0400
committerpommicket <pommicket@gmail.com>2023-10-15 15:23:58 -0400
commita01d4de1e2feda34a20bb8dd65ec76fef3c20d6b (patch)
treec24f71d8536663d6758a14194b50508041cc03ec /buffer.c
parent479219152b85b2cf12e5bfee6fdebca033355beb (diff)
use reference-counted strings for string settings
this lets us remove the length limitations which were previously imposed
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/buffer.c b/buffer.c
index 35330ec..56f0447 100644
--- a/buffer.c
+++ b/buffer.c
@@ -3834,7 +3834,7 @@ void buffer_dedent_cursor_line(TextBuffer *buffer) {
void buffer_comment_lines(TextBuffer *buffer, u32 first_line, u32 last_line) {
const Settings *settings = buffer_settings(buffer);
- const char *start = settings->comment_start, *end = settings->comment_end;
+ const char *start = rc_str(settings->comment_start, ""), *end = rc_str(settings->comment_end, "");
if (!start[0] && !end[0])
return;
String32 start32 = str32_from_utf8(start), end32 = str32_from_utf8(end);
@@ -3889,7 +3889,7 @@ static bool buffer_line_ends_with_ascii(TextBuffer *buffer, u32 line_idx, const
void buffer_uncomment_lines(TextBuffer *buffer, u32 first_line, u32 last_line) {
const Settings *settings = buffer_settings(buffer);
- const char *start = settings->comment_start, *end = settings->comment_end;
+ const char *start = rc_str(settings->comment_start, ""), *end = rc_str(settings->comment_end, "");
if (!start[0] && !end[0])
return;
u32 start_len = (u32)strlen(start), end_len = (u32)strlen(end);
@@ -3913,7 +3913,7 @@ void buffer_uncomment_lines(TextBuffer *buffer, u32 first_line, u32 last_line) {
void buffer_toggle_comment_lines(TextBuffer *buffer, u32 first_line, u32 last_line) {
const Settings *settings = buffer_settings(buffer);
- const char *start = settings->comment_start, *end = settings->comment_end;
+ const char *start = rc_str(settings->comment_start, ""), *end = rc_str(settings->comment_end, "");
if (!start[0] && !end[0])
return;
// if first line is a comment, uncomment lines, otherwise, comment lines