-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
__Issue:__ There were a couple related issues with the cursor in command-line mode: 1) When exiting command-line mode, the cursor could 'flash' at the top of the file 2) When running a search command, the viewport would not scroll to the first match __Defect:__ Both issues stem from the fact that Onivim was ignoring editor-cursor-position changes during search. For the first issue, when exiting command-line mode, there would be a brief transitional state where the editor is focused in CommandLine mode, but no cursor would be available - so it would be rendered at the default (0,0) position. This would be rectified once the mode transition completed and the cursor position is reset. For the second issue, `libvim` was properly updating the cursor position when searching, but that cursor position was being ignored. __Fix:__ Track the editor cursor position during the course of the command-line interaction Fixes #2968 Related #1551
- Loading branch information
Showing
14 changed files
with
168 additions
and
89 deletions.
There are no files selected for viewing
This file contains 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 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 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,65 @@ | ||
open Oni_Core; | ||
open Oni_Model; | ||
open Oni_IntegrationTestLib; | ||
|
||
runTest(~name="VimIncsearchScrollTest", ({dispatch, wait, input, key, _}) => { | ||
wait(~name="Initial mode is normal", (state: State.t) => | ||
Selectors.mode(state) |> Vim.Mode.isNormal | ||
); | ||
|
||
let largeCFile = getAssetPath("large-c-file.c"); | ||
dispatch(Actions.OpenFileByPath(largeCFile, None, None)); | ||
|
||
// Wait for file to load | ||
wait( | ||
~timeout=30.0, | ||
~name="Validate buffer is loaded", | ||
(state: State.t) => { | ||
let fileType = | ||
Selectors.getActiveBuffer(state) | ||
|> Option.map(Buffer.getFileType) | ||
|> Option.map(Buffer.FileType.toString); | ||
|
||
fileType == Some("c"); | ||
}, | ||
); | ||
|
||
// Start searching in the file: | ||
input("/"); | ||
|
||
// Validate we're now in command line | ||
wait(~name="Mode switches to command line", (state: State.t) => { | ||
Vim.Mode.isCommandLine(Selectors.mode(state)) | ||
}); | ||
|
||
// Search for something far down, that should trigger a scroll | ||
// "xor" is on line 983... | ||
input("\"xor"); | ||
|
||
// Validate editor has scrolled | ||
wait(~name="Validate editor has scrolled some distance", (state: State.t) => { | ||
let scrollY = | ||
state.layout | ||
|> Feature_Layout.activeEditor | ||
|> Feature_Editor.Editor.scrollY; | ||
|
||
scrollY > 100.; | ||
}); | ||
|
||
// Cancel search, we should scroll back up... | ||
key(EditorInput.Key.Escape); | ||
|
||
// Validate editor has scrolled back to top | ||
wait( | ||
~name="Validate editor is back to start", | ||
~timeout=30., | ||
(state: State.t) => { | ||
let scrollY = | ||
state.layout | ||
|> Feature_Layout.activeEditor | ||
|> Feature_Editor.Editor.scrollY; | ||
|
||
scrollY < 1.; | ||
}, | ||
); | ||
}); |
This file contains 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 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 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 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 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 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 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 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 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 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
Oops, something went wrong.