Skip to content

Fix gbuf to account for print width of control characters - #1289

Merged
flyingmutant merged 1 commit into
cmus:masterfrom
gavtroy:fix-gbuf-control-char
Nov 4, 2023
Merged

flyingmutant merged 1 commit into
cmus:masterfrom
gavtroy:fix-gbuf-control-char

Conversation

@gavtroy

@gavtroy gavtroy commented Aug 21, 2023

Copy link
Copy Markdown
Collaborator

Such characters are stored as one byte but print as "<07>" for example.

(Although I'd argue we should just print them as '?' and save all the extra trouble.)

@flyingmutant

Copy link
Copy Markdown
Member

I've started to look into this and got lost a bit. u_str_print_size uses u_print_size which is u_char_size + control exception, however u_copy_chars uses u_char_width inside; this looks inconsistent.

@gavtroy

gavtroy commented Aug 23, 2023

Copy link
Copy Markdown
Collaborator Author

u_char_width is how many columns of screen space are needed, it's not relevant to buffer usage. The u_print_size is to match the amount of buffer needed by u_set_char.

Such characters are stored as one byte but print as "<07>" for example.
@flyingmutant
flyingmutant force-pushed the fix-gbuf-control-char branch from 0ffe474 to 989e181 Compare November 4, 2023 10:04
@flyingmutant
flyingmutant merged commit 1f9964a into cmus:master Nov 4, 2023
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.

2 participants