mirror of
https://codeberg.org/scip/viking-mode.git
synced 2025-12-18 04:51:00 +01:00
fix issue#5: if on empty line & on end-of-buffer, jump one line up and continue
This commit is contained in:
@@ -373,6 +373,7 @@ should be a point-moving function."
|
|||||||
;; implements #2: behave different inside region
|
;; implements #2: behave different inside region
|
||||||
;; FIXME: maybe also do word->line->region?
|
;; FIXME: maybe also do word->line->region?
|
||||||
;; Currently it just throws the whole region away
|
;; Currently it just throws the whole region away
|
||||||
|
;; FIXME: if called via expand-region, different output
|
||||||
(defun viking-kill-region()
|
(defun viking-kill-region()
|
||||||
"Kill region at point, if any"
|
"Kill region at point, if any"
|
||||||
(interactive)
|
(interactive)
|
||||||
@@ -398,16 +399,24 @@ should be a point-moving function."
|
|||||||
'viking--current-killf, reset it to the contents of
|
'viking--current-killf, reset it to the contents of
|
||||||
'viking-kill-functions if COUNT is 1 (thus the command key has been
|
'viking-kill-functions if COUNT is 1 (thus the command key has been
|
||||||
pressed the first time in a row"
|
pressed the first time in a row"
|
||||||
(progn
|
|
||||||
;; start from scratch
|
;; start from scratch
|
||||||
(if (eq count 1)
|
(if (eq count 1)
|
||||||
(setq viking--current-killf viking-kill-functions))
|
(setq viking--current-killf viking-kill-functions))
|
||||||
|
|
||||||
|
;; end of buffer, but it's not empty yet
|
||||||
|
;; and the last line, where we are, is empty,
|
||||||
|
;; so move one line up in order to keep viking
|
||||||
|
;; mode going
|
||||||
|
(if (and (eobp)
|
||||||
|
(> (buffer-size) 0)
|
||||||
|
(eq (line-beginning-position) (point)))
|
||||||
|
(progn (message "jump 1 line up") (previous-line)))
|
||||||
|
|
||||||
;; only call killer if not done killing
|
;; only call killer if not done killing
|
||||||
(if (and viking--current-killf (not (eobp)))
|
(if (and viking--current-killf (not (eobp)))
|
||||||
(funcall (viking--next-killf))
|
(funcall (viking--next-killf))
|
||||||
(signal 'end-of-buffer nil)
|
(signal 'end-of-buffer nil)
|
||||||
)))
|
))
|
||||||
|
|
||||||
|
|
||||||
(defun viking--er-killw ()
|
(defun viking--er-killw ()
|
||||||
|
|||||||
Reference in New Issue
Block a user