Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for scrolling #252

Merged
merged 33 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
589e43f
[VIM-2104] Use side scroll offset for horizontal scrolling
citizenmatt Aug 20, 2020
4cebaa8
Fix scrolljump
citizenmatt Aug 20, 2020
d08da77
Split scrollPositionIntoView method into two
citizenmatt Aug 20, 2020
d878c3e
Improve handling of scrolljump
citizenmatt Sep 1, 2020
8a42bff
Add tests for scrolloff and scrolljump
citizenmatt Sep 2, 2020
111c1eb
Add tests for ScrollLineUpAction
citizenmatt Sep 2, 2020
a5de935
Add tests for ScrollLineDownAction
citizenmatt Sep 2, 2020
632e9fa
Remove incorrect mappings for page up/down
citizenmatt Sep 2, 2020
3cf42c8
Add tests for ScrollPageDownAction
citizenmatt Sep 2, 2020
c8a1938
Add tests for ScrollPageUpAction
citizenmatt Sep 2, 2020
8f90ff8
Add tests for ScrollFirstScreenLinePageStartAction
citizenmatt Sep 2, 2020
be0adb8
Add tests for ScrollLastScreenLinePageStartAction
citizenmatt Sep 3, 2020
a7ba6d6
Add tests for ScrollFirstScreenLine actions
citizenmatt Sep 3, 2020
63d9a33
Add tests for ScrollLastScreenLine actions
citizenmatt Sep 3, 2020
7321099
Add tests for ScrollMiddleScreenLine actions
citizenmatt Sep 3, 2020
5ca0298
Add tests for ScrollHalfPage actions
citizenmatt Sep 3, 2020
6260168
Add internal action to show inline inlays
citizenmatt Sep 6, 2020
2091bbc
Improve cursor position handling with inlay hints
citizenmatt Sep 8, 2020
53a687f
Fix issues with side scrolling and inline inlays
citizenmatt Sep 15, 2020
df3a533
Fix arithmetic for scrolling columns
citizenmatt Sep 16, 2020
d693906
Add tests and fixes for ScrollColumnRightAction
citizenmatt Sep 16, 2020
64502fb
Reformat comments
citizenmatt Sep 16, 2020
eabe430
Add tests and fixes for ScrollColumnLeftAction
citizenmatt Sep 16, 2020
fa17af8
Fix keeping caret on screen with preceding inlay
citizenmatt Sep 16, 2020
007f33b
Add zL scroll half screen width action
citizenmatt Sep 16, 2020
26dae9b
Add zH scroll half screen width action
citizenmatt Sep 17, 2020
78f1c84
Use test inlay renderer for consistent width
citizenmatt Sep 17, 2020
63db148
Merge branch 'master' into VIM-2104
citizenmatt Sep 17, 2020
2dc54ea
Use deterministic width for inlays
citizenmatt Sep 17, 2020
cd0d503
Convert test to option test
AlexPl292 Sep 22, 2020
0a863f3
Small formatting
AlexPl292 Sep 22, 2020
1d8ac4f
Move scroll data objects up to avoid conflicts
AlexPl292 Sep 23, 2020
1c21968
Merge branch 'master' into VIM-2104
AlexPl292 Sep 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*

class MotionScrollHalfPageDownAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY

override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)

override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollScreen(editor, cmd.rawCount, true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*

class MotionScrollLineDownAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY

override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)

override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollLine(editor, cmd.count)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*

class MotionScrollLineUpAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY

override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)

override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollLine(editor, -cmd.count)
}
Expand Down
9 changes: 9 additions & 0 deletions src/com/maddyhome/idea/vim/command/CommandFlags.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ enum class CommandFlags {
* This keystroke should be saved as part of the current insert
*/
FLAG_SAVE_STROKE,

/**
* Don't include scrolljump when adjusting the scroll area to ensure the current cursor position is visible.
* Should be used for commands that adjust the scroll area (such as <C-D> or <C-E>).
* Technically, the current implementation doesn't need these flags, as these commands adjust the scroll area
* according to their own rules and then move the cursor to fit (e.g. move cursor down a line with <C-E>). Moving the
* cursor always tries to adjust the scroll area to ensure it's visible, which in this case is always a no-op.
* This is an implementation detail, so keep the flags for both documentation and in case of refactoring.
*/
FLAG_IGNORE_SCROLL_JUMP,
FLAG_IGNORE_SIDE_SCROLL_JUMP,

Expand Down
2 changes: 1 addition & 1 deletion src/com/maddyhome/idea/vim/group/MotionGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ public boolean scrollColumnToLastScreenColumn(@NotNull Editor editor) {

public static void scrollCaretIntoView(@NotNull Editor editor) {
final EnumSet<CommandFlags> flags = CommandState.getInstance(editor).getExecutingCommandFlags();
final boolean scrollJump = flags.contains(CommandFlags.FLAG_IGNORE_SCROLL_JUMP);
final boolean scrollJump = !flags.contains(CommandFlags.FLAG_IGNORE_SCROLL_JUMP);
AlexPl292 marked this conversation as resolved.
Show resolved Hide resolved
scrollPositionIntoView(editor, editor.getCaretModel().getVisualPosition(), scrollJump);
}

Expand Down