Re: SCI_GETCOLUMN/SCI_FINDCOLUMN does not take character representations into account

"'Robin Haberkorn' via scintilla-interest" <[email protected]> Tue, 10 Mar 2026 21:59:41 +0000
Newsgroups gmane.comp.lib.scintilla.devel
Message-ID <[email protected]>
--5d93a4a792a4d7e5758598d83bc3a482670a6b0f95e24ad872340f078966
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="UTF-8"

On Tue Mar 10, 2026 at 22:02:14 GMT +01, Neil Hodgson wrote:
> Yes. One of the roles of these APIs is to operate with other pieces of
> software that use column numbers. Some tools, for example, report
> warning locations in terms of line and column. These APIs allow
> automatically selecting the warning location or displaying a column
> number UI element that will match the diagnostics.
>

I would suspect that most tools will count only characters if not bytes
since a) they don't know the tab size and b) they don't always know the doc=
ument's
encoding.

But apparently, there is a lot of variation out there.
GCC expands tabs and counts Unicode glyphs:

hello.c: In function 'main':
hello.c:5:10: error: expected expression before ';' token
    5 |         +;
      |          ^

hello.c: In function 'main':
hello.c:5:15: error: expected expression before ';' token
    5 |         /*=C3=96*/+;
      |               ^

This would be compatible with SCI_FINDCOLUMN.
Clang apparently counts plain bytes:

hello.c:5:3: error: expected expression
    5 |         +;
      |          ^

hello.c:5:9: error: expected expression
    5 |         /*=C3=96*/+;
      |               ^

Anyway, I will just write my own versions of SCI_GETCOLUMN/SCI_FINDCOLUMN
then.

Regards,
Robin

--=20
You received this message because you are subscribed to the Google Groups "=
scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/scintilla-i=
nterest/DGZFUE02LKFT.1PMKXTP731TB4%40googlemail.com.

--5d93a4a792a4d7e5758598d83bc3a482670a6b0f95e24ad872340f078966
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEB/6AD3js1eGB4raKarMDYY4q6voFAmmwlE4ACgkQarMDYY4q
6vpjeAf+Ls+LqTSVPFYSexTaSvlUMS7lN2h2m9vje5BrTHjQLVP8l4LfukpOZMOG
z1UuJrXG2wVNkLfFJmaK396pQF5xd7sebATcT3L7HTiQXDTb64zlStAL855xj7Vp
kB942oPLmXqBIhzIgFoelVkhJXUOwPWDmC17+YLtCKvSIKJZvJ/9Ze2zeUk7Jy7N
hz5OumImai11tnsBk7eYQS7gi3+vDrAeGecZ+SZLtuj2/CT5UfB7NL+a2Pz1k9PN
34kXHF7qPIyV7HYL8pccBjs4NXsvg41rScSOLCTx7al2a6fKEki28LFhwODH8wW7
7YEXSsae0MzXISqujozC8UADx1hEEg==
=kNf9
-----END PGP SIGNATURE-----

--5d93a4a792a4d7e5758598d83bc3a482670a6b0f95e24ad872340f078966--