Implement ignore and UTF-8

This commit is contained in:
Mingye Wang
2021-04-20 09:52:40 +08:00
parent 69c7e86967
commit 8fd71febc6
5 changed files with 98 additions and 19 deletions

17
docs/LOCALE.md Normal file
View File

@@ -0,0 +1,17 @@
Locale Considerations
=====================
The editline library has basic support for locales via the use of the standard
POSIX functions `mbrtowc` and `wcwidth`. As a result, the on-screen width of
characters in printed text should be calculated correctly, the so-called
[East Asian ambiguous][] characters being a notable exception.
[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
using `mbrlen` when deleting.
Programs wishing to use the feature need to link to a build of `editline`
configured with `--enable-locale`. In addition, the program should call
`setlocale(LC_CTYPE, "")` to use the locale settings of the environment.

View File

@@ -29,11 +29,9 @@ Other minor TODO's
`el_bind_key()` exists.
- Make `char *rl_prompt;` globally visible.
- Add support for `rl_set_prompt()`
- Add support for `--enable-utf8` to configure script
- Use `strcmp(nl_langinfo(CODESET), "UTF-8")` to look for utf8 capable
terminal
- Implement simple UTF-8 parser according to
http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- Make the input multibyte-aware in `insert_string` and `delete_string`.
[gnu]: http://www.delorie.com/gnu/docs/readline/rlman_41.html#IDX288