Skip to content

Add option in that controls Home and End. Default unchanged. #222

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
45 changes: 40 additions & 5 deletions gui-lib/framework/private/keymap-global.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,38 @@
"delete-next-character"
"delete-previous-character")
edit event #t)))]

[home-key
(λ (edit event)
(let ([kmap (send edit get-keymap)])
(send kmap call-function
(if (preferences:get 'framework:home/end-to-beginning/end-of-document?)
"beginning-of-file"
"beginning-of-line")
edit event #t)))]
[end-key
(λ (edit event)
(let ([kmap (send edit get-keymap)])
(send kmap call-function
(if (preferences:get 'framework:home/end-to-beginning/end-of-document?)
"end-of-file"
"end-of-line")
edit event #t)))]
[shift-home-key
(λ (edit event)
(let ([kmap (send edit get-keymap)])
(send kmap call-function
(if (preferences:get 'framework:home/end-to-beginning/end-of-document?)
"select-to-beginning-of-file"
"select-to-beginning-of-line")
edit event #t)))]
[shift-end-key
(λ (edit event)
(let ([kmap (send edit get-keymap)])
(send kmap call-function
(if (preferences:get 'framework:home/end-to-beginning/end-of-document?)
"select-to-end-of-file"
"select-to-end-of-line")
edit event #t)))]
[toggle-overwrite
(λ (edit event)
(when (preferences:get 'framework:overwrite-mode-keybindings)
Expand Down Expand Up @@ -813,6 +844,10 @@
(add-m "select-click-line" select-click-line)

(add "delete-key" delete-key)
(add "home-key" home-key)
(add "end-key" end-key)
(add "shift-home-key" shift-home-key)
(add "shift-end-key" shift-end-key)

(add "mouse-popup-menu" mouse-popup-menu)

Expand Down Expand Up @@ -883,15 +918,15 @@

(map "c:e" "end-of-line")
(map "d:right" "end-of-line")
(map "end" "end-of-line")
(map "s:end" "select-to-end-of-line")
(map "end" "end-key")
(map "s:end" "shift-end-key")
(map "s:c:e" "select-to-end-of-line")
(map "s:d:right" "select-to-end-of-line")

(map "c:a" "beginning-of-line")
(map "d:left" "beginning-of-line")
(map "home" "beginning-of-line")
(map "s:home" "select-to-beginning-of-line")
(map "home" "home-key")
(map "s:home" "shift-home-key")
(map "s:c:a" "select-to-beginning-of-line")
(map "s:d:left" "select-to-beginning-of-line")

Expand Down
1 change: 1 addition & 0 deletions gui-lib/framework/private/main.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@

(preferences:set-default 'framework:verify-exit #t boolean?)
(preferences:set-default 'framework:delete-forward? #t boolean?)
(preferences:set-default 'framework:home/end-to-beginning/end-of-document? #f boolean?)
(preferences:set-default 'framework:show-periods-in-dirlist #f boolean?)
(preferences:set-default 'framework:file-dialogs 'std
(λ (x) (and (memq x '(common std)) #t)))
Expand Down
2 changes: 2 additions & 0 deletions gui-lib/framework/private/preferences.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ the state transitions / contracts are:
(add-check editor-panel 'framework:delete-forward?
(string-constant map-delete-to-backspace)
not not)
(add-check editor-panel 'framework:home/end-to-beginning/end-of-document?
(string-constant home/end-is-go-to-beginning/end-of-document))
(add-check editor-panel
'framework:auto-set-wrap?
(string-constant wrap-words-in-editor-buffers))
Expand Down