Merged
Conversation
Implement a stack-based token parser using Ragel for efficient ANSI
escape code generation. Key features:
- Deferred emission: ANSI codes only emit when characters are printed
- Redundancy avoidance: repeated identical styles emit single code
- Auto-reset at newlines: styles automatically reset before each \n
- Stack-based nesting: {/} pops to previous state, {/name} also works
- Pre-reserved buffer for better allocation performance
Token changes:
- {b} now just bold (was bold+yellow)
- {highlight} added for bold+yellow (fuzzy match highlighting)
- {danger} added for dark red background (delete mode)
- {strike} now strikethrough text (was legacy alias)
Includes comprehensive unit test suite (25 tests) using acutest.
Add exception to .gitignore so the token system specification is tracked. This documents the complete token expansion system for reference.
- Add control tokens: {clr}, {cls}, {home}, {hide}, {show}, {goto:row,col}, {goto_cursor}
- Add zstr_expand_to() for direct output to FILE* streams
- Add token_expansion_render() with automatic cursor positioning
- Enhance TokenExpansion struct with has_cursor, final_row, final_col fields
- Update {section} token to include subtle dark gray background (256-color 237)
- Update {highlight} token for selection arrow (bold + yellow)
- Replace all raw ANSI escape codes in tui.c with tokens
- Add token_expansion_free() helper function
🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Implement a stack-based token parser using Ragel for efficient ANSI escape code generation. Key features:
Token changes:
Includes comprehensive unit test suite (25 tests) using acutest.