Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unwanted selections don't switch to Visual Mode #3096

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions Src/VimCore/SelectionChangeTracker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -147,24 +147,22 @@ type internal SelectionChangeTracker
else
Some ModeKind.SelectCharacter
elif _textView.Selection.Mode = TextSelectionMode.Stream then
let modeKind =
match _vimBuffer.ModeKind with
| ModeKind.VisualCharacter -> ModeKind.VisualCharacter
| ModeKind.VisualLine -> ModeKind.VisualLine
| ModeKind.VisualBlock -> ModeKind.VisualCharacter
| ModeKind.SelectCharacter -> ModeKind.SelectCharacter
| ModeKind.SelectLine -> ModeKind.SelectLine
| ModeKind.SelectBlock -> ModeKind.SelectCharacter
| _ ->
// We were not already in a visual mode and the
// user did not initiate the selection with the
// mouse. In that case handle the external select
// by using the 'selectmode=mouse' setting
if isSelectModeMouse then
ModeKind.SelectCharacter
else
ModeKind.VisualCharacter
Some modeKind
match _vimBuffer.ModeKind with
| ModeKind.VisualCharacter -> Some ModeKind.VisualCharacter
| ModeKind.VisualLine -> Some ModeKind.VisualLine
| ModeKind.VisualBlock -> Some ModeKind.VisualCharacter
| ModeKind.SelectCharacter -> Some ModeKind.SelectCharacter
| ModeKind.SelectLine -> Some ModeKind.SelectLine
| ModeKind.SelectBlock -> Some ModeKind.SelectCharacter
| _ ->
// We were not already in a visual mode and the
// user did not initiate the selection with the
// mouse. In that case handle the external select
// by using the 'selectmode=mouse' setting
if isSelectModeMouse then
Some ModeKind.SelectCharacter
else
None
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change, the rest is mostly noise

else
// Handle TextSelectionMode.Box cases
if _vimBuffer.ModeKind = ModeKind.SelectBlock then
Expand All @@ -175,9 +173,10 @@ type internal SelectionChangeTracker
Some ModeKind.SelectBlock
else
Some ModeKind.VisualBlock

match desiredNewMode with
| None -> None
| Some kind -> if kind <> _vimBuffer.ModeKind then Some kind else None
| Some kind when kind <> _vimBuffer.ModeKind -> Some kind
| _ -> None

// Update the selections. This is called from a post callback to ensure we don't
// interfer with other selection + edit events.
Expand Down
Loading