Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO tasks need the autorefresh button when opening a file to be visible 1.38 kubuntu 22.04, plasma 5.24 #1254

Closed
joomlafun opened this issue May 23, 2023 · 5 comments · Fixed by #1257

Comments

@joomlafun
Copy link

Hi,

When opening a file which has tasks, they won't show unless you click the refresh button, I'm not sure if it is default and why?
(1.38 kubuntu 22.04, plasma 5.24)

Kind regards,

@elextr
Copy link
Member

elextr commented May 27, 2023

Confirmed with current git, tasks not shown on open, refresh or switching tabs needed to show them.

@eht16
Copy link
Member

eht16 commented May 27, 2023

I debugged this and the plugin works. But for some reason, when the plugin checks the newly opened file for comments and to look for keywords, there is no styling set yet in the Scintilla object. And since there is no styling set, the plugin finds no comments at all (https://github.com/geany/geany-plugins/blob/master/addons/src/ao_tasks.c#L581) and skips the line.

This has been working in the past. I wonder if there was a change in Scintilla so that configured styles are applied asynchronously (in a separate thread or so) and so the plugin searches for styles before they have been applied.

This particular case can be fixed by a g_idle_add() callback. But I wonder what else might be affected by this, there are probably more plugins and maybe also Geany directly affected if this is the actually the case.

@elextr
Copy link
Member

elextr commented May 28, 2023

I wonder if there was a change in Scintilla so that configured styles are applied asynchronously

No, Geany does that, document_open_file_full() calls queue_colorise() which calls widget_queue_draw() which will call the lexer when the mainloop is idle and the next frame is drawn. So it returns without having set styles, and then document_open_file_full() emits the document-open signal that calls ao_tasks_update() which won't find the tasks because the styles havn't been set yet.

AFAICT thats been the way its done forever (at least back to 2017 which was as far as I traced it). So in theory it never worked, maybe GTK has changed its scheduling of draws at some point and we didn't notice that this stopped working.

Looking at when ao_tasks_update() is called, maybe the process of creating and setting up a tab caused a page switch after the document is drawn and styles are setup. That would emit a document-activate signal which also calls ao_tasks_update(). IIRC there was some fiddling with this somewhere, but of course I can't find it now ;-P

@elextr
Copy link
Member

elextr commented May 28, 2023

Scintilla doesn't start using threaded layout until 5.2.x AFAICT, but Geany git is 5.1.5. Be prepared for chaos when #3441 is merged 👿 [Edit: oops thats only Lexilla, probably safe(ish)]

@eht16
Copy link
Member

eht16 commented Jun 4, 2023

Thank you @elextr for the detailed analysis and for finding that it's us in Geany itself and not (yet) Scintilla.

Apart from the upcoming Scintilla change, #1257 should improve the current situation for the Addons task updating by delaying it.
In my tests, this worked reliably.

liomarhora pushed a commit to liomarhora/geany-plugins that referenced this issue Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants