Skip to content

Commit

Permalink
Update after running ktlintFormatter
Browse files Browse the repository at this point in the history
  • Loading branch information
citizenmatt authored and AlexPl292 committed Mar 3, 2021
1 parent adab232 commit e0e80d2
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ class MotionGotoLineLastAction : MotionActionHandler.ForEachCaret() {
rawCount: Int,
argument: Argument?
): Int {
val line = EditorHelper.normalizeLine(editor, if (rawCount == 0) {
EditorHelper.getLineCount(editor) - 1
} else {
rawCount - 1
})
val line = EditorHelper.normalizeLine(
editor,
if (rawCount == 0) {
EditorHelper.getLineCount(editor) - 1
} else {
rawCount - 1
}
)
return VimPlugin.getMotion().moveCaretToLineWithStartOfLineOption(editor, line, caret)
}
}
6 changes: 4 additions & 2 deletions test/org/jetbrains/plugins/ideavim/VimTestCase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@ abstract class VimTestCase : UsefulTestCase() {
assertPosition(caretLogicalLine, caretLogicalColumn)

// Belt and braces. Let's make sure that the caret is fully onscreen
val bottomLogicalLine = EditorHelper.visualLineToLogicalLine(myFixture.editor,
EditorHelper.getVisualLineAtBottomOfScreen(myFixture.editor))
val bottomLogicalLine = EditorHelper.visualLineToLogicalLine(
myFixture.editor,
EditorHelper.getVisualLineAtBottomOfScreen(myFixture.editor)
)
assertTrue(bottomLogicalLine >= caretLogicalLine)
assertTrue(caretLogicalLine >= scrollToLogicalLine)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ class ShiftLeftTest : VimTestCase() {
| hard by the torrent of a mountain pass.
""".trimMargin()
typeTextInFile(StringHelper.parseKeys("<<"), file)
myFixture.checkResult("""
myFixture.checkResult(
"""
|A Discovery
| ${c}I found it in a legendary land
| all rocks and lavender and tufted grass,
| where it was settled on some sodden sand
| hard by the torrent of a mountain pass.
""".trimMargin())
""".trimMargin()
)
}

fun `test shift left does not move caret with nostartofline`() {
Expand All @@ -76,14 +78,16 @@ class ShiftLeftTest : VimTestCase() {
| hard by the torrent of a mountain pass.
""".trimMargin()
typeTextInFile(StringHelper.parseKeys("<<"), file)
myFixture.checkResult("""
myFixture.checkResult(
"""
|A Discovery
| I found it in a lege${c}ndary land
| all rocks and lavender and tufted grass,
| where it was settled on some sodden sand
| hard by the torrent of a mountain pass.
""".trimMargin())
""".trimMargin()
)
}

fun `test shift left positions caret at end of line with nostartofline`() {
Expand All @@ -97,14 +101,16 @@ class ShiftLeftTest : VimTestCase() {
| hard by the torrent of a mountain pass.
""".trimMargin()
typeTextInFile(StringHelper.parseKeys("<<"), file)
myFixture.checkResult("""
myFixture.checkResult(
"""
|A Discovery
| I found it in a legendary lan${c}d
| all rocks and lavender and tufted grass,
| where it was settled on some sodden sand
| hard by the torrent of a mountain pass.
""".trimMargin())
""".trimMargin()
)
}

fun `test shift ctrl-D`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,16 @@ class ShiftRightTest : VimTestCase() {
| hard by the torrent of a mountain pass.
""".trimMargin()
typeTextInFile(StringHelper.parseKeys(">>"), file)
myFixture.checkResult("""
myFixture.checkResult(
"""
|A Discovery
| ${c}I found it in a legendary land
| all rocks and lavender and tufted grass,
| where it was settled on some sodden sand
| hard by the torrent of a mountain pass.
""".trimMargin())
""".trimMargin()
)
}

fun `test shift right does not move caret with nostartofline`() {
Expand All @@ -150,14 +152,16 @@ class ShiftRightTest : VimTestCase() {
| hard by the torrent of a mountain pass.
""".trimMargin()
typeTextInFile(StringHelper.parseKeys(">>"), file)
myFixture.checkResult("""
myFixture.checkResult(
"""
|A Discovery
| I found it i${c}n a legendary land
| all rocks and lavender and tufted grass,
| where it was settled on some sodden sand
| hard by the torrent of a mountain pass.
""".trimMargin())
""".trimMargin()
)
}

fun `test shift ctrl-t`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class MotionFirstScreenLineActionTest : VimTestCase() {
assertPosition(30, 4)
}

fun `test operator pending acts to first screen line` () {
fun `test operator pending acts to first screen line`() {
configureByLines(100, " I found it in a legendary land")
setPositionAndScroll(20, 40, 10)
typeText(parseKeys("dH"))
Expand All @@ -115,7 +115,7 @@ class MotionFirstScreenLineActionTest : VimTestCase() {
assertPosition(24, 4)
}

fun `test operator pending acts to first screen line with nostartofline` () {
fun `test operator pending acts to first screen line with nostartofline`() {
OptionsManager.startofline.reset()
configureByLines(100, " I found it in a legendary land")
setPositionAndScroll(20, 40, 10)
Expand Down Expand Up @@ -176,4 +176,3 @@ class MotionFirstScreenLineActionTest : VimTestCase() {
assertPosition(24, 4)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,4 @@ class MotionLastScreenLineActionTest : VimTestCase() {
assertPosition(20, 4)
assertBottomLogicalLine(44)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ class MotionMiddleScreenLineActionTest : VimTestCase() {
typeText(parseKeys("M"))
assertPosition(8, 4)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@ class MotionGotoLineFirstActionTest : VimTestCase() {
CommandState.Mode.COMMAND, CommandState.SubMode.NONE
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MotionGotoLineFirstInsertActionTest : VimTestCase() {
| hard by the torrent of a mountain pass.
""".trimMargin(),
"""
|${c} A Discovery
|$c A Discovery
|
| I found it in a legendary land
| all rocks and lavender and tufted grass,
Expand All @@ -59,7 +59,7 @@ class MotionGotoLineFirstInsertActionTest : VimTestCase() {
| hard by the torrent of a mountain pass.
""".trimMargin(),
"""
|${c} A Discovery
|$c A Discovery
|
| I found it in a legendary land
| all rocks and lavender and tufted grass,
Expand All @@ -69,4 +69,4 @@ class MotionGotoLineFirstInsertActionTest : VimTestCase() {
CommandState.Mode.COMMAND, CommandState.SubMode.NONE
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class MotionGotoLineLastActionTest : VimTestCase() {
| I found it in a legendary land
| all rocks and lavender and tufted grass,
| where it was settled on some sodden sand
| hard${c} by the torrent of a mountain pass.
| hard$c by the torrent of a mountain pass.
""".trimMargin(),
CommandState.Mode.COMMAND, CommandState.SubMode.NONE
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,4 @@ class GotoLineHandlerTest : VimTestCase() {
assertPosition(30, 4)
assertTopLogicalLine(6)
}
}
}

0 comments on commit e0e80d2

Please sign in to comment.