|
|||||||||
| Home >> All >> com >> maddyhome >> idea >> vim >> [ helper overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.maddyhome.idea.vim.helper
Class EditorHelper

java.lang.Objectcom.maddyhome.idea.vim.helper.EditorHelper
- public class EditorHelper
- extends java.lang.Object
This is a set of helper methods for working with editors. All line and column values are zero based.
| Constructor Summary | |
EditorHelper()
|
|
| Method Summary | |
static int |
characterPositionToOffset(Editor editor,
com.maddyhome.idea.vim.common.CharacterPosition pos)
|
static int |
getCurrentLogicalColumn(Editor editor)
Gets the logical column number the cursor is on |
static int |
getCurrentLogicalLine(Editor editor)
Gets the logical line number the cursor is on |
static int |
getCurrentVisualColumn(Editor editor)
Gets the visual column number the cursor is on |
static int |
getCurrentVisualLine(Editor editor)
Gets the visual line number the cursor is on |
static Editor |
getEditor(FileEditorManager manager,
VirtualFile file)
Gets the editor for the virtual file within the editor mananger. |
static int |
getFileSize(Editor editor)
Gets the actual number of characters in the file |
static java.nio.CharBuffer |
getLineBuffer(Editor editor,
int lline)
|
static int |
getLineCharCount(Editor editor,
int lline)
|
static int |
getLineCount(Editor editor)
Gets the number of actual lines in the file |
static int |
getLineEndForOffset(Editor editor,
int offset)
Gets the offset of the end of the line containing the supplied offset |
static int |
getLineEndOffset(Editor editor,
int lline,
boolean incEnd)
Returns the offset of the end of the requested line. |
static int |
getLineLength(Editor editor)
Gets the number of characters on the current line. |
static int |
getLineLength(Editor editor,
int lline)
Gets the number of characters on the specified logical line. |
static int |
getLineStartForOffset(Editor editor,
int offset)
Gets the offset of the start of the line containing the supplied offset |
static int |
getLineStartOffset(Editor editor,
int lline)
Returns the offset of the start of the requested line. |
static java.lang.String |
getLineText(Editor editor,
int lline)
Returns the text of the requested logical line |
static int |
getScreenHeight(Editor editor)
Gets the number of lines than can be displayed on the screen at one time. |
static int |
getScreenWidth(Editor editor)
Gets the number of characters that are visible on a screen line |
static java.lang.String |
getText(Editor editor,
int start,
int end)
Gets a string representation of the file for the supplied offset range |
static int |
getVisualLineCount(Editor editor)
Gets the number of visible lines in the editor. |
static int |
getVisualLineLength(Editor editor,
int vline)
Gets the number of characters on the specified visual line. |
static int |
logicalLineToVisualLine(Editor editor,
int lline)
Converts a logical line number to a visual line number. |
static int |
normalizeColumn(Editor editor,
int lline,
int col)
Ensures that the supplied column number for the given logical line is within the range 0 (incl) and the number of columns in the line (excl). |
static int |
normalizeLine(Editor editor,
int lline)
Ensures that the supplied logical line is within the range 0 (incl) and the number of logical lines in the file (excl). |
static int |
normalizeOffset(Editor editor,
int offset,
boolean allowEnd)
|
static int |
normalizeOffset(Editor editor,
int lline,
int offset,
boolean allowEnd)
Ensures that the supplied offset for the given logical line is within the range for the line. |
static int |
normalizeVisualColumn(Editor editor,
int vline,
int col)
Ensures that the supplied column number for the given visual line is within the range 0 (incl) and the number of columns in the line (excl). |
static int |
normalizeVisualLine(Editor editor,
int vline)
Ensures that the supplied visual line is within the range 0 (incl) and the number of visual lines in the file (excl). |
static com.maddyhome.idea.vim.common.CharacterPosition |
offsetToCharacterPosition(Editor editor,
int offset)
|
static int |
visualLineToLogicalLine(Editor editor,
int vline)
Converts a visual line number to a logical line number. |
static int |
visualPostionToOffset(Editor editor,
VisualPosition pos)
Converts a visual position to a file offset |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
EditorHelper
public EditorHelper()
| Method Detail |
getCurrentVisualLine
public static int getCurrentVisualLine(Editor editor)
- Gets the visual line number the cursor is on
getCurrentVisualColumn
public static int getCurrentVisualColumn(Editor editor)
- Gets the visual column number the cursor is on
getCurrentLogicalLine
public static int getCurrentLogicalLine(Editor editor)
- Gets the logical line number the cursor is on
getCurrentLogicalColumn
public static int getCurrentLogicalColumn(Editor editor)
- Gets the logical column number the cursor is on
getLineLength
public static int getLineLength(Editor editor)
- Gets the number of characters on the current line. This will be different than the number of visual
characters if there are "real" tabs in the line.
getLineLength
public static int getLineLength(Editor editor,
int lline)
- Gets the number of characters on the specified logical line. This will be different than the number of visual
characters if there are "real" tabs in the line.
getVisualLineLength
public static int getVisualLineLength(Editor editor,
int vline)
- Gets the number of characters on the specified visual line. This will be different than the number of visual
characters if there are "real" tabs in the line.
getVisualLineCount
public static int getVisualLineCount(Editor editor)
- Gets the number of visible lines in the editor. This will less then the actual number of lines in the file
if there are any collapsed folds.
getLineCount
public static int getLineCount(Editor editor)
- Gets the number of actual lines in the file
getFileSize
public static int getFileSize(Editor editor)
- Gets the actual number of characters in the file
getScreenHeight
public static int getScreenHeight(Editor editor)
- Gets the number of lines than can be displayed on the screen at one time. This is rounded down to the
nearest whole line if there is a parial line visible at the bottom of the screen.
getScreenWidth
public static int getScreenWidth(Editor editor)
- Gets the number of characters that are visible on a screen line
visualLineToLogicalLine
public static int visualLineToLogicalLine(Editor editor,
int vline)
- Converts a visual line number to a logical line number.
logicalLineToVisualLine
public static int logicalLineToVisualLine(Editor editor,
int lline)
- Converts a logical line number to a visual line number. Several logical lines can map to the same
visual line when there are collapsed fold regions.
getLineStartOffset
public static int getLineStartOffset(Editor editor,
int lline)
- Returns the offset of the start of the requested line.
getLineEndOffset
public static int getLineEndOffset(Editor editor,
int lline,
boolean incEnd)
- Returns the offset of the end of the requested line.
normalizeVisualLine
public static int normalizeVisualLine(Editor editor,
int vline)
- Ensures that the supplied visual line is within the range 0 (incl) and the number of visual lines in the file
(excl).
normalizeLine
public static int normalizeLine(Editor editor,
int lline)
- Ensures that the supplied logical line is within the range 0 (incl) and the number of logical lines in the file
(excl).
normalizeVisualColumn
public static int normalizeVisualColumn(Editor editor,
int vline,
int col)
- Ensures that the supplied column number for the given visual line is within the range 0 (incl) and the
number of columns in the line (excl).
normalizeColumn
public static int normalizeColumn(Editor editor,
int lline,
int col)
- Ensures that the supplied column number for the given logical line is within the range 0 (incl) and the
number of columns in the line (excl).
normalizeOffset
public static int normalizeOffset(Editor editor,
int lline,
int offset,
boolean allowEnd)
- Ensures that the supplied offset for the given logical line is within the range for the line. If allowEnd
is true, the range will allow for the offset to be one past the last character on the line.
normalizeOffset
public static int normalizeOffset(Editor editor,
int offset,
boolean allowEnd)
getEditor
public static Editor getEditor(FileEditorManager manager,
VirtualFile file)
- Gets the editor for the virtual file within the editor mananger.
visualPostionToOffset
public static int visualPostionToOffset(Editor editor,
VisualPosition pos)
- Converts a visual position to a file offset
getText
public static java.lang.String getText(Editor editor, int start, int end)
- Gets a string representation of the file for the supplied offset range
getLineStartForOffset
public static int getLineStartForOffset(Editor editor,
int offset)
- Gets the offset of the start of the line containing the supplied offset
getLineEndForOffset
public static int getLineEndForOffset(Editor editor,
int offset)
- Gets the offset of the end of the line containing the supplied offset
getLineCharCount
public static int getLineCharCount(Editor editor,
int lline)
getLineText
public static java.lang.String getLineText(Editor editor, int lline)
- Returns the text of the requested logical line
offsetToCharacterPosition
public static com.maddyhome.idea.vim.common.CharacterPosition offsetToCharacterPosition(Editor editor, int offset)
characterPositionToOffset
public static int characterPositionToOffset(Editor editor,
com.maddyhome.idea.vim.common.CharacterPosition pos)
getLineBuffer
public static java.nio.CharBuffer getLineBuffer(Editor editor, int lline)
|
|||||||||
| Home >> All >> com >> maddyhome >> idea >> vim >> [ helper overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.maddyhome.idea.vim.helper.EditorHelper