Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a follow to making line selections work via the command line. The crux of the confusion with this is that entering the command line from any other mode then normal, exits that mode, and enters normal mode. Octo was trying to determine a selected line range, retroactively, when adding review comments. However, this doesn't really work since if you highlight a line, then want to run the comment add command, you exit visual mode. All 'state' related to visual mode and visual line rages are greedy and never 'reset' to 0 when visual mode is exited. The "right" way that Vim intends you to figure out if a user command is being ran with a visual selection is by using the options dictionary provided to the command. Octo has a object/action lookup mechanism which hides this user command options dictionary from the handlers. This commit tries to fix the above issue without change how every single object/action is called by creating a global variable `OctoLastCmdOpts` which caches the last command's options. This can be used to gather the line range in which teh command was called. Ideally, the object/action function dispatch function is updated to pass the user-command dictionary to all command handlers, but this is a larger change. Signed-off-by: ldelossa <[email protected]>
- Loading branch information