Plan 9 from Bell Labs’s /usr/web/sources/contrib/mospak/abaco-modern/abaco-doubleclick-typo.patch

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


abaco: fix textdoubleclick bracket/quote matching typo

Addresses the NOTES entry "fix text selection and double clicking".

text.c:727 passes t->rs.r[p-l] as the matching character to
textclickmatch, but it should pass r[p-l].  r is the local pointer
to the corresponding entry in the right-bracket table (right[i]);
t->rs.r is the text buffer of the Page.  The paired call at text.c:738
uses l[p-r] correctly.  Acme's text.c:1312 uses r[p-l] (no typo);
abaco's code was adapted from acme and acquired the typo somewhere
along the way.

Effect: when the user double-clicks immediately after an opening
bracket `(`, `{`, `[`, `<`, or before a closing quote `'`, `"`, `` ` ``,
textclickmatch is invoked with a nonsense "match" character lifted
from the text at offset p-l.  It either finds that character
immediately (giving a zero-width selection) or never finds it
(giving no expansion).  Users observe "double-click doesn't select
the quoted/bracketed region" for most of these cases.

Minimal fix: one character changed.  No behaviour change for any
non-bracket/quote input.

RFC relevance: none

--- sys/src/cmd/abaco/text.c
+++ sys/src/cmd/abaco/text.c
@@ -724,7 +724,7 @@
 			c = t->rs.r[q-1];
 		p = runestrchr(l, c);
 		if(p != nil){
-			if(textclickmatch(t, c, t->rs.r[p-l], 1, &q))
+			if(textclickmatch(t, c, r[p-l], 1, &q))
 				*q1 = q-(c!='\n');
 			return;
 		}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.