Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] prompt: support generic non-visible regions



readline assumes anything between \001 (start of header) and \002 (start
of text) is non-visible characters.

In zsh we do this with `%F{color}`, but we could support
`\001\e[31m\002` as well.

Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---

I don't know if this is the right way to do it, but in my limited
testing it seems to work fine.

 Src/prompt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Src/prompt.c b/Src/prompt.c
index 092de63a4..803937029 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -886,6 +886,12 @@ putpromptchar(int doprint, int endchar, zattr *txtchangep)
 		    bv->bp += strlen(bv->bp);
 		}
 	    }
+	} else if(*bv->fm == 0x01) { // start non-visible characters
+	    addbufspc(1);
+	    *bv->bp++ = Inpar;
+	} else if(*bv->fm == 0x02) { // end non-visible characters
+	    addbufspc(1);
+	    *bv->bp++ = Outpar;
 	} else {
 	    char c = *bv->fm == Meta ? *++bv->fm ^ 32 : *bv->fm;
 
-- 
2.37.1





Messages sorted by: Reverse Date, Date, Thread, Author