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

Fix and refactor kill whole line #1642

Closed
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
18 changes: 11 additions & 7 deletions src/commands/edit.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,17 @@
(let ((end (current-point)))
(kill-region start end))))))))

(define-command kill-whole-line () ()
"Kill the entire line and the remaining whitespace"
(with-point ((start (current-point))
(end (current-point)))
(line-end end)
(kill-region start end))
(delete-previous-char))
(define-command kill-whole-line (n) (:universal)
"If n is positive, kill n whole lines forward starting
at the beginning of the current line. If n is 0, do nothing.
And if n is negative, kill n lines above without deleting
anything the current line."
(cond ((zerop n) nil)
((minusp n) (save-excursion
(move-to-beginning-of-logical-line)
(kill-line n)))
(t (progn (move-to-beginning-of-logical-line)
(kill-line n)))))

(defun yank-string (point string)
(change-yank-start point
Expand Down
4 changes: 4 additions & 0 deletions src/ext/isearch.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
(define-key *global-keymap* "M-s p" 'isearch-prev-highlight)
(define-key *global-keymap* "F3" 'isearch-next-highlight)
(define-key *global-keymap* "Shift-F3" 'isearch-prev-highlight)
(define-key *global-keymap* "M-s t" 'isearch-toggle-highlighting)
(define-key *global-keymap* "M-s M-t" 'isearch-toggle-highlighting)
(define-key *isearch-keymap* "C-M-n" 'isearch-add-cursor-to-next-match)

(defun disable-hook ()
Expand Down Expand Up @@ -305,6 +307,7 @@
(subseq *isearch-string*
0
(1- (length *isearch-string*))))
(funcall *isearch-search-function* (current-point) *isearch-string*)
(isearch-update-display)))

(define-command isearch-raw-insert () ()
Expand Down Expand Up @@ -394,6 +397,7 @@
(let ((str (yank-from-clipboard-or-killring)))
(when str
(setq *isearch-string* str)
(funcall *isearch-search-function* (current-point) *isearch-string*)
(isearch-update-display))))

(defun isearch-add-char (c)
Expand Down
Loading