[4291] in BarnOwl Developers
[barnowl/barnowl] Make owl_text_wordwrap count display columns, not
daemon@ATHENA.MIT.EDU (Daniel JB Clark)
Sun Nov 1 23:57:22 2026
Date: Sun, 01 Nov 2026 20:57:18 -0800
From: Daniel JB Clark <notifications@github.com>
Reply-To: barnowl/barnowl <reply+ABCERSL5KCQDMHQVFDB5MQLLMFRC5EVBNHHQAAAAAFXPIQV3@reply.github.com>
To: barnowl/barnowl <barnowl@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
----==_mimepart_6ae8182e1f4fd_d212a820408f
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
owl_text_wordwrap (BarnOwl::wordwrap, used by the default style for
messages matched by the "wordwrap" filter, e.g. Jabber and IRC) compared
byte offsets with a column count. UTF-8 text with accents, CJK or emoji
therefore wrapped far too early, and double-width characters were
under-counted relative to the columns they occupy.
It now walks the string by character and measures each with mk_wcwidth,
as owl_text_expand_tabs already does. Behaviour is otherwise unchanged:
only over-long lines are broken, at the last space; a line without a
space is left alone; existing newlines are kept. A string that isn't
valid UTF-8 is returned unchanged (message bodies are already validated
in owl_message_set_attribute, so the default style never sees one).
Control characters, including tabs, count as zero columns, as in
editwin.c.
Tests: 12 new cases in tester.c (ASCII, multibyte text that fits by
columns but not by bytes, CJK wrapping, no-space words, newlines). Run
with `make check` on Debian trixie: all of t/ passes, including
t/unicode.t. The three byte-vs-column cases fail on the old code.
You can view, comment on, or merge this pull request online at:
https://github.com/barnowl/barnowl/pull/192
-- Commit Summary --
* Make owl_text_wordwrap count display columns, not bytes
-- File Changes --
M tester.c (33)
M text.c (71)
-- Patch Links --
https://github.com/barnowl/barnowl/pull/192.patch
https://github.com/barnowl/barnowl/pull/192.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/barnowl/barnowl/pull/192
You are receiving this because you are subscribed to this thread.
Message ID: <barnowl/barnowl/pull/192@github.com>
----==_mimepart_6ae8182e1f4fd_d212a820408f
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<p dir=3D"auto">owl_text_wordwrap (BarnOwl::wordwrap, used by the default=
style for<br>
messages matched by the "wordwrap" filter, e.g. Jabber and IRC) compared<=
br>
byte offsets with a column count. UTF-8 text with accents, CJK or emoji<b=
r>
therefore wrapped far too early, and double-width characters were<br>
under-counted relative to the columns they occupy.</p>
<p dir=3D"auto">It now walks the string by character and measures each wi=
th mk_wcwidth,<br>
as owl_text_expand_tabs already does. Behaviour is otherwise unchanged:<b=
r>
only over-long lines are broken, at the last space; a line without a<br>
space is left alone; existing newlines are kept. A string that isn't<br>
valid UTF-8 is returned unchanged (message bodies are already validated<b=
r>
in owl_message_set_attribute, so the default style never sees one).<br>
Control characters, including tabs, count as zero columns, as in<br>
editwin.c.</p>
<p dir=3D"auto">Tests: 12 new cases in tester.c (ASCII, multibyte text th=
at fits by<br>
columns but not by bytes, CJK wrapping, no-space words, newlines). Run<br=
>
with <code class=3D"notranslate">make check</code> on Debian trixie: all =
of t/ passes, including<br>
t/unicode.t. The three byte-vs-column cases fail on the old code.</p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href=3D'https://github.com/barnowl/barnowl/pull/192'>ht=
tps://github.com/barnowl/barnowl/pull/192</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href=3D"https://github.com/barnowl/barnowl/pull/192/commits/85c2=
0110177edc51f82c2d7b33cc5228e477aac7" class=3D"commit-link">85c2011</a> =
Make owl_text_wordwrap count display columns, not bytes</li>
</ul>
<h4 style=3D"display: inline-block">File Changes </h4> <p style=3D"displa=
y: inline-block">(<a href=3D"https://github.com/barnowl/barnowl/pull/192/=
files">2 files</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href=3D"https://github.com/barnowl/barnowl/pull/192/files#diff-c85=
48f6161b285d1dcf6b60ff8b10686144e46ce900e9eea662702247be25601">tester.c</=
a>
(33)
</li>
<li>
<strong>M</strong>
<a href=3D"https://github.com/barnowl/barnowl/pull/192/files#diff-c65=
cf7d39f72db95023ff89f86008aeb3d50664ccea17feb238a2bb1445c0b98">text.c</a>=
(71)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href=3D'https://github.com/barnowl/barnowl/pull/192.patch'>https=
://github.com/barnowl/barnowl/pull/192.patch</a></li>
<li><a href=3D'https://github.com/barnowl/barnowl/pull/192.diff'>https:=
//github.com/barnowl/barnowl/pull/192.diff</a></li>
</ul>
<p style=3D"font-size:small;-webkit-text-size-adjust:none;color:#666;">&m=
dash;<br />Reply to this email directly, <a href=3D"https://github.com/ba=
rnowl/barnowl/pull/192?email_source=3Dnotifications&email_token=3DABC=
ERSJRYIUTOCO4LEMKFMD5XAAZ5A5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2W=
K43UF42TCMJVGE4DSNRXHCTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6=
Y3MNFRWW">view it on GitHub</a>, or <a href=3D"https://github.com/notific=
ations/unsubscribe-auth/ABCERSLS3BGC3GH42KSPR3T5XAAZ5AVCNFSNUABCKJSXA33TN=
F2G64TZHM3TINZTGA4TWSLTON2WKOZWGE2TMNBWHA4TEM5BOYBA">unsubscribe</a>.<br =
/>Triage notifications, keep track of coding agent tasks and review pull =
requests on the go with GitHub Mobile for <a href=3D"https://github.com/n=
otifications/mobile/ios/ABCERSK6UY2NQJE3LHG6V2D5XAAZ5A5CNFSNUABEM5UWIORPF=
5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMJVGE4DSNRXHCTHEZLBONXW5KTTOVRHGY3SNF=
RGKZFFMV3GK3TUVJTG633UMVZF62LPOM">iOS</a> and <a href=3D"https://github.c=
om/notifications/mobile/android/ABCERSKGGQHFV6PZJT744UL5XAAZ5A5CNFSNUABEM=
5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMJVGE4DSNRXHCTHEZLBONXW5KTTOV=
RHGY3SNFRGKZFFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE">Android</a>. Download it =
today!
<br />You are receiving this because you are subscribed to this thread.<i=
mg src=3D"https://github.com/notifications/beacon/ABCERSMYJR4USJZXGMT4I5L=
5XAAZ5BFCNFSM6AAAAADD77TNLKWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3J=
MTHQAAAAAFXPIQV3UZZGKYLTN5XKU43VMJZWG4TJMJSWI.gif" height=3D"1" width=3D"=
1" alt=3D"" /><span style=3D"color: transparent; font-size: 0; display: n=
one; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: =
0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><barn=
owl/barnowl/pull/192</span><span>@</span><span>github</span><span>.</span=
><span>com></span></span></p>
<script type=3D"application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/barnowl/barnowl/pull/192?email_source=3Dnot=
ifications\u0026email_token=3DABCERSN5RKNCGONE36IY23D5XAAZ5A5CNFSNUABEM5U=
WIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMJVGE4DSNRXHCTHEZLBONXW5KTTOVRH=
GY3SNFRGKZFFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ",
"url": "https://github.com/barnowl/barnowl/pull/192?email_source=3Dnotifi=
cations\u0026email_token=3DABCERSN5RKNCGONE36IY23D5XAAZ5A5CNFSNUABEM5UWIO=
RPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMJVGE4DSNRXHCTHEZLBONXW5KTTOVRHGY3=
SNFRGKZFFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>
----==_mimepart_6ae8182e1f4fd_d212a820408f--