summaryrefslogtreecommitdiffstats
path: root/input.c
diff options
context:
space:
mode:
authornicm <nicm>2023-07-03 16:47:43 +0000
committernicm <nicm>2023-07-03 16:47:43 +0000
commit43b841f188c994966e00e59c96581b876652bef1 (patch)
treeb38a012757e13b46d601bf4ff8f266333d60d325 /input.c
parentac43186dff0f4e92a566987bb9108d6c5421e9ff (diff)
Add support for marking lines with a shell prompt based on the OSC 133
extension, from Munif Tanjim in GitHub issue 3596.
Diffstat (limited to 'input.c')
-rw-r--r--input.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/input.c b/input.c
index dd22ac75..ee31b7e1 100644
--- a/input.c
+++ b/input.c
@@ -144,6 +144,7 @@ static void input_osc_104(struct input_ctx *, const char *);
static void input_osc_110(struct input_ctx *, const char *);
static void input_osc_111(struct input_ctx *, const char *);
static void input_osc_112(struct input_ctx *, const char *);
+static void input_osc_133(struct input_ctx *, const char *);
/* Transition entry/exit handlers. */
static void input_clear(struct input_ctx *);
@@ -2347,6 +2348,9 @@ input_exit_osc(struct input_ctx *ictx)
case 112:
input_osc_112(ictx, p);
break;
+ case 133:
+ input_osc_133(ictx, p);
+ break;
default:
log_debug("%s: unknown '%u'", __func__, option);
break;
@@ -2736,6 +2740,24 @@ input_osc_112(struct input_ctx *ictx, const char *p)
screen_set_cursor_colour(ictx->ctx.s, -1);
}
+/* Handle the OSC 133 sequence. */
+static void
+input_osc_133(struct input_ctx *ictx, const char *p)
+{
+ struct grid *gd = ictx->ctx.s->grid;
+ u_int line = ictx->ctx.s->cy + gd->hsize;
+ struct grid_line *gl;
+
+ if (line > gd->hsize + gd->sy - 1)
+ return;
+ gl = grid_get_line(gd, line);
+
+ switch (*p) {
+ case 'A':
+ gl->flags |= GRID_LINE_START_PROMPT;
+ break;
+ }
+}
/* Handle the OSC 52 sequence for setting the clipboard. */
static void