Skip to content

Add multibyte / locale and ignore support#49

Draft
Artoria2e5 wants to merge 2 commits intotroglobit:masterfrom
Artoria2e5:width
Draft

Add multibyte / locale and ignore support#49
Artoria2e5 wants to merge 2 commits intotroglobit:masterfrom
Artoria2e5:width

Conversation

@Artoria2e5
Copy link

@Artoria2e5 Artoria2e5 commented Apr 20, 2021

This PR, when completed, shall close #37 and close #48. The handling for multibyte in the prompt is done, but not for the input.

@Artoria2e5
Copy link
Author

Artoria2e5 commented Apr 21, 2021

This is gonna take a bit longer than expected, as rl_point is unreliable for column counting: a new variable needs to be made to count columns and change every time rl_point is changed. That's 104 occurances in the code to be checked, well.

(In addition to multibyte, another way column counting may break is... control characters in linebuf. editline now correctly show them in caret-escape form, so despite them being one byte they take 2 columns.)

The mblen thing, on the other hand, might be a bit easier to deal with now. I figured instead of the 100% correct left-to-right approach (parse the whole string), I can go right to left without breaking too many non-self-synchonizing legacy encodings.

Copy link
Owner

@troglobit troglobit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far.

[East Asian ambiguous]: http://www.unicode.org/reports/tr11/tr11-38.html

The input handling is not yet multibyte-aware. Specifically, the presence of
non-self-synchonizing encodings requires always segmenting the whole string
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/synchonizing/synchronizing/ maybe?


#define RL_PROMPT_START_IGNORE '\1'
#define RL_PROMPT_END_IGNORE '\2'

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor indent level issue?

AC_ARG_ENABLE(termcap,
AS_HELP_STRING([--enable-termcap], [Use termcap library to query terminal size.]))

AC_ARG_ENABLE(locale,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer for this to be enabled by default, since that's what ppl expect, and detect capability and fall-back to non-utf-8 capable.

@mcfriend99
Copy link

Why hasn't this been merged

@troglobit
Copy link
Owner

@mcfriend99 because it's unfinished? Op clearly states "This PR, when completed ..." and "This is gonna take a bit longer than expected ...", not to mention the unaddressed review comments of mine that are yet to be resolved.

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.

Request for \1 and \2 (RL_PROMPT_START_IGNORE, RL_PROMPT_END_IGNORE) support Request for UTF-8 support

3 participants