From 6d6590293324821d38f50323c66de0128b6eb53a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 25 Jan 2026 13:23:00 +0000 Subject: [PATCH] Fix: preserve all leading spaces in paragraph indentation Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com> --- ekp-utils.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ekp-utils.el b/ekp-utils.el index cdf2c48..f9f6376 100644 --- a/ekp-utils.el +++ b/ekp-utils.el @@ -128,11 +128,16 @@ PREV-STATE: 1=latin, 2=CJK (previous content type). NEXT-WIDTH: width of next character (1=latin, 2=CJK). Rules: -- Latin-Latin: single space handled by glue, multiple preserves all but last -- CJK involved (prev or next is CJK): preserve ALL spaces" +- Leading spaces (boxes is nil): preserve all spaces +- CJK involved (prev or next is CJK): preserve all spaces +- Latin-Latin with single space: let glue handle it +- Latin-Latin with multiple spaces: preserve all but last" (when (and spaces (not (string-empty-p spaces))) (let ((cjk-involved (or (= prev-state 2) (= next-width 2)))) (cond + ;; Leading spaces (no previous boxes): preserve all + ((null boxes) + (setq boxes (cons spaces boxes))) ;; CJK involved: preserve all spaces (cjk-involved (setq boxes (cons spaces boxes)))