Commit Graph

43 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
b70affb9ef Optimize hyphen position lookup O(n)->O(log n) and add named constants
Performance:
- ekp--hyphenate-p: O(n) cl-find -> O(log n) binary search
- is_hyphen_break: O(n) linear -> O(log n) binary search
- is_hyphen_pos: O(n) linear -> O(log n) binary search

In O(n²) DP loop, this reduces worst-case complexity from O(n³) to O(n² log n)

Code quality:
- Add ekp-consecutive-hyphen-penalty (was hardcoded 100)
- Add ekp-forced-break-penalty (was hardcoded 10000)
- Add ekp-last-line-short-penalty (was hardcoded 50)
- Update ekp-looseness docstring noting partial implementation

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-25 11:15:42 +00:00
copilot-swe-agent[bot]
fb58a9b19a Fix remaining global glue param usages in DP and glue distribution functions
Code review found additional functions using global glue params instead
of para's stored params:
- ekp--compute-stretch-capacity: now takes para param
- ekp--compute-shrink-capacity: now takes para param
- ekp--line-badness-and-fitness: now takes para param
- ekp--dp-compute-line-demerits: now takes para param
- ekp--distribute-gap-adjustment: now takes para param

All capacity/distribution calculations now use para's stored glue params
for full consistency across multi-font paragraphs.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-25 11:03:27 +00:00
copilot-swe-agent[bot]
333618bb57 Fix glue parameter caching inconsistency for multi-font paragraphs
When multiple paragraphs with different fonts were processed, subsequent
executions would use wrong glue parameters from the cache. This caused
misalignment because different fonts have different spacing values.

Changes:
- Add glue-params field to ekp-para struct to store params at creation
- Add helper functions: ekp--para-glue-ideal/shrink/stretch/min/max
- Update all C module interface functions to use para's stored params
- Update all glue computation functions for consistency

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-25 10:52:45 +00:00
copilot-swe-agent[bot]
fee05f769d Fix C module to match Elisp behavior for last-line overflow handling
When is_last && ideal > line_width, the C module now correctly
triggers force break logic, matching ekp--dp-cache-elisp behavior.
This ensures consistent results between C module and pure Elisp paths.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-25 10:32:06 +00:00
copilot-swe-agent[bot]
b296de0928 Initial plan 2026-01-25 10:25:46 +00:00
Kinneyzhang
a790aa87c3 update 2026-01-25 18:23:33 +08:00
Kinneyzhang
68ca9b191a improve C module parallel 2026-01-25 17:28:04 +08:00
Kinneyzhang
6cf6f75f71 fix bugs of C moudule 2026-01-25 16:53:23 +08:00
Kinneyzhang
aaeea099c9 fix bug 2026-01-25 15:11:47 +08:00
Kinneyzhang
c88bbdd395 add dynamic moudle to improve prefermance 2026-01-25 13:50:46 +08:00
Kinneyzhang
91d9bbc1e9 process spaces between words 2026-01-25 01:17:18 +08:00
Kinneyzhang
6cf17e0066 update knuth-plass paper link 2026-01-24 22:46:48 +08:00
Kinneyzhang
6421f6b1fb refactor ekp cache and code improve 2026-01-24 22:40:53 +08:00
Kinneyzhang
68b46f8337 code improve 2026-01-24 20:44:38 +08:00
copilot-swe-agent[bot]
dab9ca280e Add optional use-cache parameter to ekp-pixel-justify and ekp-pixel-range-justify
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2025-11-29 17:56:42 +00:00
copilot-swe-agent[bot]
c4240fe15c Initial plan 2025-11-29 17:54:24 +00:00
copilot-swe-agent[bot]
f56ec5a520 Fix ekp-text-hash to consider text properties
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2025-11-29 17:09:16 +00:00
copilot-swe-agent[bot]
5c646bf6be Initial plan 2025-11-29 17:06:09 +00:00
Kinneyzhang
ca9349e99f fix bug when text is blank string 2025-09-26 00:18:37 +08:00
Kinneyzhang
820e73920a update test 2025-08-22 00:15:33 +08:00
Kinneyzhang
37baccded8 keep original text properties of string after typesetting 2025-08-22 00:06:14 +08:00
Kinneyzhang
165be829df a batter ekp-cjk-char-p 2025-08-19 11:31:48 +08:00
Kinneyzhang
796d3e49d2 misc 2025-08-18 00:35:40 +08:00
Kinneyzhang
12b5029bbf update readme_zh 2025-08-09 19:32:23 +08:00
Kinneyzhang
3df885bef8 Merge branch 'main' of github.com:Kinneyzhang/emacs-kp 2025-08-09 19:30:12 +08:00
Kinneyzhang
28d6c8ee77 fix bug in ekp-hyphen-str 2025-08-09 19:29:07 +08:00
Kinneyzhang
3d1e975878 update readme 2025-07-31 10:51:39 +08:00
Kinneyzhang
b6ee3dedcc fix bug when a line only has one word ends with hyphen 2025-07-29 15:43:23 +08:00
Kinneyzhang
564f33ba27 fix issue #1 2025-07-28 19:45:40 +08:00
Kinneyzhang
4facde5235 Merge branch 'main' of github.com:Kinneyzhang/emacs-kp 2025-07-28 17:19:27 +08:00
Kinneyzhang
b64975e295 add Next Todos 2025-07-28 17:17:21 +08:00
Kinneyzhang
c6fb8743bb add Next Todos 2025-07-28 17:15:57 +08:00
Kinneyzhang
eb78e5316f fix _ local variable bug 2025-07-28 16:58:30 +08:00
Kinneyzhang
b6f6616b81 add chinese example 2025-07-28 00:33:53 +08:00
Kinneyzhang
41bbcf2a69 update readme 2025-07-27 22:56:51 +08:00
Kinneyzhang
ceae5f12c2 update readme 2025-07-27 22:37:55 +08:00
Kinneyzhang
e8a35f1fac update readme 2025-07-27 22:35:49 +08:00
Kinneyzhang
e9b36312fb update readme 2025-07-27 22:33:28 +08:00
Kinneyzhang
6efd1985d1 update readme 2025-07-27 21:53:46 +08:00
Kinneyzhang
f88b4173f7 update readme 2025-07-27 21:41:39 +08:00
Kinneyzhang
890a3cfe97 update readme 2025-07-27 21:39:47 +08:00
Kinneyzhang
a265357e41 update readme 2025-07-27 21:35:44 +08:00
Kinneyzhang
f7f1f7104c first commit 2025-07-26 23:52:04 +08:00