1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-17 16:31:45 +02:00

Compare commits

...

16 Commits
0.46 ... 0.48

Author SHA1 Message Date
Andrey Vlasovskikh
120b69c439 Fixed source API compatibility with branch 171 2017-01-15 23:22:40 +03:00
Andrey Vlasovskikh
b68daf3f3e Version 0.48 2017-01-15 23:01:53 +03:00
Andrey Vlasovskikh
c32a1a5e5b Updated changelog and list of contributors 2016-11-29 00:43:41 +03:00
Andrey Vlasovskikh
a5e303d1ca Merge pull request #121 from gaganis/VIM-1216
Fixed . reseting the last find movement
2016-11-29 00:35:40 +03:00
Giorgos Gaganis
c4d8cef44d Fixed . reseting the last find movement where repeating change that also uses movement.
On the original vim when we repeat a change with . that also contain an find movement the last find that was typed before the repeat is the one used by the motion repeat ;. Before the commit the plugin would have reset the last movement to use the movement contained in the command that was repeated.

To solve this I took a simple approach where I save the last find motion before starting the repeat and then restoring it to its original value after the repeat is over. In order to access the find motion fields from RepeatChangeAction I created getters in MotionGroup for the movement type and character.

	modified:   src/com/maddyhome/idea/vim/action/change/RepeatChangeAction.java
	modified:   src/com/maddyhome/idea/vim/group/MotionGroup.java
	modified:   test/org/jetbrains/plugins/ideavim/action/ChangeActionTest.java
2016-11-28 19:05:11 +02:00
Andrey Vlasovskikh
72fbe758b4 VIM-1205 Don't move key handling into separate event for raw handlers 2016-11-22 21:58:32 +03:00
Andrey Vlasovskikh
563092cffb Fixed caret model exception when changing selection in documents open in several editors 2016-10-21 18:11:15 +03:00
Andrey Vlasovskikh
9a2a0c3b0e Split several channel names by comma 2016-10-19 17:26:23 +03:00
Andrey Vlasovskikh
f3b4726b34 Version 0.47 2016-10-19 15:58:35 +03:00
Andrey Vlasovskikh
30d7c6edf1 Remove obsolete pluginId 2016-09-30 21:15:51 +03:00
Andrey Vlasovskikh
f33f73d2f5 VIM-1190 Fixed exception "Write access is allowed from write-safe contexts only"
We now use IntelliJ's version of invokeLater() in order to satisfy the
new protocol for running read-write actions in modal dialogs.
2016-09-30 20:44:16 +03:00
Andrey Vlasovskikh
b595dfd443 VIM-1098 Don't start visual selection when mouse click was actually drag over single character 2016-09-01 20:50:55 +03:00
Andrey Vlasovskikh
a3e15b5c76 Possibility to publish the plugin to multiple channels 2016-09-01 18:32:16 +03:00
Andrey Vlasovskikh
31d85c0221 Update gradle-intellij-plugin to 0.2.0-SNAPSHOT for multi-channel plugin publishing 2016-09-01 18:26:30 +03:00
Andrey Vlasovskikh
124bd55e18 Update gradle-intellij-plugin to 0.0.43 2016-07-08 12:19:02 +03:00
Andrey Vlasovskikh
bb9b5b5bde Use IntelliJ 15.0.5 by default 2016-07-08 12:19:02 +03:00
17 changed files with 100 additions and 91 deletions

View File

@@ -39,6 +39,7 @@ Contributors:
* [Daniel Leong](mailto:falcone88@gmail.com)
* [Aleksey Lagoshin](mailto:aleksey@pri-num.com)
* [Paulo Bu](mailto:pbu_98@yahoo.com)
* [Giorgos Gaganis](mailto:gaganis@yahoo.com)
If you are a contributor and your name is not listed here, feel free to
contact the maintainer.

View File

@@ -17,6 +17,28 @@ Please note that the quality of EAP versions may at times be way below even
usual beta standards.
0.48, 2017-01-15
----------------
A bugfix release.
Bug fixes:
* [VIM-1205](https://youtrack.jetbrains.com/issue/VIM-1205) Don't move key handling into separate event for raw handlers
* [VIM-1216](https://youtrack.jetbrains.com/issue/VIM-1216) Fixed `.` resetting the last find movement while repeating change that also uses movement
0.47, 2016-10-19
----------------
A bugfix release.
Bug fixes:
* VIM-1098 Don't start visual selection when mouse click was actually drag over single character
* VIM-1190 Fixed exception "Write access is allowed from write-safe contexts only"
0.46, 2016-07-07
----------------

View File

@@ -1,7 +1,19 @@
plugins {
id "org.jetbrains.intellij" version "0.0.39"
buildscript {
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url 'http://dl.bintray.com/jetbrains/intellij-plugin-service'
}
}
dependencies {
classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.2.0-SNAPSHOT"
}
}
apply plugin: 'org.jetbrains.intellij'
apply plugin: 'java'
sourceCompatibility = javaVersion
@@ -26,8 +38,7 @@ intellij {
downloadSources Boolean.valueOf(downloadIdeaSources)
publish {
pluginId '164'
channel publishChannel
channels publishChannels.split(',')
username publishUsername
password publishPassword
}

View File

@@ -1,7 +1,7 @@
ideaVersion IC-15.0.2
ideaVersion IC-15.0.5
downloadIdeaSources true
version SNAPSHOT
javaVersion 1.6
publishUsername username
publishPassword password
publishChannel eap
publishChannels eap

View File

@@ -2,6 +2,14 @@
<name>IdeaVim</name>
<id>IdeaVIM</id>
<change-notes><![CDATA[
<p>0.48:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.47:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.46:</p>
<ul>
<li>Support for <code>incsearch</code> option for showing search results while typing</li>
@@ -18,42 +26,6 @@
<ul>
<li>Fixed running the plugin with Java 6</li>
</ul>
<p>0.42:</p>
<ul>
<li>Fixed move commands in read-only files</li>
</ul>
<p>0.41:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.40:</p>
<ul>
<li>Support for <code>mapleader</code></li>
<li>Support comments in <code>%</code> brace matching</li>
<li>Various bug fixes</li>
</ul>
<p>0.39:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.38:</p>
<ul>
<li>Support for <code>:action</code> and <code>:actionlist</code> for executing arbitrary IDE actions</li>
<li>Support for <code>number</code> and <code>relativenumber</code> options</li>
<li>Support for <code>clipboard=unnamed</code> option</li>
<li>Various bug fixes</li>
</ul>
<p>0.37:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.36:</p>
<ul>
<li>Window commands from the <code>&lt;C-W&gt;</code> family</li>
<li>Support for <code>:split</code>/<code>:vsplit</code> commands</li>
<li>Fixed visual block selection mode</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>
<description><![CDATA[

View File

@@ -49,18 +49,12 @@ public class VimTypedActionHandler implements TypedActionHandler {
@Override
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
if (isEnabled(editor)) {
// Run key handler outside of the key typed command for creating our own undoable commands
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
}
catch (Throwable e) {
logger.error(e);
}
}
});
try {
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
}
catch (Throwable e) {
logger.error(e);
}
}
else {
origHandler.execute(editor, charTyped, context);

View File

@@ -98,18 +98,12 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
notifyAboutShortcutConflict(keyStroke);
}
// Should we use InjectedLanguageUtil.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
// Run key handler later to restore input events sequence due to VimTypedActionHandler
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
}
catch (Throwable throwable) {
ourLogger.error(throwable);
}
}
});
try {
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
}
catch (Throwable throwable) {
ourLogger.error(throwable);
}
}
}

View File

@@ -41,6 +41,7 @@ public class RepeatChangeAction extends EditorAction {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
CommandState state = CommandState.getInstance(editor);
Command cmd = state.getLastChangeCommand();
if (cmd != null) {
if (command.getRawCount() > 0) {
cmd.setCount(command.getCount());
@@ -53,6 +54,9 @@ public class RepeatChangeAction extends EditorAction {
}
}
Command save = state.getCommand();
int lastFTCmd = VimPlugin.getMotion().getLastFTCmd();
char lastFTChar = VimPlugin.getMotion().getLastFTChar();
state.setCommand(cmd);
state.pushState(CommandState.Mode.REPEAT, CommandState.SubMode.NONE, MappingMode.NORMAL);
char reg = VimPlugin.getRegister().getCurrentRegister();
@@ -67,6 +71,7 @@ public class RepeatChangeAction extends EditorAction {
if (save != null) {
state.setCommand(save);
}
VimPlugin.getMotion().setLastFTCmd(lastFTCmd, lastFTChar);
state.saveLastChangeCommand(cmd);
VimPlugin.getRegister().selectRegister(reg);

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.ex.handler;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.VimPlugin;
@@ -29,8 +30,6 @@ import com.maddyhome.idea.vim.ex.ExException;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class EditFileHandler extends CommandHandler {
public EditFileHandler() {
super(new CommandName[]{
@@ -56,7 +55,7 @@ public class EditFileHandler extends CommandHandler {
}
// Don't open a choose file dialog under a write action
SwingUtilities.invokeLater(new Runnable() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
KeyHandler.executeAction("OpenFile", new EditorDataContext(editor));

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.ex.handler;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.VimPlugin;
@@ -27,8 +28,6 @@ import com.maddyhome.idea.vim.ex.ExCommand;
import com.maddyhome.idea.vim.ex.ExException;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
*
*/
@@ -48,7 +47,7 @@ public class FindClassHandler extends CommandHandler {
return res;
}
SwingUtilities.invokeLater(new Runnable() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
KeyHandler.executeAction("GotoClass", context);
}

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.ex.handler;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.VimPlugin;
@@ -27,8 +28,6 @@ import com.maddyhome.idea.vim.ex.ExCommand;
import com.maddyhome.idea.vim.ex.ExException;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
*
*/
@@ -48,7 +47,7 @@ public class FindFileHandler extends CommandHandler {
return res;
}
SwingUtilities.invokeLater(new Runnable() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
KeyHandler.executeAction("GotoFile", context);
}

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.ex.handler;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.ex.CommandHandler;
@@ -26,8 +27,6 @@ import com.maddyhome.idea.vim.ex.ExCommand;
import com.maddyhome.idea.vim.ex.ExException;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
*
*/
@@ -38,7 +37,7 @@ public class FindSymbolHandler extends CommandHandler {
public boolean execute(@NotNull Editor editor, @NotNull final DataContext context, @NotNull ExCommand cmd) throws ExException {
// TODO: Check the command argument and jump to a specific symbol
SwingUtilities.invokeLater(new Runnable() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
KeyHandler.executeAction("GotoSymbol", context);
}

View File

@@ -182,7 +182,7 @@ public class KeyGroup {
final KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
final Keymap keymap = keymapManager.getActiveKeymap();
final KeyboardShortcut shortcut = new KeyboardShortcut(keyStroke, null);
final Map<String, ArrayList<KeyboardShortcut>> conflicts = keymap.getConflicts("", shortcut);
final Map<String, ? extends List<KeyboardShortcut>> conflicts = keymap.getConflicts("", shortcut);
final List<AnAction> actions = new ArrayList<AnAction>();
for (String actionId : conflicts.keySet()) {
final AnAction action = ActionManagerEx.getInstanceEx().getAction(actionId);

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.group;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
@@ -127,7 +128,7 @@ public class MacroGroup {
}
};
SwingUtilities.invokeLater(new Runnable() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
CommandProcessor.getInstance().executeCommand(project, run, "Vim Macro Playback", keys.get(pos));
}
@@ -137,7 +138,7 @@ public class MacroGroup {
public void postKey(@NotNull KeyStroke stroke, @NotNull Editor editor) {
final Component component = SwingUtilities.getAncestorOfClass(Window.class, editor.getComponent());
final KeyEvent event = createKeyEvent(stroke, component);
SwingUtilities.invokeLater(new Runnable() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
if (logger.isDebugEnabled()) {
logger.debug("posting " + event);

View File

@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.event.*;
import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManagerAdapter;
@@ -149,14 +150,11 @@ public class MotionGroup {
ExOutputModel.getInstance(editor).clear();
CommandState.SubMode visualMode = CommandState.SubMode.NONE;
switch (event.getClickCount() % 3) {
case 1: // Single click or quad click
visualMode = CommandState.SubMode.NONE;
break;
case 2: // Double click
switch (event.getClickCount()) {
case 2:
visualMode = CommandState.SubMode.VISUAL_CHARACTER;
break;
case 0: // Triple click
case 3:
visualMode = CommandState.SubMode.VISUAL_LINE;
// Pop state of being in Visual Char mode
if (CommandState.getInstance(editor).getMode() == CommandState.Mode.VISUAL) {
@@ -247,6 +245,7 @@ public class MotionGroup {
int start = editor.getSelectionModel().getSelectionStart();
int end = editor.getSelectionModel().getSelectionEnd();
if (start == end) return;
if (mode == CommandState.SubMode.VISUAL_LINE) {
end--;
@@ -1730,15 +1729,16 @@ public class MotionGroup {
private boolean myMakingChanges = false;
public void selectionChanged(@NotNull SelectionEvent selectionEvent) {
if (myMakingChanges) {
final Editor editor = selectionEvent.getEditor();
final Document document = editor.getDocument();
if (myMakingChanges || (document instanceof DocumentEx && ((DocumentEx)document).isInEventsHandling())) {
return;
}
myMakingChanges = true;
try {
final Editor editor = selectionEvent.getEditor();
final com.intellij.openapi.util.TextRange newRange = selectionEvent.getNewRange();
for (Editor e : EditorFactory.getInstance().getEditors(editor.getDocument())) {
for (Editor e : EditorFactory.getInstance().getEditors(document)) {
if (!e.equals(editor)) {
e.getSelectionModel().setSelection(newRange.getStartOffset(), newRange.getEndOffset());
}
@@ -1811,6 +1811,14 @@ public class MotionGroup {
private int endOff;
}
public int getLastFTCmd() {
return lastFTCmd;
}
public char getLastFTChar() {
return lastFTChar;
}
private int lastFTCmd = 0;
private char lastFTChar;
private int visualStart;

View File

@@ -18,6 +18,7 @@
package com.maddyhome.idea.vim.ui;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.ui.components.JBScrollPane;
@@ -262,7 +263,7 @@ public class ExOutputPanel extends JPanel {
}
private void close(@Nullable final KeyEvent e) {
SwingUtilities.invokeLater(new Runnable() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
deactivate(true);

View File

@@ -572,4 +572,8 @@ public class ChangeActionTest extends VimTestCase {
"<caret>\n" +
"and some text after\n");
}
public void testRepeatChangeWordDoesNotBreakNextRepeatFind() {
doTest(parseKeys("fXcfYPATATA<Esc>fX.;."), "<caret>aaaaXBBBBYaaaaaaaXBBBBYaaaaaaXBBBBYaaaaaaaa\n", "aaaaPATATAaaaaaaaPATATAaaaaaaPATATAaaaaaaaa\n");
}
}