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

Compare commits

...

7 Commits
0.36 ... 0.37

Author SHA1 Message Date
Andrey Vlasovskikh
26b49b1a0c Made the description shorter 2014-10-15 15:22:40 +04:00
Andrey Vlasovskikh
ef32648ddc Bumped version to 0.37 2014-10-15 15:17:42 +04:00
Andrey Vlasovskikh
c873524cb1 VIM-784 Fixed visual line selection where start > end of the selection range
It was a regression introduced by the fix of VIM-632.
2014-10-15 15:10:22 +04:00
Andrey Vlasovskikh
2d11561041 Added Andrew Brookins to the list of contributors 2014-10-14 15:28:23 +04:00
Andrey Vlasovskikh
f7643b6bb3 Updated changelist 2014-10-14 15:28:07 +04:00
Andrey Vlasovskikh
d3afd83e8e Merge branch 'VIM-407' 2014-10-14 15:25:43 +04:00
Andrew Brookins
19365effa9 VIM-407 Add tests. Only skip the ending line if it is empty.
Conflicts:
	src/com/maddyhome/idea/vim/group/ChangeGroup.java
	test/org/jetbrains/plugins/ideavim/action/ShiftRightLinesActionTest.java
2014-05-22 22:04:14 -07:00
8 changed files with 110 additions and 32 deletions

View File

@@ -27,6 +27,7 @@ Contributors:
* [Dathan Bennett](mailto:dbennett@palantir.com) * [Dathan Bennett](mailto:dbennett@palantir.com)
* [salaam](mailto:kphayen@gmail.com) * [salaam](mailto:kphayen@gmail.com)
* [Alexey Shmalko](mailto:rasen.dubi@gmail.com) * [Alexey Shmalko](mailto:rasen.dubi@gmail.com)
* [Andrew Brookins](mailto:a.m.brookins@gmail.com)
If you are a contributor and your name is not listed here, feel free to If you are a contributor and your name is not listed here, feel free to
contact the maintainer. contact the maintainer.

View File

@@ -4,6 +4,19 @@ The Changelog
History of changes in IdeaVim for the IntelliJ platform. History of changes in IdeaVim for the IntelliJ platform.
0.37, 2014-10-15
----------------
A bugfix release.
Bug fixes:
* VIM-784 Fixed visual line selection where the start of the selection range
was greater than its end
* VIM-407 Fixed `>>` to work if a line contains only one character
0.36, 2014-10-14 0.36, 2014-10-14
---------------- ----------------

View File

@@ -1,4 +1,4 @@
version-id:0.36 version-id:0.37
platform-version:135.0 platform-version:135.0
idea.download.url=http://download.jetbrains.com/idea/ideaIU-13.1.zip idea.download.url=http://download.jetbrains.com/idea/ideaIU-13.1.zip
build.number=dev build.number=dev

View File

@@ -3,6 +3,10 @@
<id>IdeaVIM</id> <id>IdeaVIM</id>
<change-notes> <change-notes>
<![CDATA[ <![CDATA[
<p>0.37:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.36:</p> <p>0.36:</p>
<ul> <ul>
<li>Window commands from the <code>&lt;C-W&gt;</code> family</li> <li>Window commands from the <code>&lt;C-W&gt;</code> family</li>
@@ -31,16 +35,6 @@
<ul> <ul>
<li>Fixed API compatibility with IntelliJ platform builds 132.1052+</li> <li>Fixed API compatibility with IntelliJ platform builds 132.1052+</li>
</ul> </ul>
<p>0.31:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.30:</p>
<ul>
<li>Support for a separate <code>.ideavimrc</code> config file</li>
<li>Fixed long-standing issues with merged undo/redo commands and <code>&lt;Esc&gt;</code> during completion</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> <p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
]]> ]]>
</change-notes> </change-notes>
@@ -48,26 +42,8 @@
<![CDATA[ <![CDATA[
<p>Build @VERSION@-@BUILD-NUMBER@</p> <p>Build @VERSION@-@BUILD-NUMBER@</p>
<p>Vim emulation plug-in for IDEs based on the IntelliJ platform. IdeaVim can be used with IntelliJ IDEA, RubyMine, PyCharm, PhpStorm, WebStorm, AppCode, CLion and Android Studio.</p> <p>Vim emulation plug-in for IDEs based on the IntelliJ platform. IdeaVim can be used with IntelliJ IDEA, RubyMine, PyCharm, PhpStorm, WebStorm, AppCode, CLion and Android Studio.</p>
<p>Supported functionality:</p> <p>IdeaVim supports many Vim features including normal/insert/visual modes, motion keys, deletion/changing, marks, registers, some Ex commands, Vim regexps, configuration via ~/.ideavimrc, macros, window commands, etc.</p>
<ul> <p>See the <a href="https://github.com/JetBrains/ideavim">JetBrains/ideavim</a> on GitHub for more details.</p>
<li>Motion keys</li>
<li>Deletion/changing</li>
<li>Insert mode commands</li>
<li>Marks</li>
<li>Registers</li>
<li>Undo/redo</li>
<li>Visual mode commands</li>
<li>Some Ex commands</li>
<li>Some :set options</li>
<li>Full Vim regexps for search and search/replace</li>
<li>Key mappings</li>
<li>Configuration via ~/.ideavimrc</li>
<li>Macros</li>
<li>Digraphs</li>
<li>Command line and search history</li>
<li>Window commands</li>
<li>Vim web help</li>
</ul>
]]> ]]>
</description> </description>
<version>@VERSION@</version> <version>@VERSION@</version>

View File

@@ -1338,7 +1338,9 @@ public class ChangeGroup {
int sline = editor.offsetToLogicalPosition(range.getStartOffset()).line; int sline = editor.offsetToLogicalPosition(range.getStartOffset()).line;
int eline = editor.offsetToLogicalPosition(range.getEndOffset()).line; int eline = editor.offsetToLogicalPosition(range.getEndOffset()).line;
int eoff = EditorHelper.getLineStartForOffset(editor, range.getEndOffset()); int eoff = EditorHelper.getLineStartForOffset(editor, range.getEndOffset());
if (eoff == range.getEndOffset()) { boolean elineIsEmpty = EditorHelper.getLineLength(editor, eline) == 0;
// Skip an empty ending line
if (eoff == range.getEndOffset() && elineIsEmpty) {
eline--; eline--;
} }

View File

@@ -1614,6 +1614,11 @@ public class MotionGroup {
editor.getSelectionModel().setSelection(start, end); editor.getSelectionModel().setSelection(start, end);
} }
else if (subMode == CommandState.SubMode.VISUAL_LINE) { else if (subMode == CommandState.SubMode.VISUAL_LINE) {
if (start > end) {
int t = start;
start = end;
end = t;
}
start = EditorHelper.getLineStartForOffset(editor, start); start = EditorHelper.getLineStartForOffset(editor, start);
end = EditorHelper.getLineEndForOffset(editor, end); end = EditorHelper.getLineEndForOffset(editor, end);
editor.getSelectionModel().setSelection(start, end); editor.getSelectionModel().setSelection(start, end);

View File

@@ -6,6 +6,7 @@ import com.maddyhome.idea.vim.VimPlugin;
import org.jetbrains.plugins.ideavim.VimTestCase; import org.jetbrains.plugins.ideavim.VimTestCase;
import static com.maddyhome.idea.vim.command.CommandState.Mode.COMMAND; import static com.maddyhome.idea.vim.command.CommandState.Mode.COMMAND;
import static com.maddyhome.idea.vim.command.CommandState.Mode.VISUAL;
import static com.maddyhome.idea.vim.helper.StringHelper.parseKeys; import static com.maddyhome.idea.vim.helper.StringHelper.parseKeys;
import static com.maddyhome.idea.vim.helper.StringHelper.stringToKeys; import static com.maddyhome.idea.vim.helper.StringHelper.stringToKeys;
@@ -593,4 +594,29 @@ public class MotionActionTest extends VimTestCase {
" bar\n" + " bar\n" +
" baz"); " baz");
} }
public void testVisualLineSelectDown() {
typeTextInFile(parseKeys("Vj"),
"foo\n" +
"<caret>bar\n" +
"baz\n" +
"quux\n");
assertMode(VISUAL);
assertSelection("bar\n" +
"baz");
assertOffset(8);
}
// VIM-784
public void testVisualLineSelectUp() {
typeTextInFile(parseKeys("Vk"),
"foo\n" +
"bar\n" +
"<caret>baz\n" +
"quux\n");
assertMode(VISUAL);
assertSelection("bar\n" +
"baz");
assertOffset(4);
}
} }

View File

@@ -0,0 +1,55 @@
package org.jetbrains.plugins.ideavim.action;
import org.jetbrains.plugins.ideavim.VimTestCase;
import static com.maddyhome.idea.vim.helper.StringHelper.parseKeys;
/**
* @author abrookins
*/
public class ShiftRightLinesActionTest extends VimTestCase {
// VIM-407
public void testShiftShiftsOneCharacterSingleLine() {
myFixture.configureByText("a.txt", "<caret>w\n");
typeText(parseKeys(">>"));
myFixture.checkResult(" w\n");
}
// VIM-407
public void testShiftShiftsOneCharacterMultiLine() {
myFixture.configureByText("a.txt", "Hello\n<caret>w\nWorld");
typeText(parseKeys(">>"));
myFixture.checkResult("Hello\n w\nWorld");
}
public void testShiftShiftsMultipleCharactersOneLine() {
myFixture.configureByText("a.txt", "<caret>Hello, world!\n");
typeText(parseKeys(">>"));
myFixture.checkResult(" Hello, world!\n");
}
public void testShiftShiftsMultipleCharactersMultipleLines() {
myFixture.configureByText("a.txt", "<caret>Hello,\nworld!\n");
typeText(parseKeys("j>>"));
myFixture.checkResult("Hello,\n world!\n");
}
public void testShiftsSingleLineSelection() {
myFixture.configureByText("a.txt", "<caret>Hello,\nworld!\n");
typeText(parseKeys("jv$>>"));
myFixture.checkResult("Hello,\n world!\n");
}
public void testShiftsMultiLineSelection() {
myFixture.configureByText("a.txt", "<caret>Hello,\nworld!\n");
typeText(parseKeys("vj$>>"));
myFixture.checkResult(" Hello,\n world!\n");
}
public void testShiftsMultiLineSelectionSkipsNewline() {
myFixture.configureByText("a.txt", "<caret>Hello,\nworld!\n\n");
typeText(parseKeys("vG$>>"));
myFixture.checkResult(" Hello,\n world!\n\n");
}
}