[4298] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[barnowl/barnowl] Fix boldify when the text contains all four closers

daemon@ATHENA.MIT.EDU (Daniel JB Clark)
Mon Nov 2 20:12:09 2026

Date: Mon, 02 Nov 2026 17:12:06 -0800
From: Daniel JB Clark <notifications@github.com>
Reply-To: barnowl/barnowl <reply+ABCERSI4DWV6UJCO4WU7IBTLMJ7ONEVBNHHQAAAAAFYAD4OB@reply.github.com>
To: barnowl/barnowl <barnowl@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>


----==_mimepart_6ae934e69ef60_10d12d0136641
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

Body:
boldify wraps its argument in @b(...) using a delimiter that does not occur in the text. When ) > } ] all occur it fell back to rewriting every ")" as ")@b[)]@b(". That is only right for plain text. The argument is ztext (Default.pm boldifies a whole incoming personal message, e.g. "@b(PING) [...] from @b(sender)"), and the rewrite also hit the ")" closing that markup, leaving a stray ")" in the output.

Walk the text the way owl_fmtext_append_ztext does and escape only the ")" that are literal at the top level. Unclosed markup in the text is closed before our closer, including an unterminated @color( (which would otherwise take our closer as its terminator). Text nested too deeply to wrap within the 32-level ztext limit, or whose result would draw different text, is returned as it was.

Only the all-four-closers fallback changes. The simple branches (text lacking one of the closers) are untouched and still let unclosed markup in the text swallow the wrapper's closer, as before.


You can view, comment on, or merge this pull request online at:

  https://github.com/barnowl/barnowl/pull/199

-- Commit Summary --

  * Fix boldify when the text contains all four closers

-- File Changes --

    M perl/lib/BarnOwl/Style.pm (77)
    A t/style-boldify.t (132)

-- Patch Links --

https://github.com/barnowl/barnowl/pull/199.patch
https://github.com/barnowl/barnowl/pull/199.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/barnowl/barnowl/pull/199
You are receiving this because you are subscribed to this thread.

Message ID: <barnowl/barnowl/pull/199@github.com>

----==_mimepart_6ae934e69ef60_10d12d0136641
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"auto">Body:<br>
boldify wraps its argument in <a class=3D"user-mention notranslate" data-=
hovercard-type=3D"user" data-hovercard-url=3D"/users/b/hovercard" data-oc=
to-click=3D"hovercard-link-click" data-octo-dimensions=3D"link_type:self"=
 href=3D"https://github.com/b">@b</a>(...) using a delimiter that does no=
t occur in the text. When ) &gt; } ] all occur it fell back to rewriting =
every ")" as ")<a class=3D"user-mention notranslate" data-hovercard-type=3D=
"user" data-hovercard-url=3D"/users/b/hovercard" data-octo-click=3D"hover=
card-link-click" data-octo-dimensions=3D"link_type:self" href=3D"https://=
github.com/b">@b</a>[)]<a class=3D"user-mention notranslate" data-hoverca=
rd-type=3D"user" data-hovercard-url=3D"/users/b/hovercard" data-octo-clic=
k=3D"hovercard-link-click" data-octo-dimensions=3D"link_type:self" href=3D=
"https://github.com/b">@b</a>(". That is only right for plain text. The a=
rgument is ztext (Default.pm boldifies a whole incoming personal message,=
 e.g. "<a class=3D"user-mention notranslate" data-hovercard-type=3D"user"=
 data-hovercard-url=3D"/users/b/hovercard" data-octo-click=3D"hovercard-l=
ink-click" data-octo-dimensions=3D"link_type:self" href=3D"https://github=
.com/b">@b</a>(PING) [...] from <a class=3D"user-mention notranslate" dat=
a-hovercard-type=3D"user" data-hovercard-url=3D"/users/b/hovercard" data-=
octo-click=3D"hovercard-link-click" data-octo-dimensions=3D"link_type:sel=
f" href=3D"https://github.com/b">@b</a>(sender)"), and the rewrite also h=
it the ")" closing that markup, leaving a stray ")" in the output.</p>
<p dir=3D"auto">Walk the text the way owl_fmtext_append_ztext does and es=
cape only the ")" that are literal at the top level. Unclosed markup in t=
he text is closed before our closer, including an unterminated <a class=3D=
"user-mention notranslate" data-hovercard-type=3D"organization" data-hove=
rcard-url=3D"/orgs/color/hovercard" data-octo-click=3D"hovercard-link-cli=
ck" data-octo-dimensions=3D"link_type:self" href=3D"https://github.com/co=
lor">@color</a>( (which would otherwise take our closer as its terminator=
). Text nested too deeply to wrap within the 32-level ztext limit, or who=
se result would draw different text, is returned as it was.</p>
<p dir=3D"auto">Only the all-four-closers fallback changes. The simple br=
anches (text lacking one of the closers) are untouched and still let uncl=
osed markup in the text swallow the wrapper's closer, as before.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>&nbsp;&nbsp;<a href=3D'https://github.com/barnowl/barnowl/pull/199'>ht=
tps://github.com/barnowl/barnowl/pull/199</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href=3D"https://github.com/barnowl/barnowl/pull/199/commits/cd32=
9953ac9f1977bf04e19169b4d9d5c189fad8" class=3D"commit-link">cd32995</a>  =
Fix boldify when the text contains all four closers</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/199/=
files">2&nbsp;files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href=3D"https://github.com/barnowl/barnowl/pull/199/files#diff-6b8=
6cb913839d79bd7643e24202678be8922eb83ad0c8a83998a6f451a232c3c">perl/lib/B=
arnOwl/Style.pm</a>
    (77)
  </li>
  <li>
    <strong>A</strong>
    <a href=3D"https://github.com/barnowl/barnowl/pull/199/files#diff-2fa=
49251d3316660916794bb96af655b4105963530cb410437f74d904e5e7f9c">t/style-bo=
ldify.t</a>
    (132)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href=3D'https://github.com/barnowl/barnowl/pull/199.patch'>https=
://github.com/barnowl/barnowl/pull/199.patch</a></li>
  <li><a href=3D'https://github.com/barnowl/barnowl/pull/199.diff'>https:=
//github.com/barnowl/barnowl/pull/199.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/199?email_source=3Dnotifications&amp;email_token=3DABC=
ERSKOYQL7UOPBRP76P5D5XEWGNA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2W=
K43UF42TCMZQGA4DONJXGCTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6=
Y3MNFRWW">view it on GitHub</a>, or <a href=3D"https://github.com/notific=
ations/unsubscribe-auth/ABCERSNTQZCGYYO5CTADZVD5XEWGNAVCNFSNUABCKJSXA33TN=
F2G64TZHM3TINZTGA4TWSLTON2WKOZWGE3TIMJUGI4TCM5BOYBA">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/ABCERSPC4CTEKY2WFHQPZCT5XEWGNA5CNFSNUABEM5UWIORPF=
5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMZQGA4DONJXGCTHEZLBONXW5KTTOVRHGY3SNF=
RGKZFFMV3GK3TUVJTG633UMVZF62LPOM">iOS</a> and <a href=3D"https://github.c=
om/notifications/mobile/android/ABCERSPAA4SIT5LYMMA2RAT5XEWGNA5CNFSNUABEM=
5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMZQGA4DONJXGCTHEZLBONXW5KTTOV=
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/ABCERSIQ6ZQF626DXPT7UJT=
5XEWGNBFCNFSM6AAAAADEDGWRJ6WGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3J=
MTHQAAAAAFYAD4OBUZZGKYLTN5XKU43VMJZWG4TJMJSWI.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>&lt;barn=
owl/barnowl/pull/199</span><span>@</span><span>github</span><span>.</span=
><span>com&gt;</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/199?email_source=3Dnot=
ifications\u0026email_token=3DABCERSNPHPGCXKA2RO5XJ735XEWGNA5CNFSNUABEM5U=
WIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMZQGA4DONJXGCTHEZLBONXW5KTTOVRH=
GY3SNFRGKZFFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ",
"url": "https://github.com/barnowl/barnowl/pull/199?email_source=3Dnotifi=
cations\u0026email_token=3DABCERSNPHPGCXKA2RO5XJ735XEWGNA5CNFSNUABEM5UWIO=
RPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMZQGA4DONJXGCTHEZLBONXW5KTTOVRHGY3=
SNFRGKZFFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>

----==_mimepart_6ae934e69ef60_10d12d0136641--

home help back first fref pref prev next nref lref last post