From dc546ddc7865d910b8e90f5f79585da72bdbd7d1 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 12 Jun 2022 23:48:15 +0530 Subject: When undoing, delete space only if there is a space. Attached and glued strokes don't emit spaces. So, we cannot mindlessly delete the last character without checking if it is a space. * thogai.el (thogai-insert-stroke): When undoing, delete space only if there actually is a space. --- thogai.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/thogai.el b/thogai.el index 8e1f5be..b863018 100644 --- a/thogai.el +++ b/thogai.el @@ -317,10 +317,12 @@ should typically be `thogai-stroke-ring'." ;; Reverse the previous group of strokes. (thogai-reverse-strokes matched-strokes) ;; Delete space before strokes unless we are at the - ;; beginning of the line. + ;; 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)) - (delete-char -1)) + (thogai-delete " ")) ;; Re-insert the previous group of strokes except for the ;; newest stroke. (pcase (reverse matched-strokes) -- cgit v1.2.3