[gtksourceview] One more join-lines case...
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] One more join-lines case...
- Date: Thu, 12 Mar 2015 20:35:37 +0000 (UTC)
commit 31f5ad3c084bab065e5b5a66b3c77329a4be134c
Author: Paolo Borelli <pborelli gnome org>
Date: Thu Mar 12 21:34:35 2015 +0100
One more join-lines case...
Third commit in a row means "stop being lazy and add a test"
gtksourceview/gtksourcebuffer.c | 6 +++++-
tests/test-buffer.c | 2 ++
2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index b5d599b..c77b4c7 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -2588,8 +2588,12 @@ gtk_source_buffer_join_lines (GtkSourceBuffer *buffer,
gtk_text_buffer_begin_user_action (text_buffer);
move_to_line_text_end (start);
+ if (!gtk_text_iter_ends_line (end))
+ {
+ gtk_text_iter_forward_to_line_end (end);
+ }
- while (gtk_text_iter_get_line (start) < gtk_text_iter_get_line (end))
+ while (gtk_text_iter_compare (start, end) < 0)
{
GtkTextIter iter;
gunichar ch;
diff --git a/tests/test-buffer.c b/tests/test-buffer.c
index 6392591..dae0ae2 100644
--- a/tests/test-buffer.c
+++ b/tests/test-buffer.c
@@ -215,6 +215,8 @@ test_join_lines (void)
do_test_join_lines (buffer, "some\ntext", "some\ntext", 6, -1);
do_test_join_lines (buffer, "some\ntext\nmore", "some text\nmore", 0, 6);
do_test_join_lines (buffer, "some\ntext\nmore", "some\ntext more", 6, -1);
+ do_test_join_lines (buffer, "some\n text\nmore", "some text\nmore", 0, 5);
+ do_test_join_lines (buffer, "some\ntext\n\n\nmore", "some text\n\nmore", 0, 10);
g_object_unref (buffer);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]