[Tcsh] Multi-byte characters in promptchars

Kimmo Suominen kim at netbsd.org
Fri Apr 5 09:47:05 UTC 2024


On Fri, Apr 05, 2024 at 10:37:04AM +0200, H.Merijn Brand wrote:
> On Fri, 5 Apr 2024 10:20:36 +0300, Kimmo Suominen <kim at netbsd.org> wrote:
> > I'm pleased to announce that tcsh-6.24.12 is available.
> 
> I am a tiny bit disappointed in that the cursor positioning in
> line-edit with multi-byte characters in prompt did not get any
> attention.

I don't think voicing disappointment on volunteers not spending even
more time on a project is appropriate.  Please be considerate.

> specifically
> https://github.com/Tux/tcsh/commit/28b81e179410368bcf77b30c631cf5684b3b5fae

I think this part of the commit is your proposed fix:

diff --git a/ed.refresh.c b/ed.refresh.c
index f1913801..bc902f5e 100644
--- a/ed.refresh.c
+++ b/ed.refresh.c
@@ -1155,6 +1160,8 @@ CalcPosition(int w, int th, int *h, int *v)
 	    *h += 4;
 	    break;
 	case NLSCLASS_ILLEGAL2:
+	    *h += NLSCLASS_ILLEGAL_SIZE(w);
+	    break;
 	case NLSCLASS_ILLEGAL3:
 	case NLSCLASS_ILLEGAL4:
 	case NLSCLASS_ILLEGAL5:

Why does it only apply to NLSCLASS_ILLEGAL2?

Your commit message only states that the commit fixed the problem, but
does not explain at all why it fixed it.  Did you run the test suite?
Did any tests fail unexpectedly?

As I pointed out back in July last year, I'm not familiar enough with
the internals of UTF-8 to understand the change or its correctness.  The
email thread stops at my message, with no response from you or anyone
else.

If you have time to provide some additional insight into the fix, I'd
be happy to get it committed.  However, as a principle, I do not commit
code that I do not understand.

Kind regards,
+ Kimmo

References:
- https://github.com/Tux/tcsh/commit/8d5633577a2bbcd8cb259cd169de9cd1b2f0c8bb.patch
- https://github.com/tcsh-org/tcsh/issues/78


More information about the Tcsh mailing list