aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-12-08 09:46:46 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-02-06 11:12:57 +0000
commite9607de5ae2eaf1a57924bb282a660150eca6eb5 (patch)
tree2fa60f5956c92d2a6442ce6386bd62a28c660b66
parentterm: move row->prompt_marker into new struct, row->shell_integration (diff)
osc: store column of FTCS_COMMAND_{EXECUTED,FINISHED} in row struct
-rw-r--r--grid.c4
-rw-r--r--osc.c10
-rw-r--r--terminal.c2
-rw-r--r--terminal.h2
4 files changed, 16 insertions, 2 deletions
diff --git a/grid.c b/grid.c
index 19322cbf..f14580ad 100644
--- a/grid.c
+++ b/grid.c
@@ -367,6 +367,8 @@ grid_row_alloc(int cols, bool initialize)
row->linebreak = false;
row->extra = NULL;
row->shell_integration.prompt_marker = false;
+ row->shell_integration.cmd_start = -1;
+ row->shell_integration.cmd_end = -1;
if (initialize) {
row->cells = xcalloc(cols, sizeof(row->cells[0]));
@@ -588,6 +590,8 @@ _line_wrap(struct grid *old_grid, struct row **new_grid, struct row *row,
grid_row_reset_extra(new_row);
new_row->linebreak = false;
new_row->shell_integration.prompt_marker = false;
+ new_row->shell_integration.cmd_start = -1;
+ new_row->shell_integration.cmd_end = -1;
tll_foreach(old_grid->sixel_images, it) {
if (it->item.pos.row == *row_idx) {
diff --git a/osc.c b/osc.c
index a54946ff..5da8666f 100644
--- a/osc.c
+++ b/osc.c
@@ -901,11 +901,17 @@ osc_dispatch(struct terminal *term)
break;
case 'C':
- LOG_DBG("FTCS_COMMAND_EXECUTED");
+ LOG_DBG("FTCS_COMMAND_EXECUTED: %dx%d",
+ term->grid->cursor.point.row,
+ term->grid->cursor.point.col);
+ term->grid->cur_row->shell_integration.cmd_start = term->grid->cursor.point.col;
break;
case 'D':
- LOG_DBG("FTCS_COMMAND_FINISHED");
+ LOG_DBG("FTCS_COMMAND_FINISHED: %dx%d",
+ term->grid->cursor.point.row,
+ term->grid->cursor.point.col);
+ term->grid->cur_row->shell_integration.cmd_end = term->grid->cursor.point.col;
break;
}
break;
diff --git a/terminal.c b/terminal.c
index 33666e6a..4152724a 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1826,6 +1826,8 @@ erase_line(struct terminal *term, struct row *row)
erase_cell_range(term, row, 0, term->cols - 1);
row->linebreak = false;
row->shell_integration.prompt_marker = false;
+ row->shell_integration.cmd_start = -1;
+ row->shell_integration.cmd_end = -1;
}
void
diff --git a/terminal.h b/terminal.h
index 76b52566..1e3a724e 100644
--- a/terminal.h
+++ b/terminal.h
@@ -123,6 +123,8 @@ struct row {
struct {
bool prompt_marker;
+ int cmd_start; /* Column, -1 if unset */
+ int cmd_end; /* Column, -1 if unset */
} shell_integration;
};