mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-17 16:31:45 +02:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
421ce832dd | ||
![]() |
987781f826 | ||
![]() |
d85a41ea98 | ||
![]() |
42f86a3f73 |
12
CHANGES.md
12
CHANGES.md
@@ -4,6 +4,18 @@ The Changelog
|
||||
History of changes in IdeaVim for the IntelliJ platform.
|
||||
|
||||
|
||||
0.29, TBD
|
||||
---------
|
||||
|
||||
A bugfix release.
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* VIM-482 Fixed repeat buffer limits
|
||||
* VIM-91 Enable normal `<Enter>` handling for one-line editors
|
||||
* VIM-121 Don't move cursor while scrolling
|
||||
|
||||
|
||||
0.28, 2013-04-06
|
||||
----------------
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
version-id:0.28
|
||||
version-id:0.29
|
||||
platform-version:110.0
|
||||
idea.download.url=http://download.jetbrains.com/idea/ideaIU-12.1.zip
|
||||
build.number=x
|
||||
|
@@ -3,6 +3,12 @@
|
||||
<id>IdeaVIM</id>
|
||||
<change-notes>
|
||||
<![CDATA[
|
||||
<p>0.29:</p>
|
||||
<ul>
|
||||
<li>Fixed repeat buffer limits</li>
|
||||
<li>Enable normal <code><Enter></code> handling for one-line editors</li>
|
||||
<li>Don't move cursor while scrolling</li>
|
||||
</ul>
|
||||
<p>0.28:</p>
|
||||
<ul>
|
||||
<li>Fixed reconfigure Vim keymap for user-defined base keymaps</li>
|
||||
@@ -21,15 +27,6 @@
|
||||
<li>New shortcuts for Go to declaration <code><C-]></code> and Navigate back <code><C-T></code></li>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>0.25:</p>
|
||||
<ul>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>0.24:</p>
|
||||
<ul>
|
||||
<li>Added Vim string object selection motions (see help topics <code>v_i"</code>, <code>v_a"</code>)</li>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
|
||||
]]>
|
||||
</change-notes>
|
||||
|
@@ -36,12 +36,7 @@ public class InsertEnterAction extends EditorAction {
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(Editor editor, @NotNull DataContext context) {
|
||||
editor = InjectedLanguageUtil.getTopLevelEditor(editor);
|
||||
if (editor.isOneLineMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandGroups.getInstance().getChange().processEnter(editor, context);
|
||||
CommandGroups.getInstance().getChange().processEnter(InjectedLanguageUtil.getTopLevelEditor(editor), context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -56,6 +56,9 @@ import java.util.List;
|
||||
* TODO - change cursor for the different modes
|
||||
*/
|
||||
public class ChangeGroup extends AbstractActionGroup {
|
||||
|
||||
public static final int MAX_REPEAT_CHARS_COUNT = 10000;
|
||||
|
||||
/**
|
||||
* Creates the group
|
||||
*/
|
||||
@@ -358,6 +361,7 @@ public class ChangeGroup extends AbstractActionGroup {
|
||||
else {
|
||||
lastInsert = state.getCommand();
|
||||
strokes.clear();
|
||||
repeatCharsCount = 0;
|
||||
if (document != null && documentListener != null) {
|
||||
document.removeDocumentListener(documentListener);
|
||||
}
|
||||
@@ -381,6 +385,11 @@ public class ChangeGroup extends AbstractActionGroup {
|
||||
final String newFragment = e.getNewFragment().toString();
|
||||
final String oldFragment = e.getOldFragment().toString();
|
||||
|
||||
// Repeat buffer limits
|
||||
if (repeatCharsCount > MAX_REPEAT_CHARS_COUNT) {
|
||||
return;
|
||||
}
|
||||
|
||||
// <Enter> is added to strokes as an action during processing in order to indent code properly in the repeat
|
||||
// command
|
||||
if (newFragment.startsWith("\n") && newFragment.trim().isEmpty()) {
|
||||
@@ -409,9 +418,8 @@ public class ChangeGroup extends AbstractActionGroup {
|
||||
}
|
||||
}
|
||||
|
||||
for (char c : newFragment.toCharArray()) {
|
||||
strokes.add(c);
|
||||
}
|
||||
strokes.add(newFragment.toCharArray());
|
||||
repeatCharsCount += newFragment.length();
|
||||
|
||||
if (newFragment.length() > 0) {
|
||||
// TODO: If newFragment is shorter than oldFragment?
|
||||
@@ -486,8 +494,11 @@ public class ChangeGroup extends AbstractActionGroup {
|
||||
KeyHandler.executeAction((AnAction)lastStroke, context);
|
||||
strokes.add(lastStroke);
|
||||
}
|
||||
else if (lastStroke instanceof Character) {
|
||||
processKey(editor, context, KeyStroke.getKeyStroke((Character)lastStroke));
|
||||
else if (lastStroke instanceof char[]) {
|
||||
final char[] chars = (char[])lastStroke;
|
||||
for (char c : chars) {
|
||||
processKey(editor, context, KeyStroke.getKeyStroke(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -542,10 +553,6 @@ public class ChangeGroup extends AbstractActionGroup {
|
||||
* @param context The data context
|
||||
*/
|
||||
public void processEnter(@NotNull Editor editor, @NotNull DataContext context) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (CommandState.getInstance(editor).getMode() == CommandState.Mode.REPLACE) {
|
||||
KeyHandler.executeAction("VimEditorToggleInsertState", context);
|
||||
}
|
||||
@@ -636,6 +643,7 @@ public class ChangeGroup extends AbstractActionGroup {
|
||||
*/
|
||||
private void clearStrokes(@NotNull Editor editor) {
|
||||
strokes.clear();
|
||||
repeatCharsCount = 0;
|
||||
insertStart = editor.getCaretModel().getOffset();
|
||||
}
|
||||
|
||||
@@ -1288,24 +1296,9 @@ public class ChangeGroup extends AbstractActionGroup {
|
||||
}
|
||||
|
||||
public void indentLines(@NotNull Editor editor, @NotNull DataContext context, int lines, int dir) {
|
||||
int cnt = 1;
|
||||
if (CommandState.inInsertMode(editor)) {
|
||||
if (strokes.size() > 0) {
|
||||
Object stroke = strokes.get(strokes.size() - 1);
|
||||
if (stroke instanceof Character) {
|
||||
Character key = (Character)stroke;
|
||||
if (key == '0') {
|
||||
deleteCharacter(editor, -1, false);
|
||||
cnt = 99;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int start = editor.getCaretModel().getOffset();
|
||||
int end = CommandGroups.getInstance().getMotion().moveCaretToLineEndOffset(editor, lines - 1, false);
|
||||
|
||||
indentRange(editor, context, new TextRange(start, end), cnt, dir);
|
||||
indentRange(editor, context, new TextRange(start, end), 1, dir);
|
||||
}
|
||||
|
||||
public void indentMotion(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @NotNull Argument argument, int dir) {
|
||||
@@ -1620,6 +1613,7 @@ public class ChangeGroup extends AbstractActionGroup {
|
||||
}
|
||||
|
||||
private final List<Object> strokes = new ArrayList<Object>();
|
||||
private int repeatCharsCount;
|
||||
private List<Object> lastStrokes;
|
||||
private int insertStart;
|
||||
@Nullable private Command lastInsert;
|
||||
|
@@ -47,7 +47,6 @@ import com.maddyhome.idea.vim.ui.MorePanel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
|
||||
@@ -122,17 +121,13 @@ public class MotionGroup extends AbstractActionGroup {
|
||||
private void addEditorListener(@NotNull Editor editor) {
|
||||
editor.addEditorMouseListener(mouseHandler);
|
||||
editor.addEditorMouseMotionListener(mouseHandler);
|
||||
|
||||
editor.getSelectionModel().addSelectionListener(selectionHandler);
|
||||
editor.getScrollingModel().addVisibleAreaListener(scrollHandler);
|
||||
}
|
||||
|
||||
private void removeEditorListener(@NotNull Editor editor) {
|
||||
editor.removeEditorMouseListener(mouseHandler);
|
||||
editor.removeEditorMouseMotionListener(mouseHandler);
|
||||
|
||||
editor.getSelectionModel().removeSelectionListener(selectionHandler);
|
||||
editor.getScrollingModel().removeVisibleAreaListener(scrollHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1073,19 +1068,15 @@ public class MotionGroup extends AbstractActionGroup {
|
||||
}
|
||||
|
||||
private static boolean scrollLineToTopOfScreen(@NotNull Editor editor, int vline) {
|
||||
EditorScrollHandler.ignoreChanges(true);
|
||||
int pos = vline * editor.getLineHeight();
|
||||
int vpos = editor.getScrollingModel().getVerticalScrollOffset();
|
||||
editor.getScrollingModel().scrollVertically(pos);
|
||||
EditorScrollHandler.ignoreChanges(false);
|
||||
|
||||
return vpos != editor.getScrollingModel().getVerticalScrollOffset();
|
||||
}
|
||||
|
||||
private static void scrollColumnToLeftOfScreen(@NotNull Editor editor, int vcol) {
|
||||
EditorScrollHandler.ignoreChanges(true);
|
||||
editor.getScrollingModel().scrollHorizontally(vcol * EditorHelper.getColumnWidth(editor));
|
||||
EditorScrollHandler.ignoreChanges(false);
|
||||
}
|
||||
|
||||
public int moveCaretToMiddleColumn(@NotNull Editor editor) {
|
||||
@@ -1421,9 +1412,7 @@ public class MotionGroup extends AbstractActionGroup {
|
||||
updateSelection(editor, visualEnd);
|
||||
|
||||
editor.getCaretModel().moveToOffset(visualOffset);
|
||||
//EditorData.setLastColumn(editor, editor.getCaretModel().getVisualPosition().column);
|
||||
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
|
||||
//MotionGroup.moveCaret(editor, context, vr.getOffset());
|
||||
editor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1446,9 +1435,7 @@ public class MotionGroup extends AbstractActionGroup {
|
||||
updateSelection(editor, visualEnd);
|
||||
|
||||
editor.getCaretModel().moveToOffset(visualOffset);
|
||||
//EditorData.setLastColumn(editor, editor.getCaretModel().getVisualPosition().column);
|
||||
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
|
||||
//MotionGroup.moveCaret(editor, context, vr.getOffset());
|
||||
editor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1825,39 +1812,6 @@ public class MotionGroup extends AbstractActionGroup {
|
||||
private boolean makingChanges = false;
|
||||
}
|
||||
|
||||
private static class EditorScrollHandler implements VisibleAreaListener {
|
||||
public static void ignoreChanges(boolean ignore) {
|
||||
EditorScrollHandler.ignore = ignore;
|
||||
}
|
||||
|
||||
public void visibleAreaChanged(@NotNull VisibleAreaEvent visibleAreaEvent) {
|
||||
if (ignore) return;
|
||||
|
||||
Editor editor = visibleAreaEvent.getEditor();
|
||||
if (CommandState.inInsertMode(editor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("old=" + visibleAreaEvent.getOldRectangle());
|
||||
logger.debug("new=" + visibleAreaEvent.getNewRectangle());
|
||||
}
|
||||
|
||||
if (!visibleAreaEvent.getNewRectangle().equals(visibleAreaEvent.getOldRectangle())) {
|
||||
if (!EditorData.isConsoleOutput(editor) && !isTabSwitchEvent(visibleAreaEvent)) {
|
||||
MotionGroup.moveCaretToView(editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isTabSwitchEvent(@NotNull final VisibleAreaEvent visibleAreaEvent) {
|
||||
final Rectangle newRectangle = visibleAreaEvent.getNewRectangle();
|
||||
return newRectangle.width == 0 || newRectangle.height == 0;
|
||||
}
|
||||
|
||||
private static boolean ignore = false;
|
||||
}
|
||||
|
||||
private static class EditorMouseHandler implements EditorMouseListener, EditorMouseMotionListener {
|
||||
public void mouseMoved(EditorMouseEvent event) {
|
||||
// no-op
|
||||
@@ -1934,7 +1888,6 @@ public class MotionGroup extends AbstractActionGroup {
|
||||
private int visualOffset;
|
||||
@NotNull private EditorMouseHandler mouseHandler = new EditorMouseHandler();
|
||||
@NotNull private EditorSelectionHandler selectionHandler = new EditorSelectionHandler();
|
||||
@NotNull private EditorScrollHandler scrollHandler = new EditorScrollHandler();
|
||||
|
||||
private static Logger logger = Logger.getInstance(MotionGroup.class.getName());
|
||||
}
|
||||
|
Reference in New Issue
Block a user