Commit graph

2 commits

Author SHA1 Message Date
9ca1e9d977 fix: data races, missing persistence, and input safety bugs
- Make client width/height _Atomic to fix data race between window-change
  callback thread and session thread
- Persist join/leave system messages via message_save()
- Fix ftell() error handling: check <= 0 instead of == 0
- Make room_add_message static to enforce lock-must-be-held contract
- Use local copy in execute_command to avoid mutating command_input
- Increase help_copy buffer from 4096 to 8192 for CJK text safety
- Add :q/:quit/:exit command for Vim-style disconnect
- Fix unit test Makefile to link common.c
2026-04-19 17:14:48 +08:00
2535d8bfd4 test: add comprehensive unit tests for UTF-8 and message functions
Add 31 unit tests covering core functionality:
- UTF-8 byte length detection
- UTF-8 character decoding (1-4 byte sequences)
- Character width calculation (ASCII, CJK, Hangul, Hiragana, Katakana)
- String width calculation
- Character/word removal functions
- UTF-8 validation
- Message formatting and edge cases

Test results: 31/31 passed ✓

Files:
- tests/unit/test_utf8.c (20 tests)
- tests/unit/test_message.c (11 tests)
- tests/unit/Makefile (build configuration)
2026-02-08 10:29:19 +08:00