Oh God, I left an erroneous check in the code. Updated patch attacked.
diff --git a/src/editor.c b/src/editor.c
index a012f7d..8697c09 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -4609,26 +4609,12 @@ void editor_strip_trailing_spaces(GeanyEditor *editor)
void editor_ensure_final_newline(GeanyEditor *editor)
{
gint max_lines = sci_get_line_count(editor->sci);
- gboolean append_newline = (max_lines == 1);
gint end_document = sci_get_position_from_line(editor->sci, max_lines);
- if (max_lines > 1)
+ if (end_document > sci_get_position_from_line(editor->sci, max_lines - 1))
{
- append_newline = end_document > sci_get_position_from_line(editor->sci, max_lines - 1);
- }
- if (append_newline)
- {
- const gchar *eol = "\n";
- switch (sci_get_eol_mode(editor->sci))
- {
- case SC_EOL_CRLF:
- eol = "\r\n";
- break;
- case SC_EOL_CR:
- eol = "\r";
- break;
- }
- sci_insert_text(editor->sci, end_document, eol);
+ sci_insert_text(editor->sci, end_document,
+ utils_get_eol_char(sci_get_eol_mode(editor->sci)));
}
}
_______________________________________________
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel