Fix TODO keyword switching for Unicode keywords#43
Open
hiroakit wants to merge 2 commits into
Open
Conversation
Co-authored-by: hiroakiendoh <hiroakiendoh@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #43 +/- ##
===========================================
+ Coverage 69.40% 78.48% +9.07%
===========================================
Files 12 12
Lines 1010 1041 +31
Branches 48 58 +10
===========================================
+ Hits 701 817 +116
+ Misses 309 224 -85
🚀 New features to boost your workflow:
|
Co-authored-by: hiroakiendoh <hiroakiendoh@gmail.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bugfix Overview
TODO keyword switching failed when TODO keywords contained non-ASCII characters (e.g., CJK/Hangul), because the heading matcher relied on an ASCII word-boundary check.
This PR updates TODO detection to use an explicit delimiter check and adds regression tests to cover Unicode keywords.
Problem
org.incrementContext/org.decrementContextdoes not recognize the TODO context in headings, so switching does nothing (or becomes inconsistent).Reproduction Steps
org.todoKeywordsto Unicode keywords (example:["待办", "完成"]).* Header.Org: Increment Context(or press the bound key).* 待办 Header->* 完成 Header->* Header(cycle). Observed (before): no switch / inconsistent switching.Root Cause
\bto detect keyword boundaries. In JS regex,\bis ASCII word-boundary based ([A-Za-z0-9_]) and does not work reliably for non-ASCII keywords.TODO,DONE) and did not include Unicode TODO keywords.Fix
\bboundary check with a lookahead for expected delimiters after a TODO keyword (\s,[, or end-of-line).* ...) as the empty TODO keyword context and cycling into the first configured keyword.org.todoKeywordsand validate increment/decrement cycling.Verification
Impact / Risk
org.todoKeywordswith Unicode keywords (Japanese/Chinese/Korean, etc.).\b.Related Issues / PRs