mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 17:39:09 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
976cf6c60f
7
grid.c
7
grid.c
@ -649,6 +649,8 @@ grid_clear_lines(struct grid *gd, u_int py, u_int ny, u_int bg)
|
|||||||
grid_free_line(gd, yy);
|
grid_free_line(gd, yy);
|
||||||
grid_empty_line(gd, yy, bg);
|
grid_empty_line(gd, yy, bg);
|
||||||
}
|
}
|
||||||
|
if (py != 0)
|
||||||
|
gd->linedata[py - 1].flags &= ~GRID_LINE_WRAPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move a group of lines. */
|
/* Move a group of lines. */
|
||||||
@ -675,6 +677,8 @@ grid_move_lines(struct grid *gd, u_int dy, u_int py, u_int ny, u_int bg)
|
|||||||
continue;
|
continue;
|
||||||
grid_free_line(gd, yy);
|
grid_free_line(gd, yy);
|
||||||
}
|
}
|
||||||
|
if (dy != 0)
|
||||||
|
gd->linedata[dy - 1].flags &= ~GRID_LINE_WRAPPED;
|
||||||
|
|
||||||
memmove(&gd->linedata[dy], &gd->linedata[py],
|
memmove(&gd->linedata[dy], &gd->linedata[py],
|
||||||
ny * (sizeof *gd->linedata));
|
ny * (sizeof *gd->linedata));
|
||||||
@ -687,8 +691,11 @@ grid_move_lines(struct grid *gd, u_int dy, u_int py, u_int ny, u_int bg)
|
|||||||
if (yy < dy || yy >= dy + ny)
|
if (yy < dy || yy >= dy + ny)
|
||||||
grid_empty_line(gd, yy, bg);
|
grid_empty_line(gd, yy, bg);
|
||||||
}
|
}
|
||||||
|
if (py != 0 && (py < dy || py >= dy + ny))
|
||||||
|
gd->linedata[py - 1].flags &= ~GRID_LINE_WRAPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Move a group of cells. */
|
/* Move a group of cells. */
|
||||||
void
|
void
|
||||||
grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx,
|
grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx,
|
||||||
|
@ -2978,6 +2978,21 @@ window_copy_visible_lines(struct window_copy_mode_data *data, u_int *start,
|
|||||||
*end = gd->hsize - data->oy + gd->sy;
|
*end = gd->hsize - data->oy + gd->sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
window_copy_search_mark_at(struct window_copy_mode_data *data, u_int px, u_int py,
|
||||||
|
u_int *at)
|
||||||
|
{
|
||||||
|
struct screen *s = data->backing;
|
||||||
|
struct grid *gd = s->grid;
|
||||||
|
|
||||||
|
if (py < gd->hsize - data->oy)
|
||||||
|
return (-1);
|
||||||
|
if (py > gd->hsize - data->oy + gd->sy - 1)
|
||||||
|
return (-1);
|
||||||
|
*at = ((py - (gd->hsize - data->oy)) * gd->sx) + px;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
window_copy_search_marks(struct window_mode_entry *wme, struct screen *ssp,
|
window_copy_search_marks(struct window_mode_entry *wme, struct screen *ssp,
|
||||||
int regex, int visible_only)
|
int regex, int visible_only)
|
||||||
@ -3031,7 +3046,7 @@ window_copy_search_marks(struct window_mode_entry *wme, struct screen *ssp,
|
|||||||
|
|
||||||
again:
|
again:
|
||||||
free(data->searchmark);
|
free(data->searchmark);
|
||||||
data->searchmark = xcalloc(gd->hsize + gd->sy, gd->sx);
|
data->searchmark = xcalloc(gd->sx, gd->sy);
|
||||||
data->searchgen = 1;
|
data->searchgen = 1;
|
||||||
|
|
||||||
for (py = start; py < end; py++) {
|
for (py = start; py < end; py++) {
|
||||||
@ -3054,13 +3069,16 @@ again:
|
|||||||
py == gd->hsize + data->cy - data->oy)
|
py == gd->hsize + data->cy - data->oy)
|
||||||
which = nfound;
|
which = nfound;
|
||||||
|
|
||||||
b = (py * gd->sx) + px;
|
if (window_copy_search_mark_at(data, px, py, &b) == 0) {
|
||||||
|
if (b + width > gd->sx * gd->sy)
|
||||||
|
width = (gd->sx * gd->sy) - b;
|
||||||
for (i = b; i < b + width; i++)
|
for (i = b; i < b + width; i++)
|
||||||
data->searchmark[i] = data->searchgen;
|
data->searchmark[i] = data->searchgen;
|
||||||
if (data->searchgen == UCHAR_MAX)
|
if (data->searchgen == UCHAR_MAX)
|
||||||
data->searchgen = 1;
|
data->searchgen = 1;
|
||||||
else
|
else
|
||||||
data->searchgen++;
|
data->searchgen++;
|
||||||
|
}
|
||||||
|
|
||||||
px++;
|
px++;
|
||||||
}
|
}
|
||||||
@ -3163,7 +3181,7 @@ window_copy_match_start_end(struct window_copy_mode_data *data, u_int at,
|
|||||||
u_int *start, u_int *end)
|
u_int *start, u_int *end)
|
||||||
{
|
{
|
||||||
struct grid *gd = data->backing->grid;
|
struct grid *gd = data->backing->grid;
|
||||||
u_int last = (gd->hsize + gd->sy) * gd->sx - 1;
|
u_int last = (gd->sy * gd->sx) - 1;
|
||||||
u_char mark = data->searchmark[at];
|
u_char mark = data->searchmark[at];
|
||||||
|
|
||||||
*start = *end = at;
|
*start = *end = at;
|
||||||
@ -3191,7 +3209,8 @@ window_copy_match_at_cursor(struct window_copy_mode_data *data)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
cy = screen_hsize(data->backing) - data->oy + data->cy;
|
cy = screen_hsize(data->backing) - data->oy + data->cy;
|
||||||
at = (cy * sx) + data->cx;
|
if (window_copy_search_mark_at(data, data->cx, cy, &at) != 0)
|
||||||
|
return (NULL);
|
||||||
if (data->searchmark[at] == 0)
|
if (data->searchmark[at] == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
window_copy_match_start_end(data, at, &start, &end);
|
window_copy_match_start_end(data, at, &start, &end);
|
||||||
@ -3204,7 +3223,7 @@ window_copy_match_at_cursor(struct window_copy_mode_data *data)
|
|||||||
py = at / sx;
|
py = at / sx;
|
||||||
px = at - (py * sx);
|
px = at - (py * sx);
|
||||||
|
|
||||||
grid_get_cell(gd, px, py, &gc);
|
grid_get_cell(gd, px, gd->hsize + py - data->oy, &gc);
|
||||||
buf = xrealloc(buf, len + gc.data.size + 1);
|
buf = xrealloc(buf, len + gc.data.size + 1);
|
||||||
memcpy(buf + len, gc.data.data, gc.data.size);
|
memcpy(buf + len, gc.data.data, gc.data.size);
|
||||||
len += gc.data.size;
|
len += gc.data.size;
|
||||||
@ -3221,7 +3240,6 @@ window_copy_update_style(struct window_mode_entry *wme, u_int fx, u_int fy,
|
|||||||
{
|
{
|
||||||
struct window_copy_mode_data *data = wme->data;
|
struct window_copy_mode_data *data = wme->data;
|
||||||
u_int mark, start, end, cy, cursor, current;
|
u_int mark, start, end, cy, cursor, current;
|
||||||
u_int sx = screen_size_x(data->backing);
|
|
||||||
int inv = 0;
|
int inv = 0;
|
||||||
|
|
||||||
if (data->showmark && fy == data->my) {
|
if (data->showmark && fy == data->my) {
|
||||||
@ -3241,15 +3259,15 @@ window_copy_update_style(struct window_mode_entry *wme, u_int fx, u_int fy,
|
|||||||
if (data->searchmark == NULL)
|
if (data->searchmark == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current = (fy * sx) + fx;
|
if (window_copy_search_mark_at(data, fx, fy, ¤t) != 0)
|
||||||
|
return;
|
||||||
mark = data->searchmark[current];
|
mark = data->searchmark[current];
|
||||||
if (mark == 0)
|
if (mark == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cy = screen_hsize(data->backing) - data->oy + data->cy;
|
cy = screen_hsize(data->backing) - data->oy + data->cy;
|
||||||
cursor = (cy * sx) + data->cx;
|
if (window_copy_search_mark_at(data, data->cx, cy, &cursor) == 0 &&
|
||||||
if (data->searchmark[cursor] == mark) {
|
data->searchmark[cursor] == mark) {
|
||||||
window_copy_match_start_end(data, cursor, &start, &end);
|
window_copy_match_start_end(data, cursor, &start, &end);
|
||||||
if (current >= start && current <= end) {
|
if (current >= start && current <= end) {
|
||||||
gc->attr = cgc->attr;
|
gc->attr = cgc->attr;
|
||||||
|
Loading…
Reference in New Issue
Block a user