mirror of
https://github.com/tmux/tmux.git
synced 2026-10-12 05:34:24 +00:00
Cleanup.
This commit is contained in:
57
input.c
57
input.c
@@ -3203,32 +3203,29 @@ input_osc_133_save_marker(struct window_pane *wp, struct screen *s)
|
|||||||
struct osc133_marker ctx = {0};
|
struct osc133_marker ctx = {0};
|
||||||
u_int y;
|
u_int y;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp == NULL || s != &wp->base || SCREEN_IS_ALTERNATE(s) ||
|
||||||
return (ctx);
|
(~wp->flags & PANE_CMDRUNNING)) {
|
||||||
if (s != &wp->base)
|
|
||||||
return (ctx);
|
|
||||||
if (SCREEN_IS_ALTERNATE(s))
|
|
||||||
return (ctx);
|
|
||||||
if (~wp->flags & PANE_CMDRUNNING)
|
|
||||||
return (ctx);
|
return (ctx);
|
||||||
|
}
|
||||||
ctx.running = 1;
|
ctx.running = 1;
|
||||||
ctx.start = UINT_MAX;
|
ctx.start = UINT_MAX;
|
||||||
ctx.collected = gd->scroll_collected;
|
ctx.collected = gd->scroll_collected;
|
||||||
for (y = gd->hsize + gd->sy; y > 0; y--) {
|
for (y = gd->hsize + gd->sy; y > 0; y--) {
|
||||||
gl = grid_get_line(gd, y - 1);
|
gl = grid_get_line(gd, y - 1);
|
||||||
if (~gl->flags & GRID_LINE_START_OUTPUT) {
|
if ((~gl->flags & GRID_LINE_START_OUTPUT) &&
|
||||||
if (gl->flags &
|
(gl->flags & (GRID_LINE_START_PROMPT|
|
||||||
(GRID_LINE_START_PROMPT|GRID_LINE_END_OUTPUT))
|
GRID_LINE_END_OUTPUT))) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
if (~gl->flags & GRID_LINE_START_OUTPUT)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
od = &gl->osc133_data;
|
od = &gl->osc133_data;
|
||||||
if (gl->flags & GRID_LINE_END_OUTPUT) {
|
if ((gl->flags & GRID_LINE_END_OUTPUT) &&
|
||||||
if (od->out_end_col >= od->out_start_col)
|
od->out_end_col >= od->out_start_col) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (gl->flags & GRID_LINE_START_PROMPT) {
|
if ((gl->flags & GRID_LINE_START_PROMPT) &&
|
||||||
if (od->prompt_col > od->out_start_col)
|
od->prompt_col > od->out_start_col) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ctx.start = y - 1;
|
ctx.start = y - 1;
|
||||||
@@ -3250,15 +3247,13 @@ input_osc_133_restore_marker(struct screen *s,
|
|||||||
if (!ctx->running)
|
if (!ctx->running)
|
||||||
return;
|
return;
|
||||||
collected = gd->scroll_collected - ctx->collected;
|
collected = gd->scroll_collected - ctx->collected;
|
||||||
if (ctx->start != UINT_MAX) {
|
if (ctx->start != UINT_MAX && ctx->start >= collected) {
|
||||||
if (ctx->start >= collected) {
|
|
||||||
gl = grid_get_line(gd, ctx->start - collected);
|
gl = grid_get_line(gd, ctx->start - collected);
|
||||||
if (gl->flags & GRID_LINE_START_OUTPUT) {
|
if ((gl->flags & GRID_LINE_START_OUTPUT) &&
|
||||||
if (gl->osc133_data.out_start_col == ctx->col)
|
gl->osc133_data.out_start_col == ctx->col) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
gl = grid_get_line(gd, gd->hsize);
|
gl = grid_get_line(gd, gd->hsize);
|
||||||
gl->flags |= GRID_LINE_START_OUTPUT;
|
gl->flags |= GRID_LINE_START_OUTPUT;
|
||||||
gl->osc133_data.out_start_col = 0;
|
gl->osc133_data.out_start_col = 0;
|
||||||
@@ -3342,13 +3337,9 @@ input_osc_133_secondary_prompt(const char *p)
|
|||||||
|
|
||||||
while ((cp = strstr(p, ";k=")) != NULL) {
|
while ((cp = strstr(p, ";k=")) != NULL) {
|
||||||
p = cp + 3;
|
p = cp + 3;
|
||||||
if (*p != 's') {
|
if (*p != 's' && *p != 'c')
|
||||||
if (*p != 'c')
|
|
||||||
continue;
|
continue;
|
||||||
}
|
if (p[1] == '\0' || p[1] == ';')
|
||||||
if (p[1] == '\0')
|
|
||||||
return (1);
|
|
||||||
if (p[1] == ';')
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
@@ -3358,10 +3349,10 @@ input_osc_133_secondary_prompt(const char *p)
|
|||||||
static void
|
static void
|
||||||
input_osc_133_mark_prompt(struct grid_line *gl, u_int col, const char *p)
|
input_osc_133_mark_prompt(struct grid_line *gl, u_int col, const char *p)
|
||||||
{
|
{
|
||||||
if (gl == NULL)
|
if (gl == NULL ||
|
||||||
return;
|
(gl->flags & (GRID_LINE_START_PROMPT|GRID_LINE_SECOND_PROMPT))) {
|
||||||
if (gl->flags & (GRID_LINE_START_PROMPT|GRID_LINE_SECOND_PROMPT))
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
gl->osc133_data.prompt_col = col;
|
gl->osc133_data.prompt_col = col;
|
||||||
if (input_osc_133_secondary_prompt(p))
|
if (input_osc_133_secondary_prompt(p))
|
||||||
gl->flags |= GRID_LINE_SECOND_PROMPT;
|
gl->flags |= GRID_LINE_SECOND_PROMPT;
|
||||||
@@ -3397,20 +3388,16 @@ input_osc_133(struct input_ctx *ictx, const char *p)
|
|||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
case 'I':
|
case 'I':
|
||||||
if (gl != NULL) {
|
if (gl != NULL && (~gl->flags & GRID_LINE_START_COMMAND)) {
|
||||||
if (~gl->flags & GRID_LINE_START_COMMAND) {
|
|
||||||
gl->flags |= GRID_LINE_START_COMMAND;
|
gl->flags |= GRID_LINE_START_COMMAND;
|
||||||
gl->osc133_data.cmd_col = s->cx;
|
gl->osc133_data.cmd_col = s->cx;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
if (gl != NULL) {
|
if (gl != NULL && (~gl->flags & GRID_LINE_START_OUTPUT)) {
|
||||||
if (~gl->flags & GRID_LINE_START_OUTPUT) {
|
|
||||||
gl->flags |= GRID_LINE_START_OUTPUT;
|
gl->flags |= GRID_LINE_START_OUTPUT;
|
||||||
gl->osc133_data.out_start_col = s->cx;
|
gl->osc133_data.out_start_col = s->cx;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (wp != NULL) {
|
if (wp != NULL) {
|
||||||
wp->cmd_start_time = time(NULL);
|
wp->cmd_start_time = time(NULL);
|
||||||
wp->cmd_end_time = 0;
|
wp->cmd_end_time = 0;
|
||||||
|
|||||||
@@ -2084,10 +2084,8 @@ screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
/* Erasing to the end clears the whole screen at 0,0. */
|
/* Erasing to the end clears the whole screen at 0,0. */
|
||||||
if (s->cx == 0) {
|
if (s->cx == 0 && s->cy == 0)
|
||||||
if (s->cy == 0)
|
|
||||||
osc133 = input_osc_133_save_marker(ctx->owner, s);
|
osc133 = input_osc_133_save_marker(ctx->owner, s);
|
||||||
}
|
|
||||||
|
|
||||||
/* Scroll into history if it is enabled and clearing entire screen. */
|
/* Scroll into history if it is enabled and clearing entire screen. */
|
||||||
if (s->cx == 0 &&
|
if (s->cx == 0 &&
|
||||||
|
|||||||
554
window-copy.c
554
window-copy.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user