version 1.117, 2014/10/22 23:18:53 |
version 1.118, 2014/11/06 09:17:26 |
|
|
void window_copy_key(struct window_pane *, struct session *, int); |
void window_copy_key(struct window_pane *, struct session *, int); |
int window_copy_key_input(struct window_pane *, int); |
int window_copy_key_input(struct window_pane *, int); |
int window_copy_key_numeric_prefix(struct window_pane *, int); |
int window_copy_key_numeric_prefix(struct window_pane *, int); |
void window_copy_mouse( |
void window_copy_mouse(struct window_pane *, struct session *, |
struct window_pane *, struct session *, struct mouse_event *); |
struct mouse_event *); |
|
|
void window_copy_redraw_lines(struct window_pane *, u_int, u_int); |
void window_copy_redraw_lines(struct window_pane *, u_int, u_int); |
void window_copy_redraw_screen(struct window_pane *); |
void window_copy_redraw_screen(struct window_pane *); |
void window_copy_write_line( |
void window_copy_write_line(struct window_pane *, struct screen_write_ctx *, |
struct window_pane *, struct screen_write_ctx *, u_int); |
u_int); |
void window_copy_write_lines( |
void window_copy_write_lines(struct window_pane *, |
struct window_pane *, struct screen_write_ctx *, u_int, u_int); |
struct screen_write_ctx *, u_int, u_int); |
|
|
void window_copy_scroll_to(struct window_pane *, u_int, u_int); |
void window_copy_scroll_to(struct window_pane *, u_int, u_int); |
int window_copy_search_compare( |
int window_copy_search_compare(struct grid *, u_int, u_int, struct grid *, |
struct grid *, u_int, u_int, struct grid *, u_int, int); |
u_int, int); |
int window_copy_search_lr( |
int window_copy_search_lr(struct grid *, struct grid *, u_int *, u_int, |
struct grid *, struct grid *, u_int *, u_int, u_int, u_int, int); |
u_int, u_int, int); |
int window_copy_search_rl( |
int window_copy_search_rl(struct grid *, struct grid *, u_int *, u_int, |
struct grid *, struct grid *, u_int *, u_int, u_int, u_int, int); |
u_int, u_int, int); |
void window_copy_search_up(struct window_pane *, const char *); |
void window_copy_search_up(struct window_pane *, const char *); |
void window_copy_search_down(struct window_pane *, const char *); |
void window_copy_search_down(struct window_pane *, const char *); |
void window_copy_goto_line(struct window_pane *, const char *); |
void window_copy_goto_line(struct window_pane *, const char *); |
|
|
u_int n; |
u_int n; |
int np, keys; |
int np, keys; |
enum mode_key_cmd cmd; |
enum mode_key_cmd cmd; |
const char *arg; |
const char *arg, *ss; |
|
|
np = data->numprefix; |
np = data->numprefix; |
if (np <= 0) |
if (np <= 0) |
|
|
window_copy_redraw_screen(wp); |
window_copy_redraw_screen(wp); |
break; |
break; |
case MODEKEYCOPY_STARTSELECTION: |
case MODEKEYCOPY_STARTSELECTION: |
|
s->sel.lineflag = LINE_SEL_NONE; |
window_copy_start_selection(wp); |
window_copy_start_selection(wp); |
window_copy_redraw_screen(wp); |
window_copy_redraw_screen(wp); |
break; |
break; |
case MODEKEYCOPY_COPYLINE: |
|
case MODEKEYCOPY_SELECTLINE: |
case MODEKEYCOPY_SELECTLINE: |
|
s->sel.lineflag = LINE_SEL_LEFT_RIGHT; |
|
data->rectflag = 0; |
|
/* FALLTHROUGH */ |
|
case MODEKEYCOPY_COPYLINE: |
window_copy_cursor_start_of_line(wp); |
window_copy_cursor_start_of_line(wp); |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case MODEKEYCOPY_COPYENDOFLINE: |
case MODEKEYCOPY_COPYENDOFLINE: |
|
|
case WINDOW_COPY_NUMERICPREFIX: |
case WINDOW_COPY_NUMERICPREFIX: |
break; |
break; |
case WINDOW_COPY_SEARCHUP: |
case WINDOW_COPY_SEARCHUP: |
|
ss = data->searchstr; |
if (cmd == MODEKEYCOPY_SEARCHAGAIN) { |
if (cmd == MODEKEYCOPY_SEARCHAGAIN) { |
for (; np != 0; np--) { |
for (; np != 0; np--) |
window_copy_search_up( |
window_copy_search_up(wp, ss); |
wp, data->searchstr); |
|
} |
|
} else { |
} else { |
for (; np != 0; np--) { |
for (; np != 0; np--) |
window_copy_search_down( |
window_copy_search_down(wp, ss); |
wp, data->searchstr); |
|
} |
|
} |
} |
break; |
break; |
case WINDOW_COPY_SEARCHDOWN: |
case WINDOW_COPY_SEARCHDOWN: |
|
ss = data->searchstr; |
if (cmd == MODEKEYCOPY_SEARCHAGAIN) { |
if (cmd == MODEKEYCOPY_SEARCHAGAIN) { |
for (; np != 0; np--) { |
for (; np != 0; np--) |
window_copy_search_down( |
window_copy_search_down(wp, ss); |
wp, data->searchstr); |
|
} |
|
} else { |
} else { |
for (; np != 0; np--) { |
for (; np != 0; np--) |
window_copy_search_up( |
window_copy_search_up(wp, ss); |
wp, data->searchstr); |
|
} |
|
} |
} |
break; |
break; |
} |
} |
|
|
} |
} |
break; |
break; |
case MODEKEYCOPY_RECTANGLETOGGLE: |
case MODEKEYCOPY_RECTANGLETOGGLE: |
|
s->sel.lineflag = LINE_SEL_NONE; |
window_copy_rectangle_toggle(wp); |
window_copy_rectangle_toggle(wp); |
break; |
break; |
default: |
default: |
|
|
} |
} |
|
|
void |
void |
window_copy_mouse( |
window_copy_mouse(struct window_pane *wp, struct session *sess, |
struct window_pane *wp, struct session *sess, struct mouse_event *m) |
struct mouse_event *m) |
{ |
{ |
struct window_copy_mode_data *data = wp->modedata; |
struct window_copy_mode_data *data = wp->modedata; |
struct screen *s = &data->screen; |
struct screen *s = &data->screen; |
|
|
* We reached the bottom, leave copy mode, but |
* We reached the bottom, leave copy mode, but |
* only if no selection is in progress. |
* only if no selection is in progress. |
*/ |
*/ |
if (data->oy == 0 && !s->sel.flag) |
if (data->oy == 0 && !s->sel.flag && |
|
s->sel.lineflag == LINE_SEL_NONE) |
goto reset_mode; |
goto reset_mode; |
} |
} |
} |
} |
|
|
} |
} |
|
|
int |
int |
window_copy_search_compare( |
window_copy_search_compare(struct grid *gd, u_int px, u_int py, |
struct grid *gd, u_int px, u_int py, struct grid *sgd, u_int spx, int cis) |
struct grid *sgd, u_int spx, int cis) |
{ |
{ |
const struct grid_cell *gc, *sgc; |
const struct grid_cell *gc, *sgc; |
struct utf8_data ud, sud; |
struct utf8_data ud, sud; |
|
|
} |
} |
|
|
void |
void |
window_copy_write_line( |
window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, |
struct window_pane *wp, struct screen_write_ctx *ctx, u_int py) |
u_int py) |
{ |
{ |
struct window_copy_mode_data *data = wp->modedata; |
struct window_copy_mode_data *data = wp->modedata; |
struct screen *s = &data->screen; |
struct screen *s = &data->screen; |
|
|
} |
} |
|
|
void |
void |
window_copy_write_lines( |
window_copy_write_lines(struct window_pane *wp, struct screen_write_ctx *ctx, |
struct window_pane *wp, struct screen_write_ctx *ctx, u_int py, u_int ny) |
u_int py, u_int ny) |
{ |
{ |
u_int yy; |
u_int yy; |
|
|
|
|
struct grid_cell gc; |
struct grid_cell gc; |
u_int sx, sy, ty, cy; |
u_int sx, sy, ty, cy; |
|
|
if (!s->sel.flag) |
if (!s->sel.flag && s->sel.lineflag == LINE_SEL_NONE) |
return (0); |
return (0); |
|
|
/* Set colours. */ |
/* Set colours. */ |
|
|
u_int firstsx, lastex, restex, restsx; |
u_int firstsx, lastex, restex, restsx; |
int keys; |
int keys; |
|
|
if (!s->sel.flag) |
if (!s->sel.flag && s->sel.lineflag == LINE_SEL_NONE) |
return (NULL); |
return (NULL); |
|
|
buf = xmalloc(1); |
buf = xmalloc(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; |
|
struct screen *s = &data->screen; |
struct grid *gd = back_s->grid; |
struct grid *gd = back_s->grid; |
u_int py; |
u_int py; |
|
|
if (data->cx == 0) { |
if (data->cx == 0 && s->sel.lineflag == LINE_SEL_NONE) { |
py = screen_hsize(back_s) + data->cy - data->oy; |
py = screen_hsize(back_s) + data->cy - data->oy; |
while (py > 0 && gd->linedata[py-1].flags & GRID_LINE_WRAPPED) { |
while (py > 0 && |
|
gd->linedata[py-1].flags & GRID_LINE_WRAPPED) { |
window_copy_cursor_up(wp, 0); |
window_copy_cursor_up(wp, 0); |
py = screen_hsize(back_s) + data->cy - data->oy; |
py = screen_hsize(back_s) + data->cy - data->oy; |
} |
} |
|
|
{ |
{ |
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; |
|
struct screen *s = &data->screen; |
struct grid *gd = back_s->grid; |
struct grid *gd = back_s->grid; |
u_int px, py; |
u_int px, py; |
|
|
py = screen_hsize(back_s) + data->cy - data->oy; |
py = screen_hsize(back_s) + data->cy - data->oy; |
px = window_copy_find_length(wp, py); |
px = window_copy_find_length(wp, py); |
|
|
if (data->cx == px) { |
if (data->cx == px && s->sel.lineflag == LINE_SEL_NONE) { |
if (data->screen.sel.flag && data->rectflag) |
if (data->screen.sel.flag && data->rectflag) |
px = screen_size_x(back_s); |
px = screen_size_x(back_s); |
if (gd->linedata[py].flags & GRID_LINE_WRAPPED) { |
if (gd->linedata[py].flags & GRID_LINE_WRAPPED) { |
|
|
struct screen *s = &data->screen; |
struct screen *s = &data->screen; |
u_int selx, sely, cx, cy, yy; |
u_int selx, sely, cx, cy, yy; |
|
|
if (!s->sel.flag) |
if (!s->sel.flag && s->sel.lineflag == LINE_SEL_NONE) |
return; |
return; |
|
|
|
if (s->sel.lineflag == LINE_SEL_LEFT_RIGHT) |
|
s->sel.lineflag = LINE_SEL_RIGHT_LEFT; |
|
else if (s->sel.lineflag == LINE_SEL_RIGHT_LEFT) |
|
s->sel.lineflag = LINE_SEL_LEFT_RIGHT; |
|
|
selx = data->selx; |
selx = data->selx; |
sely = data->sely; |
sely = data->sely; |
cx = data->cx; |
cx = data->cx; |
|
|
data->lastsx = ox; |
data->lastsx = ox; |
} |
} |
|
|
|
if (s->sel.lineflag == LINE_SEL_LEFT_RIGHT && oy == data->sely) |
|
window_copy_other_end(wp); |
|
|
data->cx = data->lastcx; |
data->cx = data->lastcx; |
if (scroll_only || data->cy == 0) { |
if (scroll_only || data->cy == 0) { |
window_copy_scroll_down(wp, 1); |
window_copy_scroll_down(wp, 1); |
|
|
data->cx > px) |
data->cx > px) |
window_copy_cursor_end_of_line(wp); |
window_copy_cursor_end_of_line(wp); |
} |
} |
|
|
|
if (s->sel.lineflag == LINE_SEL_LEFT_RIGHT) |
|
window_copy_cursor_end_of_line(wp); |
|
else if (s->sel.lineflag == LINE_SEL_RIGHT_LEFT) |
|
window_copy_cursor_start_of_line(wp); |
} |
} |
|
|
void |
void |
|
|
data->lastsx = ox; |
data->lastsx = ox; |
} |
} |
|
|
|
if (s->sel.lineflag == LINE_SEL_RIGHT_LEFT && oy == data->sely) |
|
window_copy_other_end(wp); |
|
|
data->cx = data->lastcx; |
data->cx = data->lastcx; |
if (scroll_only || data->cy == screen_size_y(s) - 1) { |
if (scroll_only || data->cy == screen_size_y(s) - 1) { |
window_copy_scroll_up(wp, 1); |
window_copy_scroll_up(wp, 1); |
|
|
data->cx > px) |
data->cx > px) |
window_copy_cursor_end_of_line(wp); |
window_copy_cursor_end_of_line(wp); |
} |
} |
|
|
|
if (s->sel.lineflag == LINE_SEL_LEFT_RIGHT) |
|
window_copy_cursor_end_of_line(wp); |
|
else if (s->sel.lineflag == LINE_SEL_RIGHT_LEFT) |
|
window_copy_cursor_start_of_line(wp); |
} |
} |
|
|
void |
void |