[Github-comments] [geany] Don't explicitly re-highlight the document when typenames change (#575)

Colomban Wendling notifications at xxxxx
Fri Dec 11 19:45:27 UTC 2015


I just tried the patch and it doesn't seem to work for me, if I change a type name other occurrences of it don't change:
```C
typedef int bar;

bar z;
```
if you change the name of the typedef, the typedef itself gets re-highlighted when the cursor blinks (roughly a second later), but the usage below don't.

However, instead of re-colorizing everything maybe we could only colorize up to the end of the visible area, which would mitigate (or even eradicate?) the slowness:
```diff
diff --git a/src/editor.c b/src/editor.c
index 1336588..cfbfbe9 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -4682,12 +4682,20 @@ on_editor_scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer user_d
 static gboolean editor_check_colourise(GeanyEditor *editor)
 {
     GeanyDocument *doc = editor->document;
+    gint start_line, end_line, start, end;
 
     if (!doc->priv->colourise_needed)
         return FALSE;
 
+    start_line = SSM(editor->sci, SCI_GETFIRSTVISIBLELINE, 0, 0);
+    end_line = start_line + SSM(editor->sci, SCI_LINESONSCREEN, 0, 0);
+    start_line = SSM(editor->sci, SCI_DOCLINEFROMVISIBLE, start_line, 0);
+    end_line = SSM(editor->sci, SCI_DOCLINEFROMVISIBLE, end_line, 0);
+    start = sci_get_position_from_line(editor->sci, start_line);
+    end = sci_get_line_end_position(editor->sci, end_line);
+
     doc->priv->colourise_needed = FALSE;
-    sci_colourise(editor->sci, 0, -1);
+    sci_colourise(editor->sci, start, end);
 
     /* now that the current document is colourised, fold points are now accurate,
      * so force an update of the current function/tag. */
```

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/575#issuecomment-164031773
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20151211/dc37eb74/attachment.html>


More information about the Github-comments mailing list