use of com.maddyhome.idea.vim.command.Command in project ideavim by JetBrains.
the class KeyHandler method handleCharArgument.
private void handleCharArgument(@NotNull KeyStroke key, char chKey) {
// Some special keys can be handled as character arguments - let's check for them here.
if (chKey == 0) {
switch(key.getKeyCode()) {
case KeyEvent.VK_TAB:
chKey = '\t';
break;
case KeyEvent.VK_ENTER:
chKey = '\n';
break;
}
}
if (chKey != 0) {
// Create the character argument, add it to the current command, and signal we are ready to process
// the command
Argument arg = new Argument(chKey);
Command cmd = currentCmd.peek();
cmd.setArgument(arg);
state = State.READY;
} else {
// Oops - this isn't a valid character argument
state = State.BAD_COMMAND;
}
}
use of com.maddyhome.idea.vim.command.Command in project ideavim by JetBrains.
the class CopyGroup method yankMotion.
/**
* This yanks the text moved over by the motion command argument.
*
* @param editor The editor to yank from
* @param context The data context
* @param count The number of times to yank
* @param rawCount The actual count entered by the user
* @param argument The motion command argument
* @return true if able to yank the text, false if not
*/
public boolean yankMotion(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
TextRange range = MotionGroup.getMotionRange(editor, context, count, rawCount, argument, true);
final Command motion = argument.getMotion();
return motion != null && yankRange(editor, range, SelectionType.fromCommandFlags(motion.getFlags()), true);
}
Aggregations