aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-06-13 01:26:19 +0530
committerArun Isaac2022-06-13 01:26:19 +0530
commit6edc10194b896d7e6a6cb3c42d0e5afdd8f6327e (patch)
treec6ccf50d40a83e86e99693bb047e5ef0bab459b1
parent4cee01cc6298add2ab39508c58c76ac4d90486bd (diff)
downloadthogai-6edc10194b896d7e6a6cb3c42d0e5afdd8f6327e.tar.gz
thogai-6edc10194b896d7e6a6cb3c42d0e5afdd8f6327e.tar.lz
thogai-6edc10194b896d7e6a6cb3c42d0e5afdd8f6327e.zip
Delete space when reversing strokes.
* thogai.el (thogai-reverse-strokes): Delete space if present. (thogai-insert-stroke): Depend on thogai-reverse-strokes to delete space.
-rw-r--r--thogai.el16
1 files changed, 8 insertions, 8 deletions
diff --git a/thogai.el b/thogai.el
index faca653..237be6f 100644
--- a/thogai.el
+++ b/thogai.el
@@ -303,7 +303,14 @@ is unaltered."
(thogai-delete
(with-temp-buffer
(thogai-inject-strokes strokes (make-ring (length strokes)))
- (buffer-string))))
+ (buffer-string)))
+ ;; Delete space before strokes unless we are at the beginning of the
+ ;; line. Note that attached and glued strokes do not emit
+ ;; spaces. So, we cannot mindlessly delete a character without
+ ;; checking if it is a space.
+ (unless (= (line-beginning-position)
+ (point))
+ (thogai-delete " ")))
(defun thogai-inject-strokes (strokes &optional stroke-ring)
"Inject STROKES into STROKE-RING.
@@ -334,13 +341,6 @@ should typically be `thogai-stroke-ring'."
(list (ring-ref stroke-ring 0)))))
;; Reverse the previous group of strokes.
(thogai-reverse-strokes matched-strokes)
- ;; Delete space before strokes unless we are at the
- ;; beginning of the line. Note that attached and glued
- ;; strokes do not emit spaces. So, we cannot mindlessly
- ;; delete a character without checking if it is a space.
- (unless (= (line-beginning-position)
- (point))
- (thogai-delete " "))
;; Re-insert the previous group of strokes except for the
;; newest stroke.
(pcase (reverse matched-strokes)