[gnome-builder] source-view: special case end-of-file with smart backspace
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] source-view: special case end-of-file with smart backspace
- Date: Sat, 25 Apr 2015 22:11:52 +0000 (UTC)
commit f9bd64bbdf85ae36ed427a6f4b8aed908a866a4a
Author: Christian Hergert <christian hergert me>
Date: Sat Apr 25 15:11:36 2015 -0700
source-view: special case end-of-file with smart backspace
If we are at the end of the file, we will have a gunichar of zero. Handle
this specially, since it's okay to continue to walk backwards.
libide/ide-source-view.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index aa92bb3..aca0faa 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -2104,10 +2104,18 @@ ide_source_view_do_smart_backspace (IdeSourceView *self,
/* if the line isn't empty up to our cursor, ignore */
tmp = insert;
- while (!gtk_text_iter_starts_line (&tmp))
+ while (TRUE)
{
- if (!g_unichar_isspace (gtk_text_iter_get_char (&tmp)))
+ gunichar ch;
+
+ ch = gtk_text_iter_get_char (&tmp);
+
+ if ((ch != 0) && !g_unichar_isspace (ch))
IDE_RETURN (FALSE);
+
+ if (gtk_text_iter_starts_line (&tmp))
+ break;
+
gtk_text_iter_backward_char (&tmp);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]