I tried just hacking it, and it works. The below is my git diff
.
I don't know what buf_len should be set to, so I just set it to 0 and didn't cause any problems.
All of the changes below would be surrounded by some if statement for the setting. Also, instead of setting allow_empty_lines = TRUE;
directly, that would be passed in as an arg.
The last step would be to add it is a preference to Edit=>Preferences=>Editor=>Features as a checkbox. I have no idea how to do that though, and will also have to create PO files (which is a lot of work).
diff --git a/src/editor.c b/src/editor.c
index 620248c4..8663ad90 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -3031,11 +3031,11 @@ gint editor_do_uncomment(GeanyEditor *editor, gint line, gboolean toggle)
buf_len = MIN((gint)sizeof(sel) - 1, line_len);
if (buf_len <= 0)
- continue;
+ buf_len = 0;
sci_get_text_range(editor->sci, line_start, line_start + buf_len, sel);
sel[buf_len] = '\0';
- while (isspace(sel[x])) x++;
+ //while (isspace(sel[x])) x++;
/* to skip blank lines */
if (x < line_len && sel[x] != '\0')
@@ -3140,8 +3140,8 @@ void editor_do_comment_toggle(GeanyEditor *editor)
return;
co_len = strlen(co);
- if (co_len == 0)
- return;
+ //if (co_len == 0)
+ // return;
sci_start_undo_action(editor->sci);
@@ -3155,11 +3155,11 @@ void editor_do_comment_toggle(GeanyEditor *editor)
buf_len = MIN((gint)sizeof(sel) - 1, line_len);
if (buf_len < 0)
- continue;
+ buf_len = 0;
sci_get_text_range(editor->sci, line_start, line_start + buf_len, sel);
sel[buf_len] = '\0';
- while (isspace(sel[x])) x++;
+ //while (isspace(sel[x])) x++;
/* use single line comment */
if (EMPTY(cc))
@@ -3310,9 +3310,9 @@ gint editor_do_comment(GeanyEditor *editor, gint line, gboolean allow_empty_line
if (! filetype_get_comment_open_close(ft, single_comment, &co, &cc))
return 0;
- co_len = strlen(co);
- if (co_len == 0)
- return 0;
+ //co_len = strlen(co);
+ //if (co_len == 0)
+ // return 0;
sci_start_undo_action(editor->sci);
@@ -3326,11 +3326,12 @@ gint editor_do_comment(GeanyEditor *editor, gint line, gboolean allow_empty_line
buf_len = MIN((gint)sizeof(sel) - 1, line_len);
if (buf_len < 0)
- continue;
+ buf_len = 0;
sci_get_text_range(editor->sci, line_start, line_start + buf_len, sel);
sel[buf_len] = '\0';
- while (isspace(sel[x])) x++;
+ //while (isspace(sel[x])) x++;
+ allow_empty_lines = TRUE;
/* to skip blank lines */
if (allow_empty_lines || (x < line_len && sel[x] != '\0'))
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.