Page MenuHomeFreeBSD

ed: add unicode support for the l (list) command
Needs ReviewPublic

Authored by bapt on Thu, Feb 19, 10:03 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Use mbrtowc()/iswprint()/wcwidth() in put_tty_line() so that
the l command displays valid multibyte characters as-is instead
of escaping each byte as octal.

Column wrapping now correctly accounts for character display
width (including double-width CJK characters).

Invalid or incomplete UTF-8 sequences and non-printable
characters are still escaped as octal.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 70778
Build 67661: arc lint + arc unit

Event Timeline

Do regexps addresses and commands like 's' correctly operate on mb strings?

yes it does, all the tests in https://reviews.freebsd.org/D55364 are passing with this patch.

I may be missing some idea on what to test

I may be missing some idea on what to test

Might be add some tests for e.g. ru_RU.UTF-8? What do you need for this?

In D55365#1266404, @kib wrote:

I may be missing some idea on what to test

Might be add some tests for e.g. ru_RU.UTF-8? What do you need for this?

In D55365#1266404, @kib wrote:

I may be missing some idea on what to test

Might be add some tests for e.g. ru_RU.UTF-8? What do you need for this?

juste provide me a set of command you would expect to work in ru_RU.UTF-8 and and expected output and I will add it to the test suite.

In D55365#1266404, @kib wrote:

I may be missing some idea on what to test

Might be add some tests for e.g. ru_RU.UTF-8? What do you need for this?

In D55365#1266404, @kib wrote:

I may be missing some idea on what to test

Might be add some tests for e.g. ru_RU.UTF-8? What do you need for this?

juste provide me a set of command you would expect to work in ru_RU.UTF-8 and and expected output and I will add it to the test suite.

exa% LANG=ru_RU.UTF-8 ./ed
a
Привет
.
s/ривет/ока/
1p
Пока
a
Строка
.
1      
Пока
/а/p
Строка
1,$p
Пока
Строка
Q

(GNU ed)

https://reviews.freebsd.org/D55364 now has your tests and they pass

Thank you. Looks good for me, but I am not qualified to review.