Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] prompt: support generic non-visible regions
- X-seq: zsh-workers 50449
- From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Cc: Oliver Kiddle <opk@xxxxxxx>, dana <dana@xxxxxxx>, Felipe Contreras <felipe.contreras@xxxxxxxxx>
- Subject: [PATCH] prompt: support generic non-visible regions
- Date: Wed, 10 Aug 2022 06:51:20 -0500
- Archived-at: <https://zsh.org/workers/50449>
- List-id: <zsh-workers.zsh.org>
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