[gtksourceview] view: fix decrement of negative numbers
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] view: fix decrement of negative numbers
- Date: Thu, 29 Jul 2021 00:49:49 +0000 (UTC)
commit 7e2fdb55136f2bbbde473c9a4de8e20c05bc0d59
Author: Christian Hergert <chergert redhat com>
Date: Wed Jul 28 17:49:40 2021 -0700
view: fix decrement of negative numbers
Fixes #117
gtksourceview/gtksourceview.c | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 3bbd676c..fc40e87e 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -386,7 +386,18 @@ gtk_source_view_change_number (GtkSourceView *view,
{
if (!gtk_text_iter_starts_word (&start))
{
+ GtkTextIter prev;
+
gtk_text_iter_backward_word_start (&start);
+
+ /* Include the negative sign if there is one.
+ * https://gitlab.gnome.org/GNOME/gtksourceview/-/issues/117
+ */
+ prev = start;
+ if (gtk_text_iter_backward_char (&prev) && gtk_text_iter_get_char (&prev) == '-')
+ {
+ start = prev;
+ }
}
if (!gtk_text_iter_ends_word (&end))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]