mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-03-06 00:32:52 +01:00
Rename executing command
This commit is contained in:
parent
79bdca9769
commit
f97555d4a8
src/com/maddyhome/idea/vim
@ -701,7 +701,7 @@ public class KeyHandler {
|
||||
}
|
||||
|
||||
// Save off the command we are about to execute
|
||||
editorState.setCommand(cmd);
|
||||
editorState.setExecutingCommand(cmd);
|
||||
|
||||
Project project = editor.getProject();
|
||||
final Command.Type type = cmd.getType();
|
||||
|
@ -39,7 +39,7 @@ class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
||||
if (lastCommand == null && VimRepeater.Extension.lastExtensionHandler == null) return false
|
||||
|
||||
// Save state
|
||||
val save = state.command
|
||||
val save = state.executingCommand
|
||||
val lastFTCmd = VimPlugin.getMotion().lastFTCmd
|
||||
val lastFTChar = VimPlugin.getMotion().lastFTChar
|
||||
val reg = VimPlugin.getRegister().currentRegister
|
||||
@ -62,7 +62,7 @@ class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
||||
mot.count = 0
|
||||
}
|
||||
}
|
||||
state.setCommand(lastCommand)
|
||||
state.setExecutingCommand(lastCommand)
|
||||
|
||||
KeyHandler.executeVimAction(editor, lastCommand.action, context)
|
||||
|
||||
@ -74,7 +74,7 @@ class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
||||
state.isDotRepeatInProgress = false
|
||||
|
||||
// Restore state
|
||||
if (save != null) state.setCommand(save)
|
||||
if (save != null) state.setExecutingCommand(save)
|
||||
VimPlugin.getMotion().setLastFTCmd(lastFTCmd, lastFTChar)
|
||||
if (lastHandler != null) VimRepeater.Extension.lastExtensionHandler = lastHandler
|
||||
VimRepeater.repeatHandler = repeatHandler
|
||||
|
@ -54,9 +54,17 @@ public class CommandState {
|
||||
private boolean dotRepeatInProgress = false;
|
||||
|
||||
/**
|
||||
* The last command executed
|
||||
* The currently executing command
|
||||
*
|
||||
* This is a complete command, e.g. operator + motion. Some actions/helpers require additional context from flags in
|
||||
* the command/argument. Ideally, we would pass the command through KeyHandler#executeVimAction and
|
||||
* EditorActionHandlerBase#execute, but we also need to know the command type in MarkGroup#updateMarkFromDelete,
|
||||
* which is called via a document change event.
|
||||
*
|
||||
* This field is reset after the command has been executed.
|
||||
*/
|
||||
@Nullable private Command myCommand;
|
||||
@Nullable private Command executingCommand;
|
||||
|
||||
private EnumSet<CommandFlags> myFlags = EnumSet.noneOf(CommandFlags.class);
|
||||
|
||||
// State used to build the next command
|
||||
@ -160,12 +168,12 @@ public class CommandState {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Command getCommand() {
|
||||
return myCommand;
|
||||
public Command getExecutingCommand() {
|
||||
return executingCommand;
|
||||
}
|
||||
|
||||
public void setCommand(@NotNull Command cmd) {
|
||||
myCommand = cmd;
|
||||
public void setExecutingCommand(@NotNull Command cmd) {
|
||||
executingCommand = cmd;
|
||||
setFlags(cmd.getFlags());
|
||||
}
|
||||
|
||||
@ -318,7 +326,7 @@ public class CommandState {
|
||||
* Resets the command, mode, visual mode, and mapping mode to initial values.
|
||||
*/
|
||||
public void reset() {
|
||||
myCommand = null;
|
||||
executingCommand = null;
|
||||
modeStates.clear();
|
||||
keys.clear();
|
||||
updateStatus();
|
||||
|
@ -382,7 +382,7 @@ public class ChangeGroup {
|
||||
}
|
||||
}
|
||||
|
||||
final Command cmd = state.getCommand();
|
||||
final Command cmd = state.getExecutingCommand();
|
||||
if (cmd != null && state.isDotRepeatInProgress()) {
|
||||
state.pushModes(mode, CommandState.SubMode.NONE, MappingMode.INSERT);
|
||||
if (mode == CommandState.Mode.REPLACE) {
|
||||
|
@ -608,7 +608,7 @@ public class MarkGroup {
|
||||
int markLineStartOff = EditorHelper.getLineStartOffset(editor, mark.getLogicalLine());
|
||||
int markLineEndOff = EditorHelper.getLineEndOffset(editor, mark.getLogicalLine(), true);
|
||||
|
||||
Command command = CommandState.getInstance(editor).getCommand();
|
||||
Command command = CommandState.getInstance(editor).getExecutingCommand();
|
||||
// If text is being changed from the start of the mark line (a special case for mark deletion)
|
||||
boolean changeFromMarkLineStart = command != null && command.getType() == Command.Type.CHANGE
|
||||
&& delStartOff == markLineStartOff;
|
||||
|
@ -294,7 +294,7 @@ public class RegisterGroup {
|
||||
}
|
||||
|
||||
private boolean isSmallDeletionSpecialCase(Editor editor) {
|
||||
Command currentCommand = CommandState.getInstance(editor).getCommand();
|
||||
Command currentCommand = CommandState.getInstance(editor).getExecutingCommand();
|
||||
if (currentCommand != null) {
|
||||
Argument argument = currentCommand.getArgument();
|
||||
if (argument != null) {
|
||||
|
@ -133,7 +133,7 @@ sealed class EditorActionHandlerBase(private val myRunForEachCaret: Boolean) {
|
||||
val editor = _editor.getTopLevelEditor()
|
||||
logger.debug("Execute command with handler: " + this.javaClass.name)
|
||||
|
||||
val cmd = editor.commandState.command ?: run {
|
||||
val cmd = editor.commandState.executingCommand ?: run {
|
||||
VimPlugin.indicateError()
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user