[Tcsh] prompt: dim and promptchars

H.Merijn Brand tcsh at tux.freedom.nl
Fri Jul 28 09:20:28 UTC 2023


On Thu, 27 Jul 2023 10:20:15 +0200, "H.Merijn Brand" <tcsh at tux.freedom.nl> wrote:

> On Thu, 27 Jul 2023 09:52:02 +0200, "H.Merijn Brand" <tcsh at tux.freedom.nl> wrote:

Fix for wrong position with in-line editing when prompt has multibyte characters:
--8<---
diff --git a/ed.refresh.c b/ed.refresh.c
index 183050e0..8b22a128 100644
--- a/ed.refresh.c
+++ b/ed.refresh.c
@@ -1155,6 +1155,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:
-->8---

Full patch with debugging options here:
https://github.com/tcsh-org/tcsh/issues/78

> > FWIW I also wanted to control %# using promptchars
> > 
> >  if ($USER == "tux") then
> >    set promptchars="\U1F427#"

I did not look into this yet

> >  else
> >    set promptchars=">#"
> >    endif
> > 
> > but doing so does not show �� but a literal '\'
> > using \U1F427 in prompt *does* work. Is that a bug in promptchars?  
> 
> More fun. Using the real UTF-8 in there does work
> 
> % set prompt="%# "
> % set promptchars="��䷡"
> ��
> 
> Ohhhh, beautiful :)
> 
> now make a typo in a command
> 
> �� grex foo bar
> Correct > gex foo bar [y|n|E|a]? edit
> 
> look at the cursor position. now use any edit keys like home right
> arrow or left arrow and look where the cursor is now displayed
> 
> conclusion: multibyte characters in the promptchars are not really
> usable right now

That all works as expected now

-- 
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/20230728/4c98bb3d/attachment.asc>


More information about the Tcsh mailing list