More background for git bug 28:
https://github.com/leo-editor/leo-editor/issues/28There is no way around it: loading more than 10K lines of text into the body pane will be slow.
However, when moving around the outline, we often want just to move *past* a large node. This suggests the following strategy.
1. Let w be a LeoQTextEditWidget. w.setAllText will load small text as usual. For large text, w.setAllText will do the following:
- Put 'Loading...' in the body pane.
- Lock/disable w, preventing user edits.
- set w.leo_loading = True
- set w.leo_loading_p = w.c.p.copy()
- queue up w.load_text at idle time.
This has the potential for big problems. Happily this scheme can probably be made safe as follows:
2. Define w.getAllText as follows:
def getAllText(self):
w = self.widget
if w.leo_loading:
return w.leo_loading_p.b
else:
return g.u(w.toPlainText())
3. At idle time, w.load_text will loads the text, but *only* if w.c.p == w.leo_loading.
In any case, w.load_text will clear w.leo_loading and w.leo_loading_p.
===== Conclusion
This looks like a viable strategy, but it will require substantial testing. There will have to be a delayed_load switch to enable/disable this feature.
Your comments, please.
Edward