mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-13 05:33:51 -04:00
grid: resize with reflow: reflow FTCS_COMMAND_{EXECUTED,FINISHED}
This commit is contained in:
parent
110a6dd6f0
commit
231e6eb3f1
1 changed files with 29 additions and 27 deletions
56
grid.c
56
grid.c
|
|
@ -1,5 +1,6 @@
|
||||||
#include "grid.h"
|
#include "grid.h"
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
@ -837,35 +838,26 @@ grid_resize_and_reflow(
|
||||||
int end;
|
int end;
|
||||||
bool tp_break = false;
|
bool tp_break = false;
|
||||||
bool uri_break = false;
|
bool uri_break = false;
|
||||||
|
bool ftcs_break = false;
|
||||||
|
|
||||||
/*
|
/* Figure out where to end this chunk */
|
||||||
* Set end-coordinate for this chunk, by finding the next
|
{
|
||||||
* point-of-interest on this row.
|
const int uri_col = range != range_terminator
|
||||||
*
|
? ((range->start >= start ? range->start : range->end) + 1)
|
||||||
* If there are no more tracking points, or URI ranges,
|
: INT_MAX;
|
||||||
* the end-coordinate will be at the end of the row,
|
const int tp_col = tp != NULL ? tp->col + 1 : INT_MAX;
|
||||||
*/
|
const int ftcs_col = old_row->shell_integration.cmd_start >= start
|
||||||
if (range != range_terminator) {
|
? old_row->shell_integration.cmd_start + 1
|
||||||
int uri_col = (range->start >= start ? range->start : range->end) + 1;
|
: old_row->shell_integration.cmd_end >= start
|
||||||
|
? old_row->shell_integration.cmd_end + 1
|
||||||
|
: INT_MAX;
|
||||||
|
|
||||||
if (tp != NULL) {
|
end = min(col_count, min(min(tp_col, uri_col), ftcs_col));
|
||||||
int tp_col = tp->col + 1;
|
|
||||||
end = min(tp_col, uri_col);
|
|
||||||
|
|
||||||
tp_break = end == tp_col;
|
uri_break = end == uri_col;
|
||||||
uri_break = end == uri_col;
|
tp_break = end == tp_col;
|
||||||
LOG_DBG("tp+uri break at %d (%d, %d)", end, tp_col, uri_col);
|
ftcs_break = end == ftcs_col;
|
||||||
} else {
|
}
|
||||||
end = uri_col;
|
|
||||||
uri_break = true;
|
|
||||||
LOG_DBG("uri break at %d", end);
|
|
||||||
}
|
|
||||||
} else if (tp != NULL) {
|
|
||||||
end = tp->col + 1;
|
|
||||||
tp_break = true;
|
|
||||||
LOG_DBG("TP break at %d", end);
|
|
||||||
} else
|
|
||||||
end = col_count;
|
|
||||||
|
|
||||||
int cols = end - start;
|
int cols = end - start;
|
||||||
xassert(cols > 0);
|
xassert(cols > 0);
|
||||||
|
|
@ -926,7 +918,7 @@ grid_resize_and_reflow(
|
||||||
xassert(from + amount <= old_cols);
|
xassert(from + amount <= old_cols);
|
||||||
|
|
||||||
if (from == 0)
|
if (from == 0)
|
||||||
new_row->shell_integration = old_row->shell_integration;
|
new_row->shell_integration.prompt_marker = old_row->shell_integration.prompt_marker;
|
||||||
|
|
||||||
memcpy(
|
memcpy(
|
||||||
&new_row->cells[new_col_idx], &old_row->cells[from],
|
&new_row->cells[new_col_idx], &old_row->cells[from],
|
||||||
|
|
@ -985,6 +977,16 @@ grid_resize_and_reflow(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ftcs_break) {
|
||||||
|
xassert(old_row->shell_integration.cmd_start == start + cols - 1 ||
|
||||||
|
old_row->shell_integration.cmd_end == start + cols - 1);
|
||||||
|
|
||||||
|
if (old_row->shell_integration.cmd_start == start + cols - 1)
|
||||||
|
new_row->shell_integration.cmd_start = new_col_idx - 1;
|
||||||
|
if (old_row->shell_integration.cmd_end == start + cols - 1)
|
||||||
|
new_row->shell_integration.cmd_end = new_col_idx - 1;
|
||||||
|
}
|
||||||
|
|
||||||
left -= cols;
|
left -= cols;
|
||||||
start += cols;
|
start += cols;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue