History log of /freebsd-current/sys/teken/teken_wcwidth.h
Revision Date Author Comments
# 90367ba7 12-Oct-2023 Christos Margiolis <christos@FreeBSD.org>

teken: fix style in teken_wcwidth.h

Reviewed by: bojan.novkovic_fer.hr
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D42164


# 2fed1c57 12-Oct-2023 Bojan Novković <bojan.novkovic@fer.hr>

tty/teken: fix UTF8 sequence validation logic

This patch fixes UTF-8 sequence validation logic in
teken_utf8_bytes_to_codepoint() and fixes fallback behaviour in
ttydisc_rubchar() when an invalid UTF8 sequence is encountered. The code
previously used __bitcount() to extract sequence length information from
the leading byte. However, this assumption breaks for certain code
points that have additional bits set in the first half of the leading
byte (e.g. Cyrillic characters). This lead to incorrect behaviour when
deleting those characters using backspaces. The code now checks the
number of consecutive set bits in the leading byte starting from the
MSB, as per RFC 3629.

Reviewed by: christos
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D42147


# 4b9aa38e 08-Oct-2023 Mateusz Guzik <mjg@FreeBSD.org>

teken: fix up unused func warnings

Sponsored by: Rubicon Communications, LLC ("Netgate")


# 6d3296f1 07-Oct-2023 Christos Margiolis <christos@FreeBSD.org>

teken: use __bitcount() instead of bitcount()

The use of bitcount() triggered a build error because it couldn't be
located. __bitcount() on the other hand is defined in sys/types.h, which
is included in teken/teken.h.

MFC after: 2 weeks


# 9e589b09 07-Oct-2023 Bojan Novković <bojan.novkovic@fer.hr>

tty: fix improper backspace behaviour for UTF8 characters when in canonical mode

This patch adds additional logic in ttydisc_rubchar() to properly handle
backspace behaviour for UTF-8 characters.

Currently, typing in a backspace after a UTF8 character will delete only
one byte from the byte sequence, leaving garbled output in the tty's
output queue. With this change all of the character's bytes are deleted.
This change is only active when the IUTF8 flag is set (see
19054eb6053189144aa962b2ecc1bf5087758a3e "(s)tty: add support for IUTF8
input flag")

The code uses the teken_wcwidth() function to properly handle character
column widths for different code points, and adds the
teken_utf8_bytes_to_codepoint() function that converts a UTF-8 byte
sequence to a codepoint, as specified in RFC3629.

Reported by: christos
Reviewed by: christos, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D42067


# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 92223bdd 08-Apr-2018 Poul-Henning Kamp <phk@FreeBSD.org>

Pedantic polishing of code to please FlexeLint.

Approved by: ed


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 9b934d09 03-Sep-2009 Ed Schouten <ed@FreeBSD.org>

Move libteken out of the syscons directory.

I initially committed libteken to sys/dev/syscons/teken, but now that
I'm working on a console driver myself, I noticed this was not a good
decision. Move it to sys/teken to make it easier for other drivers to
use a terminal emulator.

Also list teken.c in sys/conf/files, instead of listing it in all the
files.arch files separately.