mirror of
https://github.com/tw93/Mole.git
synced 2026-02-05 23:43:01 +00:00
feat: Improve CJK character width calculation, enhance SQLite vacuum test robustness, and update security audit documentation for core cleaning and optimization logic.
This commit is contained in:
@@ -146,6 +146,8 @@ func coloredProgressBar(value, max int64, percent float64) string {
|
||||
func runeWidth(r rune) int {
|
||||
if r >= 0x4E00 && r <= 0x9FFF ||
|
||||
r >= 0x3400 && r <= 0x4DBF ||
|
||||
r >= 0x3040 && r <= 0x30FF ||
|
||||
r >= 0x31F0 && r <= 0x31FF ||
|
||||
r >= 0xAC00 && r <= 0xD7AF ||
|
||||
r >= 0xFF00 && r <= 0xFFEF {
|
||||
return 2
|
||||
|
||||
@@ -14,7 +14,7 @@ func TestRuneWidth(t *testing.T) {
|
||||
{"ASCII letter", 'a', 1},
|
||||
{"ASCII digit", '5', 1},
|
||||
{"Chinese character", '中', 2},
|
||||
{"Japanese hiragana", 'あ', 1}, // BUG: Should be 2, but current implementation returns 1
|
||||
{"Japanese hiragana", 'あ', 2},
|
||||
{"Korean hangul", '한', 2},
|
||||
{"CJK ideograph", '語', 2},
|
||||
{"Full-width number", '1', 2},
|
||||
|
||||
Reference in New Issue
Block a user