+37
-21
@@ -17,6 +17,7 @@
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(define (char-between ch lo hi)
|
||||
(if (char>=? ch lo)
|
||||
(char<=? ch hi)
|
||||
@@ -33,36 +34,51 @@
|
||||
#f)))
|
||||
#f))
|
||||
|
||||
|
||||
(define (word-char-p ch)
|
||||
(if (alphanumericp ch)
|
||||
#t
|
||||
(char= ch #\_)))
|
||||
|
||||
#f))
|
||||
|
||||
(define editor-move-to-end-of-word (lambda () (
|
||||
(if (word-char-p (editor-read-char))
|
||||
((move-cursor "right")
|
||||
(editor-move-to-end-of-word))
|
||||
))
|
||||
))
|
||||
))
|
||||
|
||||
(define enter-and-tab
|
||||
(lambda ()
|
||||
(editor-insert-new-line)
|
||||
(let ((is-in (move-cursor "up")))
|
||||
(do ((ch (editor-read-char) (editor-read-char)))
|
||||
((and (not (char=? ch #\space)) is-in) #f)
|
||||
(move-cursor "down")
|
||||
(editor-insert-char " ")
|
||||
(set! is-in (move-cursor "up")))
|
||||
(move-cursor "down"))))
|
||||
|
||||
(add-prefix "user")
|
||||
|
||||
|
||||
;; KEY MAPPING
|
||||
|
||||
(map-key "CTRL-q" editor-quit)
|
||||
(map-key "CTRL-d" editor-save)
|
||||
(map-key "ARROW-UP" '(move-cursor "up"))
|
||||
(map-key "ARROW-DOWN" '(move-cursor "down"))
|
||||
(map-key "ARROW-RIGHT" '(move-cursor "right"))
|
||||
(map-key "ARROW-LEFT" '(move-cursor "left"))
|
||||
(map-key "ENTER" editor-insert-new-line)
|
||||
(map-key "CTRL-a" move-cursor-beg-line)
|
||||
(map-key "CTRL-e" move-cursor-end-line)
|
||||
(map-key "BACKSPACE" editor-delete-previous-char)
|
||||
(map-key "DEL" editor-delete-next-char)
|
||||
(map-key "PAGE-UP" move-cursor-page-up)
|
||||
(map-key "PAGE-DOWN" move-cursor-page-down)
|
||||
(map-key "CTRL-o" editor-open-file)
|
||||
(map-key "CTRL-k" editor-del-row)
|
||||
(map-key "CTRL-s" editor-find)
|
||||
(map-key "CTRL-r" editor-move-to-end-of-word)
|
||||
(map-key "CTRL-x" '(editor-set-prefix "user") "no-prefix")
|
||||
(map-key "CTRL-g" '(editor-set-prefix "no-prefix") "user")
|
||||
(map-key "CTRL-c" editor-quit "user")
|
||||
(map-key "CTRL-s" editor-save "user")
|
||||
(map-key "ARROW-UP" '(move-cursor "up") "no-prefix")
|
||||
(map-key "ARROW-DOWN" '(move-cursor "down") "no-prefix")
|
||||
(map-key "ARROW-RIGHT" '(move-cursor "right") "no-prefix")
|
||||
(map-key "ARROW-LEFT" '(move-cursor "left") "no-prefix")
|
||||
(map-key "ENTER" enter-and-tab "no-prefix")
|
||||
(map-key "CTRL-a" move-cursor-beg-line "no-prefix")
|
||||
(map-key "CTRL-e" move-cursor-end-line "no-prefix")
|
||||
(map-key "BACKSPACE" editor-delete-previous-char "no-prefix")
|
||||
(map-key "DEL" editor-delete-next-char "no-prefix")
|
||||
(map-key "PAGE-UP" move-cursor-page-up "no-prefix")
|
||||
(map-key "PAGE-DOWN" move-cursor-page-down "no-prefix")
|
||||
(map-key "f" editor-open-file "user")
|
||||
(map-key "TAB" editor-insert-tab "no-prefix")
|
||||
(map-key "CTRL-k" editor-del-row "no-prefix")
|
||||
(map-key "CTRL-s" editor-find "no-prefix")
|
||||
(map-key "CTRL-r" editor-move-to-end-of-word "no-prefix")
|
||||
|
||||
Reference in New Issue
Block a user