about summary refs log tree commit diff
diff options
context:
space:
mode:
-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)