Skip to content

CJK characters display "higher" than Latins, so the terminal scroll to wrong place after showing long CJK text #1071

@cppHusky

Description

@cppHusky

CJK characters in rio seem to displays "higher" than Latins. It's a good idea, because CJK characters become more readable with more vertical spaces. (In contrast, that in vim is less readable)

Image

However, I found that after a long CJK text was output in rio terminal, it run into a strange status...

Image

If all characters are Latin, everything works well like the top-left terminal shows.

But when characters are all CJK or CJK/Latin mixed, as the right terminal shows, the terminal scrolls less than 4 lines down after the printf command executed.

I think the problem is caused by rio assuming the height of contents is equal to that of 4 Latin character lines, not 4 CJK/Latin mixed character lines.

Image

Here are two examples with two passages, one is Li Sao in Chinese, the other is a part of Hamlet. After cat Hamlet everything goes well, but after cat "Li Sao" it scrolls to quite a wrong place and I cannot even see the input line!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions