Fixes calculation of line to unset vertical indent in the event of a mouse down #263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
During a suggestion preview, we terminate the preview session on mouse down.
The termination is a multi-step process, one of which is unsetting the vertical indent in the line below invocation line.
This line is dynamic and is relative to where the current caret offset is. This means you cannot simply note down the line number to unset it later. This is because user might insert new line during the typeahead.
Thus far, the call made to unset the vertical indent uses the caret listener to keep track of the last known line. This works well enough until you have key registers that marks a flag that keeps track of why the caret has moved, used in communication between the
QInlineInputListener
with the caret listener, to "text input" without triggering a caret movement (e.g. modifier keys such as shift, or commands that do not produce an input / insertion). Normally, the caret movement reason is reset by the caret listener. But because the caret never moves under these modifier / command key input, this flag is never reset.When a mouse down happens, the caret listener is called before the mouse listener. Therefore prematurely updating the caret position to where the mouse down happens. By the time the mouse listener gets called, it gets the incorrect line to pass to the vertical indent unset.
The quick fix here is to make it so that the mouse listener does not rely on caret listener to derive the line number. But a proper fix is needed to simplify the interactions between caret listener and
QInputListener
.Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.