Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.maddyhome.idea.vim.group
Class ChangeGroup  view ChangeGroup download ChangeGroup.java

java.lang.Object
  extended bycom.maddyhome.idea.vim.group.AbstractActionGroup
      extended bycom.maddyhome.idea.vim.group.ChangeGroup
All Implemented Interfaces:
ActionGroup

public class ChangeGroup
extends AbstractActionGroup

Provides all the insert/replace related functionality TODO - change cursor for the different modes


Nested Class Summary
static class ChangeGroup.InsertCheck
          This class listens for editor tab changes so any insert/replace modes that need to be reset can be
 
Field Summary
private  boolean inInsert
           
private  int insertStart
           
private  com.maddyhome.idea.vim.command.Command lastInsert
           
private  java.util.ArrayList lastStrokes
           
private static Logger logger
           
private  java.util.ArrayList strokes
           
 
Constructor Summary
ChangeGroup()
          Creates the group
 
Method Summary
 void autoIndentLines(Editor editor, DataContext context, int lines)
           
private  void changeCase(Editor editor, DataContext context, int start, int end, char type)
          This performs the actual case change.
 boolean changeCaseMotion(Editor editor, DataContext context, int count, int rawCount, char type, com.maddyhome.idea.vim.command.Argument argument)
          Changes the case of all the character moved over by the motion argument.
 boolean changeCaseRange(Editor editor, DataContext context, TextRange range, char type)
          Changes the case of all the characters in the range
 boolean changeCaseToggleCharacter(Editor editor, DataContext context, int count)
          Toggles the case of count characters
 boolean changeCharacter(Editor editor, DataContext context, int count, char ch)
          Replace each of the next count characters with the charcter ch
 boolean changeCharacterRange(Editor editor, DataContext context, TextRange range, char ch)
          Each character in the supplied range gets replaced with the character ch
 boolean changeCharacters(Editor editor, DataContext context, int count)
          Delete count characters and then enter insert mode
 boolean changeEndOfLine(Editor editor, DataContext context, int count)
          Delete from the cursor to the end of count - 1 lines down and enter insert mode
 boolean changeLine(Editor editor, DataContext context, int count)
          Delete count lines and then enter insert mode
 boolean changeMotion(Editor editor, DataContext context, int count, int rawCount, com.maddyhome.idea.vim.command.Argument argument)
          Delete the text covered by the motion command argument and enter insert mode
 boolean changeRange(Editor editor, DataContext context, TextRange range, int type)
          Deletes the range of text and enters insert mode
 boolean changeReplace(Editor editor, DataContext context)
          Begin Replace mode
private  void clearStrokes(Editor editor)
          Clears all the keystrokes from the current insert command
 boolean deleteCharacter(Editor editor, DataContext context, int count)
          Deletes count characters from the editor
 boolean deleteEndOfLine(Editor editor, DataContext context, int count)
          Delete from the cursor to the end of count - 1 lines down
 boolean deleteJoinLines(Editor editor, DataContext context, int count, boolean spaces)
          Joins count lines togetheri starting at the cursor.
private  boolean deleteJoinNLines(Editor editor, DataContext context, int startLine, int count, boolean spaces)
          This does the actual joining of the lines
 boolean deleteJoinRange(Editor editor, DataContext context, TextRange range, boolean spaces)
          Joins all the lines selected by the current visual selection.
 boolean deleteLine(Editor editor, DataContext context, int count)
          Deletes count lines including the current line
 boolean deleteMotion(Editor editor, DataContext context, int count, int rawCount, com.maddyhome.idea.vim.command.Argument argument, boolean isChange)
          Delete all text moved over by the supplied motion command argument.
 boolean deleteRange(Editor editor, DataContext context, TextRange range, int type)
          Delete the range of text.
private  boolean deleteText(Editor editor, DataContext context, int start, int end, int type)
          Delete text from the document.
 void indentLines(Editor editor, DataContext context, int lines, int dir)
           
 void indentMotion(Editor editor, DataContext context, int count, int rawCount, com.maddyhome.idea.vim.command.Argument argument, int dir)
           
 void indentRange(Editor editor, DataContext context, TextRange range, int count, int dir)
           
private  void initInsert(Editor editor, DataContext context, int mode)
          Begin insert/replace mode
 void insertAfterCursor(Editor editor, DataContext context)
          Begin insert after the cursor position
 void insertAfterLineEnd(Editor editor, DataContext context)
          Begin insert after the end of the current line
 void insertAtPreviousInsert(Editor editor, DataContext context)
          Begin insert at the location of the previous insert
 void insertBeforeCursor(Editor editor, DataContext context)
          Begin insert before the cursor position
 void insertBeforeFirstNonBlank(Editor editor, DataContext context)
          Begin insert before the first non-blank on the current line
 boolean insertCharacterAroundCursor(Editor editor, DataContext context, int dir)
          Inserts the character above/below the cursor at the cursor location
 boolean insertDeleteInsertedText(Editor editor, DataContext context)
          If the cursor is currently after the start of the current insert this deletes all the newly inserted text.
 boolean insertDeletePreviousWord(Editor editor, DataContext context)
          Deletes the text from the cursor to the start of the previous word
 void insertHelp(Editor editor, DataContext context)
          Exits insert mode and brings up the help system
 void insertLineStart(Editor editor, DataContext context)
          Begin insert before the start of the current line
 void insertNewLineAbove(Editor editor, DataContext context)
          Begin insert before the current line by creating a new blank line above the current line
 void insertNewLineBelow(Editor editor, DataContext context)
          Begin insert after the current line by creating a new blank line below the current line
 void insertPreviousInsert(Editor editor, DataContext context, boolean exit)
          Inserts the previously inserted text
 boolean insertRegister(Editor editor, DataContext context, char key)
          Inserts the contents of the specified register
 void insertText(Editor editor, DataContext context, int start, java.lang.String str)
          Insert text into the document
 boolean processCommand(Editor editor, DataContext context, com.maddyhome.idea.vim.command.Command cmd)
          This processes all keystrokes in Insert/Replace mode that were converted into Commands.
 void processEnter(Editor editor, DataContext context)
          Processes the user pressing the Enter key.
 void processEscape(Editor editor, DataContext context)
          Terminate insert/replace mode after the user presses Escape or Ctrl-C
 void processInsert(Editor editor, DataContext context)
          Processes the user pressing the Insert key while in INSERT or REPLACE mode.
 boolean processKey(Editor editor, DataContext context, javax.swing.KeyStroke key)
          This processes all "regular" keystrokes entered while in insert/replace mode
 void processSingleCommand(Editor editor, DataContext context)
          While in INSERT or REPLACE mode the user can enter a single NORMAL mode command and then automatically return to INSERT or REPLACE mode.
private  void repeatInsert(Editor editor, DataContext context, int count)
          This repeats the previous insert count times
private  void repeatInsertText(Editor editor, DataContext context, int count)
          This repeats the previous insert count times
private  void replaceText(Editor editor, DataContext context, int start, int end, java.lang.String str)
          Replace text in the editor
 
Methods inherited from class com.maddyhome.idea.vim.group.AbstractActionGroup
readData, saveData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

strokes

private java.util.ArrayList strokes

lastStrokes

private java.util.ArrayList lastStrokes

insertStart

private int insertStart

lastInsert

private com.maddyhome.idea.vim.command.Command lastInsert

inInsert

private boolean inInsert

logger

private static Logger logger
Constructor Detail

ChangeGroup

public ChangeGroup()
Creates the group

Method Detail

insertBeforeCursor

public void insertBeforeCursor(Editor editor,
                               DataContext context)
Begin insert before the cursor position


insertBeforeFirstNonBlank

public void insertBeforeFirstNonBlank(Editor editor,
                                      DataContext context)
Begin insert before the first non-blank on the current line


insertLineStart

public void insertLineStart(Editor editor,
                            DataContext context)
Begin insert before the start of the current line


insertAfterCursor

public void insertAfterCursor(Editor editor,
                              DataContext context)
Begin insert after the cursor position


insertAfterLineEnd

public void insertAfterLineEnd(Editor editor,
                               DataContext context)
Begin insert after the end of the current line


insertNewLineAbove

public void insertNewLineAbove(Editor editor,
                               DataContext context)
Begin insert before the current line by creating a new blank line above the current line


insertNewLineBelow

public void insertNewLineBelow(Editor editor,
                               DataContext context)
Begin insert after the current line by creating a new blank line below the current line


insertAtPreviousInsert

public void insertAtPreviousInsert(Editor editor,
                                   DataContext context)
Begin insert at the location of the previous insert


insertPreviousInsert

public void insertPreviousInsert(Editor editor,
                                 DataContext context,
                                 boolean exit)
Inserts the previously inserted text


insertHelp

public void insertHelp(Editor editor,
                       DataContext context)
Exits insert mode and brings up the help system


insertRegister

public boolean insertRegister(Editor editor,
                              DataContext context,
                              char key)
Inserts the contents of the specified register


insertCharacterAroundCursor

public boolean insertCharacterAroundCursor(Editor editor,
                                           DataContext context,
                                           int dir)
Inserts the character above/below the cursor at the cursor location


insertDeleteInsertedText

public boolean insertDeleteInsertedText(Editor editor,
                                        DataContext context)
If the cursor is currently after the start of the current insert this deletes all the newly inserted text. Otherwise it deletes all text from the cursor back to the first non-blank in the line.


insertDeletePreviousWord

public boolean insertDeletePreviousWord(Editor editor,
                                        DataContext context)
Deletes the text from the cursor to the start of the previous word


initInsert

private void initInsert(Editor editor,
                        DataContext context,
                        int mode)
Begin insert/replace mode


repeatInsert

private void repeatInsert(Editor editor,
                          DataContext context,
                          int count)
This repeats the previous insert count times


repeatInsertText

private void repeatInsertText(Editor editor,
                              DataContext context,
                              int count)
This repeats the previous insert count times


processEscape

public void processEscape(Editor editor,
                          DataContext context)
Terminate insert/replace mode after the user presses Escape or Ctrl-C


processEnter

public void processEnter(Editor editor,
                         DataContext context)
Processes the user pressing the Enter key. If this is REPLACE mode we need to turn off OVERWRITE before and then turn OVERWRITE back on after sending the "Enter" key.


processInsert

public void processInsert(Editor editor,
                          DataContext context)
Processes the user pressing the Insert key while in INSERT or REPLACE mode. This simply toggles the Insert/Overwrite state which updates the status bar.


processSingleCommand

public void processSingleCommand(Editor editor,
                                 DataContext context)
While in INSERT or REPLACE mode the user can enter a single NORMAL mode command and then automatically return to INSERT or REPLACE mode.


processKey

public boolean processKey(Editor editor,
                          DataContext context,
                          javax.swing.KeyStroke key)
This processes all "regular" keystrokes entered while in insert/replace mode


processCommand

public boolean processCommand(Editor editor,
                              DataContext context,
                              com.maddyhome.idea.vim.command.Command cmd)
This processes all keystrokes in Insert/Replace mode that were converted into Commands. Some of these commands need to be saved off so the inserted/replaced text can be repeated properly later if needed.


clearStrokes

private void clearStrokes(Editor editor)
Clears all the keystrokes from the current insert command


deleteCharacter

public boolean deleteCharacter(Editor editor,
                               DataContext context,
                               int count)
Deletes count characters from the editor


deleteLine

public boolean deleteLine(Editor editor,
                          DataContext context,
                          int count)
Deletes count lines including the current line


deleteEndOfLine

public boolean deleteEndOfLine(Editor editor,
                               DataContext context,
                               int count)
Delete from the cursor to the end of count - 1 lines down


deleteJoinLines

public boolean deleteJoinLines(Editor editor,
                               DataContext context,
                               int count,
                               boolean spaces)
Joins count lines togetheri starting at the cursor. No count or a count of one still joins two lines.


deleteJoinRange

public boolean deleteJoinRange(Editor editor,
                               DataContext context,
                               TextRange range,
                               boolean spaces)
Joins all the lines selected by the current visual selection.


deleteJoinNLines

private boolean deleteJoinNLines(Editor editor,
                                 DataContext context,
                                 int startLine,
                                 int count,
                                 boolean spaces)
This does the actual joining of the lines


deleteMotion

public boolean deleteMotion(Editor editor,
                            DataContext context,
                            int count,
                            int rawCount,
                            com.maddyhome.idea.vim.command.Argument argument,
                            boolean isChange)
Delete all text moved over by the supplied motion command argument.


deleteRange

public boolean deleteRange(Editor editor,
                           DataContext context,
                           TextRange range,
                           int type)
Delete the range of text.


changeReplace

public boolean changeReplace(Editor editor,
                             DataContext context)
Begin Replace mode


changeCharacter

public boolean changeCharacter(Editor editor,
                               DataContext context,
                               int count,
                               char ch)
Replace each of the next count characters with the charcter ch


changeCharacterRange

public boolean changeCharacterRange(Editor editor,
                                    DataContext context,
                                    TextRange range,
                                    char ch)
Each character in the supplied range gets replaced with the character ch


changeCharacters

public boolean changeCharacters(Editor editor,
                                DataContext context,
                                int count)
Delete count characters and then enter insert mode


changeLine

public boolean changeLine(Editor editor,
                          DataContext context,
                          int count)
Delete count lines and then enter insert mode


changeEndOfLine

public boolean changeEndOfLine(Editor editor,
                               DataContext context,
                               int count)
Delete from the cursor to the end of count - 1 lines down and enter insert mode


changeMotion

public boolean changeMotion(Editor editor,
                            DataContext context,
                            int count,
                            int rawCount,
                            com.maddyhome.idea.vim.command.Argument argument)
Delete the text covered by the motion command argument and enter insert mode


changeRange

public boolean changeRange(Editor editor,
                           DataContext context,
                           TextRange range,
                           int type)
Deletes the range of text and enters insert mode


changeCaseToggleCharacter

public boolean changeCaseToggleCharacter(Editor editor,
                                         DataContext context,
                                         int count)
Toggles the case of count characters


changeCaseMotion

public boolean changeCaseMotion(Editor editor,
                                DataContext context,
                                int count,
                                int rawCount,
                                char type,
                                com.maddyhome.idea.vim.command.Argument argument)
Changes the case of all the character moved over by the motion argument.


changeCaseRange

public boolean changeCaseRange(Editor editor,
                               DataContext context,
                               TextRange range,
                               char type)
Changes the case of all the characters in the range


changeCase

private void changeCase(Editor editor,
                        DataContext context,
                        int start,
                        int end,
                        char type)
This performs the actual case change.


autoIndentLines

public void autoIndentLines(Editor editor,
                            DataContext context,
                            int lines)

indentLines

public void indentLines(Editor editor,
                        DataContext context,
                        int lines,
                        int dir)

indentMotion

public void indentMotion(Editor editor,
                         DataContext context,
                         int count,
                         int rawCount,
                         com.maddyhome.idea.vim.command.Argument argument,
                         int dir)

indentRange

public void indentRange(Editor editor,
                        DataContext context,
                        TextRange range,
                        int count,
                        int dir)

insertText

public void insertText(Editor editor,
                       DataContext context,
                       int start,
                       java.lang.String str)
Insert text into the document


deleteText

private boolean deleteText(Editor editor,
                           DataContext context,
                           int start,
                           int end,
                           int type)
Delete text from the document. This will fail if being asked to store the deleted text into a read-only register.


replaceText

private void replaceText(Editor editor,
                         DataContext context,
                         int start,
                         int end,
                         java.lang.String str)
Replace text in the editor