From 665eec08f1cd2997ddc39e8fe52a584ec8f9a8f2 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 15 Dec 2006 11:57:48 +0000 Subject: [PATCH] Only remove extra space indent after a multiline comment if the indent contains one too many spaces. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1099 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 7 +++++++ src/sci_cb.c | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 579b1185..dc91d02e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-12-15 Nick Treleaven + + * src/sci_cb.c: + Only remove extra space indent after a multiline comment if the + indent contains one too many spaces. + + 2006-12-14 Frank Lanitz * about.c: Fixed a typo. diff --git a/src/sci_cb.c b/src/sci_cb.c index bcbdcf1c..5352a9ad 100644 --- a/src/sci_cb.c +++ b/src/sci_cb.c @@ -1748,7 +1748,14 @@ static void auto_multiline(ScintillaObject *sci, gint pos) while (i >= 0 && isspace(previous_line[i])) i--; if (i >= 1 && is_doc_comment_char(previous_line[i - 1], lexer) && previous_line[i] == '/') { - SSM(sci, SCI_DELETEBACK, 0, 0); // remove whitespace indent + gint cur_line = sci_get_current_line(sci, -1); + gint indent_pos = sci_get_line_indent_position(sci, cur_line); + gint indent_len = sci_get_col_from_position(sci, indent_pos); + + /* if there is one too many spaces, delete the last space, + * to return to the indent used before the multiline comment was started. */ + if (indent_len % app->pref_editor_tab_width == 1) + SSM(sci, SCI_DELETEBACKNOTLINE, 0, 0); // remove whitespace indent g_free(previous_line); return; }