Skip to content

Timer callback in lua plugins can't refresh the screen #2923

@X-Ryl669

Description

@X-Ryl669

Description of the problem or steps to reproduce

In a plugin, add this code:

local time = import("time")

-- somewhere in init function
time.AfterFunc(time.ParseDuration("2s"), function()
  micro.InfoBar():Message("I'm alive")
end)

After 2s, the info bar is modified, but it's not visible, until you move the cursor or press a key.
This is likely due to the callback function being called out of the usual drawing code (thread?), so the screen.Redraw() in the InfoBar:Message is lost.

Ideally, it could be solved in go so the lua code doesn't have to deal with this or a new command could be added to force refreshing the screen from the main ui thread and we would have to call this from lua.

I don't know about the internal of micro enough to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions