diff options
author | Arun Isaac | 2022-06-13 01:26:19 +0530 |
---|---|---|
committer | Arun Isaac | 2022-06-13 01:26:19 +0530 |
commit | 6edc10194b896d7e6a6cb3c42d0e5afdd8f6327e (patch) | |
tree | c6ccf50d40a83e86e99693bb047e5ef0bab459b1 | |
parent | 4cee01cc6298add2ab39508c58c76ac4d90486bd (diff) | |
download | thogai-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.el | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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) |