feat(fold): add column counting for character width mode in process_ascii_line
Implement logic to increment column count in WidthMode::Characters, emitting output when width is reached. This ensures accurate line folding for multi-byte characters, enhancing Unicode support.
6d721e5
8 days ago
by mattsu2020
+2.13%
fix fold: emit output early when column count reaches width limit
- Added conditional check in fold_file function to call emit_output when col_count >= width
- Ensures lines are properly wrapped based on byte or character width before final output flush
- Improves handling of incomplete lines that need early breaking to respect the specified width
b21cf35
8 days ago
by mattsu2020
+6.15%
refactor(fold): split long if-conditions into multiple lines for readability
Refactor code in fold.rs to break lengthy if-condition statements across multiple lines in push_ascii_segment, process_utf8_line, and process_non_utf8_line functions. This improves code readability without changing functionality.
b0e0033
8 days ago
by mattsu2020
-1.16%
feat(fold): add streaming output with periodic flushing to reduce memory usage
Introduce a STREAMING_FLUSH_THRESHOLD constant and helper functions (maybe_flush_unbroken_output, push_byte, push_bytes) to periodically flush the output buffer when it exceeds 8KB and no spaces are being tracked, preventing excessive memory consumption when processing large files. This refactor replaces direct buffer pushes with checks for threshold-based flushing.
ac09d10
8 days ago
by mattsu2020
-2.52%
fix(fold): correct premature output emission in character mode and add tests
Remove conditional checks that incorrectly emitted output when column count reached width in character mode, ensuring proper folding of wide characters and handling of edge cases. Add comprehensive tests for wide characters, invalid UTF-8, zero-width spaces, and buffer boundaries to verify correct behavior. This prevents issues with multi-byte character folding where output was prematurely flushed, improving accuracy for Unicode input.
dba5b9b
7 days ago
by mattsu2020
0%
refactor: clean up formatting in fold utility and tests
- Remove trailing empty lines in fold.rs
- Compact multiline variable assignments in test_fold.rs for readability
556804c
7 days ago
by mattsu2020
0%
Merge branch 'main' into fold_compatibility
5424072
7 days ago
by mattsu2020
0%
feat(fold): add unicode-width dependency and tests for zero-width characters
Add unicode-width crate to handle zero-width Unicode characters in fold utility. Introduced new test 'test_zero_width_data_line_counts' to verify correct wrapping in --characters mode for zero-width bytes and spaces, ensuring fold behaves consistently with character counts rather than visual width.
a1bbd40
7 days ago
by mattsu2020
0%
perf: use bytecount for efficient newline counting in fold tests
- Add bytecount dependency to Cargo.toml and Cargo.lock
- Refactor newline_count function in test_fold.rs to use bytecount::count instead of manual iteration for better performance
d176e65
7 days ago
by mattsu2020
+41.66%
refactor: Handle zero-width bytes across buffer boundaries in fold
Modify the fold implementation to process input in buffered chunks rather than line-by-line reading, ensuring correct handling of multi-byte characters split across buffer boundaries. Add process_pending_chunk function and new streaming logic to fold_file for better performance on large files. Update tests accordingly.
dbad8db
7 days ago
by mattsu2020
-0.46%
refactor(fold): condense variable assignment to single line
Consolidate the assignment of the `valid` variable from multiple lines to a single line for improved code readability and adherence to style guidelines favoring concise declarations.
75c542f
7 days ago
by mattsu2020
-0.03%
Merge branch 'main' into fold_compatibility
662a011
5 days ago
by mattsu2020
0%
Merge branch 'main' into fold_compatibility
3b07c8e
5 days ago
by mattsu2020
+3.43%
Merge branch 'main' into fold_compatibility
1d35753
2 days ago
by mattsu2020
0%
fix(fold): properly handle combining characters in character-counting mode
Only coalesce zero-width combining characters into base characters when folding by display columns (WidthMode::Columns). In character-counting mode, treat every scalar value as advancing the counter to match chars().count() semantics, preventing incorrect line breaking for characters with zero-width marks. This ensures consistent behavior across modes as verified by existing tests.