Before it was always false for every inline note.
Details
- Reviewers
cullmann brauch - Group Reviewers
KTextEditor - Commits
- R39:7f043fbb26d4: inline notes: correctly set underMouse() for inline notes
Diff Detail
- Repository
- R39 KTextEditor
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Is the video the new behaviour? It still looks a bit weird to me, there is a slight delay between the mouse entering the area and the highlight changing.
Is it possible that the line (and thus the note) is not properly marked for repaint when the underMouse property changes?
Yes it's the new behavior, before it wouldn't change at all. I think the tagLines marks the line for repainting but I didn't yet look if the this also triggers painting of lines. Or maybe it's a bit slow because of my debug setup?
Hm, yeah, looking at the code I think you might need to call updateView() in case a focus in or out happened. Can you try if that makes a difference?
My guess is right now the view updates when the cursor blinks, so that's why it updates after a short moment (of varying length, though, if you look at the video). Since the line is tagged dirty, it gets repainted correctly, but too late.
It seems you're right but updateView doesn't help. The video above is with updateView() calls and slowed down.
Then it seems like the line is not tagged correctly. Maybe try tagLines(note.position.line(), note.position.line())? I think the column being the same is not what the function being called expects.
Hmm doesn't seem to be instantly either. But I have the feeling it's worse when I try to record it so it's maybe an issue on my laptop. Would you object if I land this then, given this is more correct than before?
I'm sorry, updateView is the wrong function to call, you need updateDirty. I tried it out, like this it works:
if (e->buttons() == Qt::NoButton) { auto noteData = inlineNoteAt(e->globalPos()); if (noteData.m_position.isValid()) { if (!m_activeInlineNote.m_position.isValid()) { // no active note -- focus in tagLine(noteData.m_position); updateDirty(); noteData.m_underMouse = true; noteData.m_provider->inlineNoteFocusInEvent(KTextEditor::InlineNote(noteData), e->globalPos()); m_activeInlineNote = noteData; } else { noteData.m_provider->inlineNoteMouseMoveEvent(KTextEditor::InlineNote(noteData), e->globalPos()); } } else if (m_activeInlineNote.m_position.isValid()) { tagLine(m_activeInlineNote.m_position); updateDirty(); m_activeInlineNote.m_underMouse = false; m_activeInlineNote.m_provider->inlineNoteFocusOutEvent(KTextEditor::InlineNote(m_activeInlineNote)); m_activeInlineNote = {}; } }
If you want I can integrate these changes and submit your patch, should I? Thanks a lot for your contribution.