[gnome-builder] code: highlight current word for diagnostic
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] code: highlight current word for diagnostic
- Date: Thu, 25 Jun 2020 18:05:25 +0000 (UTC)
commit 01d4825ea4a7f2e56e7e9c6ed6ce8ac55d2423fb
Author: Christian Hergert <chergert redhat com>
Date: Thu Jun 25 11:05:03 2020 -0700
code: highlight current word for diagnostic
Instead of highlighting to the end of the line, just highlight the next
visible word. If we are not starting or in a word, highlight to the end
of the line.
Fixes #1247
src/libide/code/ide-buffer.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/code/ide-buffer.c b/src/libide/code/ide-buffer.c
index 9b02515e8..4e658b77f 100644
--- a/src/libide/code/ide-buffer.c
+++ b/src/libide/code/ide-buffer.c
@@ -2474,10 +2474,19 @@ ide_buffer_apply_diagnostic (IdeBuffer *self,
ide_buffer_get_iter_at_location (self, &begin_iter, location);
end_iter = begin_iter;
- if (!gtk_text_iter_ends_line (&end_iter))
- gtk_text_iter_forward_to_line_end (&end_iter);
+ if (gtk_text_iter_ends_line (&end_iter))
+ {
+ gtk_text_iter_backward_char (&begin_iter);
+ }
else
- gtk_text_iter_backward_char (&begin_iter);
+ {
+ /* Only highlight to next word */
+ if (_ide_source_iter_inside_word (&end_iter) ||
+ _ide_source_iter_starts_word (&end_iter))
+ _ide_source_iter_forward_visible_word_end (&end_iter);
+ else
+ gtk_text_iter_forward_to_line_end (&end_iter);
+ }
gtk_text_buffer_apply_tag_by_name (GTK_TEXT_BUFFER (self), tag_name, &begin_iter, &end_iter);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]