Callback that runs after text is rendered in ALL buffers?


#1

I’ve looked through the atom API pretty extensively and cannot seem to find any methods that allow me to run a callback after the text has finished rendering in all buffers in all cases, including:

  • After a live reload
  • After opening a new project
  • After fully relaunching Atom.

The closest I’ve gotten is using a jQuery.ready callback, but this runs once for every pane. So if I run something in it, it will run once for each text editor after that editor is rendered, I want a callback that runs just once, after ALL text editors have finished rendering their text.

At the moment the only way I’ve been able to run my callback and be sure all text editors have finished rendering is by running my callback after the 1st onDidChangeCursorPosition event which is obviously not ideal. Any help is greatly appreciated!


#2

There isn’t an event like you’re asking for. What is it you’re trying to do?


#3

I have a syntax theme that uses a custom web font as well as antialiasing, which sometimes causes the cursor to become misaligned due to the measuring of character widths happening too early (#4200). This issue also occurs when changing font sizes sometimes.

To get around this, I’m forcing the characters to be remeasured in my package which fixes the cursor position issue. However, this needs to happen after the text is rendered in all editors, because the character widths are stored as a property of each buffer. So I need a callback that runs after all the editors are done rendering.


#4

Why can’t you just watch each editor separately and deal with it each time they appear? It would be easy to do.