[Tcsh] Multi-byte characters in promptchars

H.Merijn Brand tcsh at tux.freedom.nl
Fri Apr 5 10:08:59 UTC 2024


On Fri, 5 Apr 2024 12:47:05 +0300, Kimmo Suominen <kim at netbsd.org> wrote:

> 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.

That was not the tone I intended. I'm a volunteer myself and I did not
see it as a complaint. Sorry if that was not clear!

> > 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?

Because that was the smallest change required to make "it work", and I
do not understand the underlying internals, so keeping the scope as
small as possible was a way to do it the safest way possible.

> 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?

It doesn't explain it because I do not understand it at all. It was a
byte hunt with print statements in the code to find the spot where tcsh
did misbehave (in my opinion) and by adding this code, all works as
expected.

> 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.

The problem appears to be the missing "anyone else" then  :)

This implies that I will just apply that change to my local clone until
someone steps up who *does* understand the UTF-8 internals and proposes
a more generic fix with explanation.

> 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.

Which is a sane approach

This makes me re-state the initial mail:
I am a tiny bit disappointed that noone else stood up who understands
UTF-8 internals and could comment on the validity of the proposed patch.

Well, it is what it is. Thanks for this wonderful shell!

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

-- 
H.Merijn Brand  https://tux.nl   Perl Monger   http://amsterdam.pm.org/
using perl5.00307 .. 5.37        porting perl5 on HP-UX, AIX, and Linux
https://tux.nl/email.html http://qa.perl.org https://www.test-smoke.org
                           
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://mailman.astron.com/pipermail/tcsh/attachments/20240405/adf5b583/attachment.asc>


More information about the Tcsh mailing list