mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-08 18:40:37 +02:00
Remove unnecessary user data (wasVisualBlock)
This commit is contained in:
parent
1ad9dd4a28
commit
94e4556bee
src/com/maddyhome/idea/vim
action/change/change
command
handler
helper
@ -29,7 +29,6 @@ import com.maddyhome.idea.vim.command.MappingMode;
|
||||
import com.maddyhome.idea.vim.command.SelectionType;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.EditorData;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import com.maddyhome.idea.vim.helper.VimSelection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -52,7 +51,7 @@ public class ChangeVisualLinesEndAction extends VimCommandAction {
|
||||
@NotNull Command cmd,
|
||||
@NotNull VimSelection range) {
|
||||
TextRange vimTextRange = range.toVimTextRange(true);
|
||||
if (EditorData.wasVisualBlockMode(editor) && vimTextRange.isMultiple()) {
|
||||
if (range.getType() == SelectionType.BLOCK_WISE && vimTextRange.isMultiple()) {
|
||||
final int[] starts = vimTextRange.getStartOffsets();
|
||||
final int[] ends = vimTextRange.getEndOffsets();
|
||||
for (int i = 0; i < starts.length; i++) {
|
||||
|
@ -24,6 +24,7 @@ import com.maddyhome.idea.vim.helper.EditorData;
|
||||
import com.maddyhome.idea.vim.key.ParentNode;
|
||||
import com.maddyhome.idea.vim.option.NumberOption;
|
||||
import com.maddyhome.idea.vim.option.Options;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -56,6 +57,7 @@ public class CommandState {
|
||||
myLastChangeRegister = VimPlugin.getRegister().getDefaultRegister();
|
||||
}
|
||||
|
||||
@Contract("null -> new")
|
||||
@NotNull
|
||||
public static CommandState getInstance(@Nullable Editor editor) {
|
||||
if (editor == null) {
|
||||
|
@ -64,7 +64,6 @@ sealed class VisualOperatorActionHandler : EditorActionHandlerBase(false) {
|
||||
logger.debug("execute, cmd=$cmd")
|
||||
|
||||
EditorData.setChangeSwitchMode(editor, null)
|
||||
EditorData.setWasVisualBlockMode(editor, CommandState.inVisualBlockMode(editor))
|
||||
|
||||
if (CommandState.getInstance(editor).mode == CommandState.Mode.VISUAL) {
|
||||
val range = editor.visualBlockRange
|
||||
|
@ -205,21 +205,6 @@ public class EditorData {
|
||||
editor.putUserData(CHANGE_ACTION_SWITCH_MODE, mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visual block mode flag in the beginning of handling visual operator actions
|
||||
*/
|
||||
public static boolean wasVisualBlockMode(@NotNull Editor editor) {
|
||||
Boolean res = editor.getUserData(WAS_VISUAL_BLOCK_MODE);
|
||||
return res != null && res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visual block mode flag in the beginning of handling visual operator actions
|
||||
*/
|
||||
public static void setWasVisualBlockMode(@NotNull Editor editor, boolean value) {
|
||||
editor.putUserData(WAS_VISUAL_BLOCK_MODE, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a static helper - no instances needed
|
||||
*/
|
||||
@ -240,7 +225,6 @@ public class EditorData {
|
||||
private static final Key<TestInputModel> TEST_INPUT_MODEL = new Key<TestInputModel>("IdeaVim.testInputModel");
|
||||
private static final Key<Boolean> IS_KEEPING_VISUAL_OPERATOR_ACTION = new Key<>("isKeepingVisualOperatorAction");
|
||||
private static final Key<CommandState.Mode> CHANGE_ACTION_SWITCH_MODE = new Key<>("changeActionSwitchMode");
|
||||
private static final Key<Boolean> WAS_VISUAL_BLOCK_MODE = new Key<>("wasVisualBlockMode");
|
||||
|
||||
private static final Logger logger = Logger.getInstance(EditorData.class.getName());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user