Open ByteOfBrie opened 3 weeks ago
Thanks for debugging the exact cause of this. I'm not sure whether loosing focus after cutting a portion of text is done by the application or Qt itself though. So potentially there's little to solve this part of the issue.
I agree that it would be better to fix that though. Maybe we can simply move the cursor to the start/end of the removed text and reapply focus or something to workaround this.
I agree that it would be better to fix that though. Maybe we can simply move the cursor to the start/end of the removed text and reapply focus or something to workaround this.
Yeah, exactly. If the cursor manages to stay focused in the text box, it should prevent this issue entirely.
I find it weird that pressing an arrow key quickly enough prevents the loss of focus. If I wait for the loss of focus to occur first, movement keys don't appear to do anything (nor does almost anything else). f2
will make it edit and select the chapter name, which then gives something back to focus on, and then prevents crashing.
I'm not sure if I'll get around to trying to fix this, but I think I'd start with trying to track when it's gaining and losing focus, and seeing if I can find anything interesting there.
While screwing around with this, I've occasionally managed to get into a state where the metadata sidebar gets greyed out and has no data (just like when I select the document root), despite having my cursor in the document editor. If I type enough in the document, it fixes itself. This might be related or might be an entirely separate issue, but the fact that they're happening with similar sorts of actions makes me suspicious enough to mention it here. If I notice any more information about this, I'll open it as a separate issue.
Possibly unrelated, but pressing ctrl-backspace
(to delete a word) in the metadata tab also loses focus on the editing box. It still has focus on something, so it doesn't crash when pressing delete
, but it's maybe related (and really annoying).
Edit: I'm not seeing this as consistently as I originally thought.
It doesn't seem to happen at all if I'm editing the metadata from the root, but if I'm editing a scene, then it can happen sometimes. If I click off the box, back on, and then press ctrl-backspace
, it always (?) happens, but if I'm editing a particular text box, it seems less likely to happen.
Since it seems like it might matter, the project that I'm seeing the crashes has a bunch of scenes connected directly to the root, no folders.
I managed to find and reproduce a weird crash. It's hard to determine the exact steps, but I can get it to crash consistently on my system. I can sometimes skip some of these steps and have it crash, but it's less consistent.
ctrl-x
to cut the textThe relevant section of log is here:
On further testing, the "first" issue appears to happen right after I cut the text. Very quickly after cutting text from the editor window, the text box loses focus.
If I cut text and then press an arrow key, that input allows me to keep focus on the window, and then everything functions as expected. Likewise, if I press
ctrl-x
and then delete very quickly, it doesn't crash. It needs a pause between cutting text and the next input to lose focus, and then pressing delete will crash Manuskript.The crash is the most visible part of this, but losing focus is bad on its own. When that happens, you lose the ability to undo, and you have to click again to edit the text. This is mostly an annoyance given that you have the text on the clipboard, but still enough of a problem that this part should also be fixed (eventually), not (just) a band-aid on the crashing.