Allow merging lines by backspacing at the beginning of a line
This commit is contained in:
parent
cd851bffc7
commit
55a251642f
1 changed files with 12 additions and 2 deletions
|
@ -99,12 +99,22 @@
|
||||||
(string-take s k)
|
(string-take s k)
|
||||||
(string-drop s (1+ k))))
|
(string-drop s (1+ k))))
|
||||||
|
|
||||||
|
;;; merges k and k+1
|
||||||
|
(define (merge-lines buffer k)
|
||||||
|
(append (list-head buffer k)
|
||||||
|
(list
|
||||||
|
(string-append (list-ref buffer k)
|
||||||
|
(list-ref buffer (1+ k))))
|
||||||
|
(list-tail buffer (+ k 2))))
|
||||||
|
|
||||||
(define (backward-delete-char state)
|
(define (backward-delete-char state)
|
||||||
(define buf (buffer state))
|
(define buf (buffer state))
|
||||||
(define x (curx state))
|
(define x (curx state))
|
||||||
(define y (cury state))
|
(define y (cury state))
|
||||||
(list-set! buf y
|
(if (> x 0)
|
||||||
(string-delete-kth (list-ref buf y) (1- x)))
|
(list-set! buf y
|
||||||
|
(string-delete-kth (list-ref buf y) (1- x)))
|
||||||
|
(set! (buffer state) (merge-lines buf (1- y))))
|
||||||
(move-cursor state #:x -1 #:relative? #t))
|
(move-cursor state #:x -1 #:relative? #t))
|
||||||
|
|
||||||
(define (delete-char state)
|
(define (delete-char state)
|
||||||
|
|
Loading…
Reference in a new issue