ce-command-copy: implement
This commit is contained in:
parent
14ad178349
commit
94cf2d0c50
|
@ -38,7 +38,7 @@ implementation status of planned features:
|
|||
- [x] n - ce-command-num-print
|
||||
- [x] p - ce-command-print
|
||||
- [x] s - ce-command-reg-replace
|
||||
- [ ] t - ce-command-copy
|
||||
- [x] t - ce-command-copy
|
||||
- [x] w - ce-command-write
|
||||
- [x] x - ce-command-chop
|
||||
- [x] X - ce-command-chop-beg
|
||||
|
|
14
ce.cl
14
ce.cl
|
@ -421,6 +421,20 @@ specific command. the recognized commands are as follows:
|
|||
(ce-push-line i res)
|
||||
(return))))))))
|
||||
|
||||
(defun ce-command-copy (&optional c)
|
||||
"copy the region to argument line"
|
||||
(declare (ignore c))
|
||||
(ce-reset-input)
|
||||
(let ((mlen (list-length buffer)))
|
||||
(let ((inp (1+ (ce-mod (parse-integer (read-line)) mlen)))
|
||||
(in (ce-mod inpoint mlen))
|
||||
(out (1+ (ce-mod outpoint mlen))))
|
||||
(let ((copy (subseq buffer in out))
|
||||
(diff (1- (- out in))))
|
||||
(ce-push-lines inp copy)
|
||||
(setq inpoint inp)
|
||||
(setq outpoint (+ inp diff))))))
|
||||
|
||||
; TODO: needs error handling
|
||||
(defun ce-command-write (&optional c)
|
||||
"write a file to disk"
|
||||
|
|
Loading…
Reference in New Issue