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

Shift+Home/End selects to end of line #655

Merged
merged 2 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions framework/editor/EventHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ internal class EventHandler constructor(
MOVE_LINE_DOWN -> target.moveCursorDownByLine()
MOVE_PAGE_UP -> target.moveCursorUpByPage()
MOVE_PAGE_DOWN -> target.moveCursorDownByPage()
MOVE_HOME -> target.moveCursorToStart()
MOVE_END -> target.moveCursorToEnd()
MOVE_HOME -> target.moveCursorToStartOfFile()
MOVE_END -> target.moveCursorToEndOfFile()
SELECT_CHAR_LEFT -> target.moveCursorPrevByChar(true) // because we only display left to right
SELECT_CHAR_RIGHT -> target.moveCursorNextByChar(true) // because we only display left to right
SELECT_WORD_LEFT -> target.moveCursorPrevByWord(true) // because we only display left to right
Expand All @@ -153,8 +153,8 @@ internal class EventHandler constructor(
SELECT_LINE_DOWN -> target.moveCursorDownByLine(true)
SELECT_PAGE_UP -> target.moveCursorUpByPage(true)
SELECT_PAGE_DOWN -> target.moveCursorDownByPage(true)
SELECT_HOME -> target.moveCursorToStart(true)
SELECT_END -> target.moveCursorToEnd(true)
SELECT_HOME -> target.moveCursorToStartOfLine(true)
SELECT_END -> target.moveCursorToEndOfLine(true)
SELECT_ALL -> target.selectAll()
SELECT_NONE -> target.selectNone()
REORDER_LINES_UP -> processor.reorderLinesUp()
Expand Down
4 changes: 2 additions & 2 deletions framework/editor/InputTarget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,11 @@ internal class InputTarget constructor(
updateCursor(Cursor(newRow, newCol), isSelecting)
}

internal fun moveCursorToStart(isSelecting: Boolean = false, mayScroll: Boolean = true) = updateCursor(
internal fun moveCursorToStartOfFile(isSelecting: Boolean = false, mayScroll: Boolean = true) = updateCursor(
Cursor(0, 0), isSelecting, mayScroll
)

internal fun moveCursorToEnd(isSelecting: Boolean = false, mayScroll: Boolean = true) = updateCursor(
internal fun moveCursorToEndOfFile(isSelecting: Boolean = false, mayScroll: Boolean = true) = updateCursor(
end, isSelecting, mayScroll
)

Expand Down
2 changes: 1 addition & 1 deletion framework/editor/TextEditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ object TextEditor {

fun jumpToTop() {
target.verScroller.scrollToTop()
target.moveCursorToStart(isSelecting = false, mayScroll = false)
target.moveCursorToStartOfFile(isSelecting = false, mayScroll = false)
}

fun onScrollToBottom(function: () -> Unit) {
Expand Down