-
-
Notifications
You must be signed in to change notification settings - Fork 622
[FEATURE] Add opt-in Vim Mode to the search bar #4541
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
Open
namefailed
wants to merge
32
commits into
Flow-Launcher:dev
Choose a base branch
from
namefailed:vim-mode
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
da4d0f2
add vim mode to the search bar
6077ebf
Fix vim mode indicator and visual mode search/motion
672b3aa
docs: Update vim mode documentation with mode indicator, text objects…
1d355d6
Cleanup codebase and finalize cute vim mode indicator pill
6afdd52
Fix PR review feedback: handle MoveEndWord bounds, TextObjectWord whi…
902d9d0
chore: enable CI for vim-mode branch
3a6a1e0
fix(ui): change vim mode indicator from pill text to small colored ci…
831a198
fix(ui): use dynamic resources for vim mode settings text to support …
5902ece
docs: add XML docstrings to Vim mode public API
2dc28c1
refactor: remove unused label variable
1afa446
fix(ui): preserve WPF data bindings to fix auto-complete crash
18a3c81
Refactor VimMode logic, fix crashes, and optimize performance
4a2bcfb
Update packages.lock.json after build
bb3baab
Fix yank motion deletion bug
38e62de
Decrease VimMode indicator size
3c4ef29
Adjust VimModeIndicator vertical margin
dacfdab
Update lockfile
dddeb64
Fix V key behavior: V from Normal enters Visual Line mode, toggle log…
b35626f
Implement operation-level undo/redo stack, document u and Ctrl+R
df55bea
Fix repeat (.) for dw/cw/s/X/r and all motion-based operations
f1498ca
Address cubic review: fix state leaks, restore caret, refactor engine
08ede27
Merge remote-tracking branch 'upstream/dev' into dev
1246cd2
Fix Vim mode bugs: disable-lock, g-prefix, visual text objects, state…
84cd930
Fix operator+motion inclusivity and count handling in Vim mode
bd31efe
Clean up Vim mode PR for upstream: restore README, move docs, drop fo…
a1bbaf4
Document the color-coded dot mode indicator design choice
7171df4
Add P (paste before cursor), the counterpart to p
af6097a
Vim: fix Insert-mode undo, counted dot-repeat, and quote text-object …
2ad9468
Vim: flash a highlight over yanked text as confirmation
f860288
Vim: add gg/G, Ctrl-A/Ctrl-X, ib/aB aliases, and counted text objects
d320586
Vim: select the restored query on reopen when dismissed in Normal mode
d95b765
Merge remote-tracking branch 'upstream/dev' into vim-mode
namefailed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| using NUnit.Framework; | ||
| using System.Collections.Generic; | ||
| using Flow.Launcher.VimMode; | ||
|
|
||
| namespace Flow.Launcher.Test | ||
| { | ||
| [TestFixture] | ||
| public class VimEngineTest | ||
| { | ||
| [Test] | ||
| public void DefaultModeIsInsert() | ||
| { | ||
| var engine = new VimEngine(); | ||
| Assert.That(engine.CurrentMode, Is.EqualTo(VimModeType.Insert)); | ||
| } | ||
|
|
||
| [Test] | ||
| public void SwitchToInsertFromNormalFiresEvent() | ||
| { | ||
| var engine = new VimEngine(); | ||
| engine.SwitchToNormal(); | ||
| var modes = new List<VimModeType>(); | ||
| engine.ModeChanged += m => modes.Add(m); | ||
|
|
||
| engine.SwitchToInsert(); | ||
|
|
||
| Assert.That(engine.CurrentMode, Is.EqualTo(VimModeType.Insert)); | ||
| Assert.That(modes, Is.EqualTo(new[] { VimModeType.Insert })); | ||
| } | ||
|
|
||
| [Test] | ||
| public void SwitchToInsertWhenAlreadyInsertDoesNotFire() | ||
| { | ||
| var engine = new VimEngine(); | ||
| var fired = false; | ||
| engine.ModeChanged += _ => fired = true; | ||
|
|
||
| engine.SwitchToInsert(); | ||
|
|
||
| Assert.That(fired, Is.False); | ||
| } | ||
|
|
||
| [Test] | ||
| public void SwitchToNormalFiresEvent() | ||
| { | ||
| var engine = new VimEngine(); | ||
| var modes = new List<VimModeType>(); | ||
| engine.ModeChanged += m => modes.Add(m); | ||
|
|
||
| engine.SwitchToNormal(); | ||
|
|
||
| Assert.That(engine.CurrentMode, Is.EqualTo(VimModeType.Normal)); | ||
| Assert.That(modes, Is.EqualTo(new[] { VimModeType.Normal })); | ||
| } | ||
|
|
||
| [Test] | ||
| public void SwitchToNormalWhenAlreadyNormalDoesNotFire() | ||
| { | ||
| var engine = new VimEngine(); | ||
| engine.SwitchToNormal(); | ||
| var fired = false; | ||
| engine.ModeChanged += _ => fired = true; | ||
|
|
||
| engine.SwitchToNormal(); | ||
|
|
||
| Assert.That(fired, Is.False); | ||
| } | ||
|
|
||
| [Test] | ||
| public void SwitchToVisualFiresEvent() | ||
| { | ||
| var engine = new VimEngine(); | ||
| engine.SwitchToNormal(); | ||
| var modes = new List<VimModeType>(); | ||
| engine.ModeChanged += m => modes.Add(m); | ||
|
|
||
| engine.SwitchToVisual(); | ||
|
|
||
| Assert.That(engine.CurrentMode, Is.EqualTo(VimModeType.Visual)); | ||
| Assert.That(modes, Is.EqualTo(new[] { VimModeType.Visual })); | ||
| } | ||
|
|
||
| [Test] | ||
| public void SwitchToVisualWhenAlreadyVisualDoesNotFire() | ||
| { | ||
| var engine = new VimEngine(); | ||
| engine.SwitchToVisual(); | ||
| var fired = false; | ||
| engine.ModeChanged += _ => fired = true; | ||
|
|
||
| engine.SwitchToVisual(); | ||
|
|
||
| Assert.That(fired, Is.False); | ||
| } | ||
|
|
||
| [Test] | ||
| public void SwitchToVisualLineFiresEvent() | ||
| { | ||
| var engine = new VimEngine(); | ||
| engine.SwitchToVisual(); | ||
| var modes = new List<VimModeType>(); | ||
| engine.ModeChanged += m => modes.Add(m); | ||
|
|
||
| engine.SwitchToVisualLine(); | ||
|
|
||
| Assert.That(engine.CurrentMode, Is.EqualTo(VimModeType.VisualLine)); | ||
| Assert.That(modes, Is.EqualTo(new[] { VimModeType.VisualLine })); | ||
| } | ||
|
|
||
| [Test] | ||
| public void SwitchToVisualLineWhenAlreadyDoesNotFire() | ||
| { | ||
| var engine = new VimEngine(); | ||
| engine.SwitchToVisualLine(); | ||
| var fired = false; | ||
| engine.ModeChanged += _ => fired = true; | ||
|
|
||
| engine.SwitchToVisualLine(); | ||
|
|
||
| Assert.That(fired, Is.False); | ||
| } | ||
|
|
||
| [Test] | ||
| public void FullModeCycleTest() | ||
| { | ||
| var engine = new VimEngine(); | ||
| var modes = new List<VimModeType>(); | ||
| engine.ModeChanged += m => modes.Add(m); | ||
|
|
||
| engine.SwitchToNormal(); | ||
| engine.SwitchToVisual(); | ||
| engine.SwitchToNormal(); | ||
| engine.SwitchToInsert(); | ||
|
|
||
| Assert.That(engine.CurrentMode, Is.EqualTo(VimModeType.Insert)); | ||
| Assert.That(modes, Is.EqualTo(new[] { | ||
| VimModeType.Normal, VimModeType.Visual, VimModeType.Normal, VimModeType.Insert | ||
| })); | ||
| } | ||
|
|
||
| [Test] | ||
| public void VisualLineCycleTest() | ||
| { | ||
| var engine = new VimEngine(); | ||
| var modes = new List<VimModeType>(); | ||
| engine.ModeChanged += m => modes.Add(m); | ||
|
|
||
| engine.SwitchToNormal(); | ||
| engine.SwitchToVisualLine(); | ||
| engine.SwitchToVisual(); | ||
| engine.SwitchToVisualLine(); | ||
| engine.SwitchToNormal(); | ||
| engine.SwitchToInsert(); | ||
|
|
||
| Assert.That(engine.CurrentMode, Is.EqualTo(VimModeType.Insert)); | ||
| Assert.That(modes, Is.EqualTo(new[] { | ||
| VimModeType.Normal, VimModeType.VisualLine, VimModeType.Visual, | ||
| VimModeType.VisualLine, VimModeType.Normal, VimModeType.Insert | ||
| })); | ||
| } | ||
|
|
||
| [Test] | ||
| public void NoSubscriberDoesNotThrow() | ||
| { | ||
| var engine = new VimEngine(); | ||
| Assert.DoesNotThrow(() => engine.SwitchToNormal()); | ||
| Assert.DoesNotThrow(() => engine.SwitchToVisual()); | ||
| Assert.DoesNotThrow(() => engine.SwitchToVisualLine()); | ||
| Assert.DoesNotThrow(() => engine.SwitchToInsert()); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: Flow-Launcher/Flow.Launcher
Length of output: 2839
🏁 Script executed:
Repository: Flow-Launcher/Flow.Launcher
Length of output: 1380
🏁 Script executed:
Repository: Flow-Launcher/Flow.Launcher
Length of output: 824
Add PropertyChanged handler to restore Insert-mode UI when EnableVimMode is disabled.
When
EnableVimModeis toggled off, the UI state is not fully restored.HandlePreviewKeyDownonly hides the vim block caret, leavingInputMethodsuspended and the transparentCaretBrushin place. Add a check inViewModel_PropertyChangedfor theEnableVimModeproperty that callsApplyModeUI(VimModes.Insert)when disabled, which properly restores both the InputMethod state and native caret brush.🤖 Prompt for AI Agents