Skip to content
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
14 changes: 14 additions & 0 deletions command-functions.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@
(declare (ignore chord editor))
(throw 'linedit-done t))

(defun new-sexp (chord editor)
(declare (ignore chord editor))
(with-editor-point-and-string ((point string) editor)
(move-to-eol chord editor)
(add-char #\( editor)
(incf (get-point editor))
(move-to-eol chord editor)
(add-char #\) editor)
(decf (get-point editor))))

(defun clear-screen (chord editor)
(declare (ignore chord))
(terminal-clear-screen))

;;; CASE CHANGES

(flet ((frob-case (frob editor)
Expand Down
7 changes: 5 additions & 2 deletions command-keys.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
(defcommand "C-G")
(defcommand "C-J")
(defcommand "C-K" 'kill-to-eol)
(defcommand "C-L")
(defcommand "C-L" 'clear-screen)
(defcommand "C-N" 'history-next)
(defcommand "C-O" 'close-all-sexp)
(defcommand "C-P" 'history-previous)
Expand Down Expand Up @@ -65,7 +65,7 @@
(defcommand "M-K")
(defcommand "M-L" 'downcase-word)
(defcommand "M-M")
(defcommand "M-N")
(defcommand "M-N" 'new-sexp)
(defcommand "M-O")
(defcommand "M-P")
(defcommand "M-Q")
Expand Down Expand Up @@ -113,3 +113,6 @@
(defcommand "Page-down")
(defcommand "Home" 'move-to-bol)
(defcommand "End" 'move-to-eol)

(defcommand "C-Right-arrow" 'forward-sexp)
(defcommand "C-Left-arrow" 'backward-sexp)
4 changes: 4 additions & 0 deletions smart-terminal.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
(or ti:column-address (and ti:cursor-left ti:cursor-right))
(or ti:auto-right-margin ti:enter-am-mode)))

(defun terminal-clear-screen ()
(when ti:clear-screen
(format t "~A~A" ti:clear-screen (editor-prompt *editor*))))

(defmethod backend-init ((backend smart-terminal))
(call-next-method)
(when ti:enter-am-mode
Expand Down
3 changes: 3 additions & 0 deletions terminal-translations.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,6 @@
(deftrans "Page-down" (#\Esc #\[ #\6 #\~))
(deftrans "Home" (#\Esc #\[ #\7 #\~) (#\Esc #\[ #\1 #\~) (#\Esc #\[ #\H))
(deftrans "End" (#\Esc #\[ #\8 #\~) (#\Esc #\[ #\4 #\~) (#\Esc #\[ #\F))

(deftrans "C-Right-arrow" (#\Esc #\[ #\1 #\; #\5 #\C))
(deftrans "C-Left-arrow" (#\Esc #\[ #\1 #\; #\5 #\D))
20 changes: 17 additions & 3 deletions terminal.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,21 @@
(flet ((read-open-chord ()
(do ((chars nil)
(c #1=(read-char) #1#))
((member c '(#\- #\~ #\$)) (nconc (nreverse chars) (list c)))
(push c chars))))
((or (member c '(#\- #\~ #\$))
(if (char-equal c #\;)
(let ((c1 (read-char))
(c2 (read-char)))
(push #\; chars)
(push c1 chars)
(push c2 chars)
;; (format t "add (~A,~A,~A): chars:~A~%"
;; c c1 c2 chars)
t)))
(nconc (nreverse chars)
(if (char-not-equal c #\;)
(list c))))
(when (char-not-equal c #\;)
(push c chars)))))
(let ((chord
(acase (read-char)
(#\Esc
Expand All @@ -63,7 +76,8 @@
(if (digit-char-p char)
(cons char
(read-open-chord))
(list char)))))
(when (char-not-equal char #\;)
(list char))))))
(t (list it)))))
(t (if (graphic-char-p it)
it
Expand Down