Browse Source

Add PSlit for prompt escapes

catsh-wat
Causal Agent 5 months ago
parent
commit
037d883e56
Signed by: Curtis McEnroe <june@causal.agency> GPG Key ID: CEA2F97ADCFCD77C
3 changed files with 12 additions and 0 deletions
  1. 8
    0
      bin/cash/histedit.c
  2. 1
    0
      bin/cash/myhistedit.h
  3. 3
    0
      bin/cash/var.c

+ 8
- 0
bin/cash/histedit.c View File

@@ -176,6 +176,14 @@ sethistsize(const char *hs)
176 176
 	}
177 177
 }
178 178
 
179
+void
180
+setpslit(const char *lit) {
181
+	if (el != NULL && *lit < 0x20) {
182
+		el_set(el, EL_PROMPT_ESC, getprompt, *lit);
183
+		el_set(el, EL_RPROMPT_ESC, getrprompt, *lit);
184
+	}
185
+}
186
+
179 187
 void
180 188
 setterm(const char *term)
181 189
 {

+ 1
- 0
bin/cash/myhistedit.h View File

@@ -40,5 +40,6 @@ extern int displayhist;
40 40
 
41 41
 void histedit(void);
42 42
 void sethistsize(const char *);
43
+void setpslit(const char *);
43 44
 void setterm(const char *);
44 45
 

+ 3
- 0
bin/cash/var.c View File

@@ -86,6 +86,7 @@ struct varinit {
86 86
 
87 87
 #ifndef NO_HISTORY
88 88
 struct var vhistsize;
89
+struct var vpslit;
89 90
 struct var vterm;
90 91
 #endif
91 92
 struct var venv;
@@ -130,6 +131,8 @@ static const struct varinit varinit[] = {
130 131
 	{ &vrps2,	VUNSET,				"RPS2=",
131 132
 	  NULL },
132 133
 #ifndef NO_HISTORY
134
+	{ &vpslit,	VUNSET,				"PSlit=",
135
+	  setpslit },
133 136
 	{ &vterm,	VUNSET,				"TERM=",
134 137
 	  setterm },
135 138
 #endif

Loading…
Cancel
Save