Skip to content

Fix Library crash with CJK characters in book titles#132

Open
meiningnie wants to merge 1 commit into
wustho:masterfrom
meiningnie:fix-cjk-display-width
Open

Fix Library crash with CJK characters in book titles#132
meiningnie wants to merge 1 commit into
wustho:masterfrom
meiningnie:fix-cjk-display-width

Conversation

@meiningnie

Copy link
Copy Markdown

CJK characters (Chinese, Japanese, Korean) occupy 2 terminal columns, but the code truncated strings by character count instead of display width. This caused pad.addstr() to overflow and crash when displaying Library items with CJK characters in titles.

Added display_width() and truncate_by_width() functions to properly handle character width when truncating strings for display.

CJK characters (Chinese, Japanese, Korean) occupy 2 terminal columns,
but the code truncated strings by character count instead of display width.
This caused pad.addstr() to overflow and crash when displaying Library
items with CJK characters in titles.

Added display_width() and truncate_by_width() functions to properly
handle character width when truncating strings for display.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant