Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
0101-kernel-Fix-broken-wcwidth-for-wide-chars.p...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0101-kernel-Fix-broken-wcwidth-for-wide-chars.patch of Package erlang
From 0e32395bc63a92ec6d64690ef11060d165317214 Mon Sep 17 00:00:00 2001 From: Lukas Larsson <lukas@erlang.org> Date: Mon, 15 Apr 2024 20:47:20 +0200 Subject: [PATCH] kernel: Fix broken wcwidth for wide chars On OSs with old libc, the wcwidth will return -1 for most/all emoji characters even if they are known to be wide characters. So we add a check that if -1 is returned for something that is known to be wide, we return 2 in size instead of 0. --- lib/kernel/src/prim_tty.erl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/kernel/src/prim_tty.erl b/lib/kernel/src/prim_tty.erl index 3e61207b1e..0fe13b84b8 100644 --- a/lib/kernel/src/prim_tty.erl +++ b/lib/kernel/src/prim_tty.erl @@ -1113,7 +1113,14 @@ npwcwidth(Char) -> npwcwidth(Char, true). npwcwidth(Char, true) -> case wcwidth(Char) of - {error, not_printable} -> 0; + {error, not_printable} -> + %% Sometimes libc wcwidth if wrong and returns -1 aka not_printable + %% for something that is a wide character. So we try to make things + %% better by returning 2 for such characters. + case unicode_util:is_wide(Char) of + true -> 2; + false -> 0 + end; {error, enotsup} -> case unicode_util:is_wide(Char) of true -> 2; -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor