version 1.85, 2012/11/27 14:42:56 |
version 1.86, 2013/01/18 02:16:21 |
|
|
struct grid *gd, u_int px, u_int py, struct grid *sgd, u_int spx) |
struct grid *gd, u_int px, u_int py, struct grid *sgd, u_int spx) |
{ |
{ |
const struct grid_cell *gc, *sgc; |
const struct grid_cell *gc, *sgc; |
const struct grid_utf8 *gu, *sgu; |
struct utf8_data ud, sud; |
|
|
gc = grid_peek_cell(gd, px, py); |
gc = grid_peek_cell(gd, px, py); |
|
grid_cell_get(gc, &ud); |
sgc = grid_peek_cell(sgd, spx, 0); |
sgc = grid_peek_cell(sgd, spx, 0); |
|
grid_cell_get(sgc, &sud); |
|
|
if ((gc->flags & GRID_FLAG_UTF8) != (sgc->flags & GRID_FLAG_UTF8)) |
if (ud.size != sud.size || ud.width != sud.width) |
return (0); |
return (0); |
|
return (memcmp(ud.data, sud.data, ud.size) == 0); |
if (gc->flags & GRID_FLAG_UTF8) { |
|
gu = grid_peek_utf8(gd, px, py); |
|
sgu = grid_peek_utf8(sgd, spx, 0); |
|
if (grid_utf8_compare(gu, sgu)) |
|
return (1); |
|
} else { |
|
if (gc->data == sgc->data) |
|
return (1); |
|
} |
|
return (0); |
|
} |
} |
|
|
int |
int |
|
|
struct window_copy_mode_data *data = wp->modedata; |
struct window_copy_mode_data *data = wp->modedata; |
struct grid *gd = data->backing->grid; |
struct grid *gd = data->backing->grid; |
const struct grid_cell *gc; |
const struct grid_cell *gc; |
const struct grid_utf8 *gu; |
|
struct grid_line *gl; |
struct grid_line *gl; |
|
struct utf8_data ud; |
u_int i, xx, wrapped = 0; |
u_int i, xx, wrapped = 0; |
size_t size; |
|
|
|
if (sx > ex) |
if (sx > ex) |
return; |
return; |
|
|
gc = grid_peek_cell(gd, i, sy); |
gc = grid_peek_cell(gd, i, sy); |
if (gc->flags & GRID_FLAG_PADDING) |
if (gc->flags & GRID_FLAG_PADDING) |
continue; |
continue; |
if (!(gc->flags & GRID_FLAG_UTF8)) { |
grid_cell_get(gc, &ud); |
*buf = xrealloc(*buf, 1, (*off) + 1); |
|
(*buf)[(*off)++] = gc->data; |
*buf = xrealloc(*buf, 1, (*off) + ud.size); |
} else { |
memcpy(*buf + *off, ud.data, ud.size); |
gu = grid_peek_utf8(gd, i, sy); |
*off += ud.size; |
size = grid_utf8_size(gu); |
|
*buf = xrealloc(*buf, 1, (*off) + size); |
|
*off += grid_utf8_copy(gu, *buf + *off, size); |
|
} |
|
} |
} |
} |
} |
|
|
|
|
{ |
{ |
struct window_copy_mode_data *data = wp->modedata; |
struct window_copy_mode_data *data = wp->modedata; |
const struct grid_cell *gc; |
const struct grid_cell *gc; |
|
struct utf8_data ud; |
|
|
gc = grid_peek_cell(data->backing->grid, px, py); |
gc = grid_peek_cell(data->backing->grid, px, py); |
if (gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8)) |
grid_cell_get(gc, &ud); |
|
if (ud.size != 1 || gc->flags & GRID_FLAG_PADDING) |
return (0); |
return (0); |
if (gc->data == 0x00 || gc->data == 0x7f) |
if (*ud.data == 0x00 || *ud.data == 0x7f) |
return (0); |
return (0); |
return (strchr(set, gc->data) != NULL); |
return (strchr(set, *ud.data) != NULL); |
} |
} |
|
|
u_int |
u_int |
|
|
struct window_copy_mode_data *data = wp->modedata; |
struct window_copy_mode_data *data = wp->modedata; |
struct screen *s = data->backing; |
struct screen *s = data->backing; |
const struct grid_cell *gc; |
const struct grid_cell *gc; |
|
struct utf8_data ud; |
u_int px; |
u_int px; |
|
|
/* |
/* |
|
|
px = screen_size_x(s); |
px = screen_size_x(s); |
while (px > 0) { |
while (px > 0) { |
gc = grid_peek_cell(s->grid, px - 1, py); |
gc = grid_peek_cell(s->grid, px - 1, py); |
if (gc->flags & GRID_FLAG_UTF8) |
grid_cell_get(gc, &ud); |
|
if (ud.size != 1 || *ud.data != ' ') |
break; |
break; |
if (gc->data != ' ') |
|
break; |
|
px--; |
px--; |
} |
} |
return (px); |
return (px); |
|
|
struct window_copy_mode_data *data = wp->modedata; |
struct window_copy_mode_data *data = wp->modedata; |
u_int px, py, xx; |
u_int px, py, xx; |
const struct grid_cell *gc; |
const struct grid_cell *gc; |
|
struct utf8_data ud; |
|
|
px = 0; |
px = 0; |
py = screen_hsize(data->backing) + data->cy - data->oy; |
py = screen_hsize(data->backing) + data->cy - data->oy; |
|
|
|
|
while (px < xx) { |
while (px < xx) { |
gc = grid_peek_cell(data->backing->grid, px, py); |
gc = grid_peek_cell(data->backing->grid, px, py); |
if (gc->flags & GRID_FLAG_UTF8) |
grid_cell_get(gc, &ud); |
|
if (ud.size != 1 || *ud.data != ' ') |
break; |
break; |
if (gc->data != ' ') |
|
break; |
|
px++; |
px++; |
} |
} |
|
|
|
|
struct window_copy_mode_data *data = wp->modedata; |
struct window_copy_mode_data *data = wp->modedata; |
struct screen *back_s = data->backing; |
struct screen *back_s = data->backing; |
const struct grid_cell *gc; |
const struct grid_cell *gc; |
|
struct utf8_data ud; |
u_int px, py, xx; |
u_int px, py, xx; |
|
|
px = data->cx + 1; |
px = data->cx + 1; |
|
|
|
|
while (px < xx) { |
while (px < xx) { |
gc = grid_peek_cell(back_s->grid, px, py); |
gc = grid_peek_cell(back_s->grid, px, py); |
if ((gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8)) == 0 |
grid_cell_get(gc, &ud); |
&& gc->data == data->jumpchar) { |
if (!(gc->flags & GRID_FLAG_PADDING) && |
|
ud.size == 1 && *ud.data == data->jumpchar) { |
window_copy_update_cursor(wp, px, data->cy); |
window_copy_update_cursor(wp, px, data->cy); |
if (window_copy_update_selection(wp)) |
if (window_copy_update_selection(wp)) |
window_copy_redraw_lines(wp, data->cy, 1); |
window_copy_redraw_lines(wp, data->cy, 1); |
|
|
struct window_copy_mode_data *data = wp->modedata; |
struct window_copy_mode_data *data = wp->modedata; |
struct screen *back_s = data->backing; |
struct screen *back_s = data->backing; |
const struct grid_cell *gc; |
const struct grid_cell *gc; |
|
struct utf8_data ud; |
u_int px, py; |
u_int px, py; |
|
|
px = data->cx; |
px = data->cx; |
|
|
|
|
for (;;) { |
for (;;) { |
gc = grid_peek_cell(back_s->grid, px, py); |
gc = grid_peek_cell(back_s->grid, px, py); |
if ((gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8)) == 0 |
grid_cell_get(gc, &ud); |
&& gc->data == data->jumpchar) { |
if (!(gc->flags & GRID_FLAG_PADDING) && |
|
ud.size == 1 && *ud.data == data->jumpchar) { |
window_copy_update_cursor(wp, px, data->cy); |
window_copy_update_cursor(wp, px, data->cy); |
if (window_copy_update_selection(wp)) |
if (window_copy_update_selection(wp)) |
window_copy_redraw_lines(wp, data->cy, 1); |
window_copy_redraw_lines(wp, data->cy, 1); |
|
|
struct window_copy_mode_data *data = wp->modedata; |
struct window_copy_mode_data *data = wp->modedata; |
struct screen *back_s = data->backing; |
struct screen *back_s = data->backing; |
const struct grid_cell *gc; |
const struct grid_cell *gc; |
|
struct utf8_data ud; |
u_int px, py, xx; |
u_int px, py, xx; |
|
|
px = data->cx + 1; |
px = data->cx + 1; |
|
|
|
|
while (px < xx) { |
while (px < xx) { |
gc = grid_peek_cell(back_s->grid, px, py); |
gc = grid_peek_cell(back_s->grid, px, py); |
if ((gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8)) == 0 |
grid_cell_get(gc, &ud); |
&& gc->data == data->jumpchar) { |
if (!(gc->flags & GRID_FLAG_PADDING) && |
|
ud.size == 1 && *ud.data == data->jumpchar) { |
window_copy_update_cursor(wp, px - 1, data->cy); |
window_copy_update_cursor(wp, px - 1, data->cy); |
if (window_copy_update_selection(wp)) |
if (window_copy_update_selection(wp)) |
window_copy_redraw_lines(wp, data->cy, 1); |
window_copy_redraw_lines(wp, data->cy, 1); |
|
|
struct window_copy_mode_data *data = wp->modedata; |
struct window_copy_mode_data *data = wp->modedata; |
struct screen *back_s = data->backing; |
struct screen *back_s = data->backing; |
const struct grid_cell *gc; |
const struct grid_cell *gc; |
|
struct utf8_data ud; |
u_int px, py; |
u_int px, py; |
|
|
px = data->cx; |
px = data->cx; |
|
|
|
|
for (;;) { |
for (;;) { |
gc = grid_peek_cell(back_s->grid, px, py); |
gc = grid_peek_cell(back_s->grid, px, py); |
if ((gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8)) == 0 |
grid_cell_get(gc, &ud); |
&& gc->data == data->jumpchar) { |
if (!(gc->flags & GRID_FLAG_PADDING) && |
|
ud.size == 1 && *ud.data == data->jumpchar) { |
window_copy_update_cursor(wp, px + 1, data->cy); |
window_copy_update_cursor(wp, px + 1, data->cy); |
if (window_copy_update_selection(wp)) |
if (window_copy_update_selection(wp)) |
window_copy_redraw_lines(wp, data->cy, 1); |
window_copy_redraw_lines(wp, data->cy, 1); |