[gnome-builder] vim: fix 'o' movement
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] vim: fix 'o' movement
- Date: Mon, 9 May 2016 22:43:52 +0000 (UTC)
commit ae1b4dbe6ec3d1c36660960c1de58a0a7fcea82d
Author: Sebastien Lafargue <slafargue gnome org>
Date: Tue May 10 00:40:27 2016 +0200
vim: fix 'o' movement
Due to reindent changes to support multi-lines,
we need to add the reindent from an empty line case.
libide/ide-source-view.c | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 35e1bc5..58a5f81 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -4130,19 +4130,22 @@ ide_source_view_real_reindent (IdeSourceView *self)
lines = g_ptr_array_new_with_free_func (g_free);
- for (iter = begin;
- gtk_text_iter_compare (&iter, &end) < 0;
- gtk_text_iter_forward_line (&iter))
- {
- GtkTextIter line_end = iter;
- gchar *line;
+ if (gtk_text_iter_compare (&begin, &end) == 0)
+ g_ptr_array_add (lines, g_strdup (""));
+ else
+ for (iter = begin;
+ gtk_text_iter_compare (&iter, &end) < 0;
+ gtk_text_iter_forward_line (&iter))
+ {
+ GtkTextIter line_end = iter;
+ gchar *line;
- if (!gtk_text_iter_ends_line (&line_end))
- gtk_text_iter_forward_to_line_end (&line_end);
+ if (!gtk_text_iter_ends_line (&line_end))
+ gtk_text_iter_forward_to_line_end (&line_end);
- line = gtk_text_iter_get_slice (&iter, &line_end);
- g_ptr_array_add (lines, g_strstrip (line));
- }
+ line = gtk_text_iter_get_slice (&iter, &line_end);
+ g_ptr_array_add (lines, g_strstrip (line));
+ }
gtk_text_buffer_begin_user_action (buffer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]