mirror of
https://github.com/tmux/tmux.git
synced 2024-11-04 18:08:48 +00:00
Merge branch 'obsd-master' into master
This commit is contained in:
commit
22ccae1c9d
@ -71,7 +71,7 @@ grid_reader_cursor_right(struct grid_reader *gr, int wrap, int all)
|
|||||||
|
|
||||||
/* Move cursor back one position. */
|
/* Move cursor back one position. */
|
||||||
void
|
void
|
||||||
grid_reader_cursor_left(struct grid_reader *gr)
|
grid_reader_cursor_left(struct grid_reader *gr, int wrap)
|
||||||
{
|
{
|
||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
|
|
||||||
@ -81,7 +81,9 @@ grid_reader_cursor_left(struct grid_reader *gr)
|
|||||||
break;
|
break;
|
||||||
gr->cx--;
|
gr->cx--;
|
||||||
}
|
}
|
||||||
if (gr->cx == 0 && gr->cy > 0) {
|
if (gr->cx == 0 && gr->cy > 0 &&
|
||||||
|
(wrap ||
|
||||||
|
grid_get_line(gr->gd, gr->cy - 1)->flags & GRID_LINE_WRAPPED)) {
|
||||||
grid_reader_cursor_up(gr);
|
grid_reader_cursor_up(gr);
|
||||||
grid_reader_cursor_end_of_line(gr, 0, 0);
|
grid_reader_cursor_end_of_line(gr, 0, 0);
|
||||||
} else if (gr->cx > 0)
|
} else if (gr->cx > 0)
|
||||||
@ -363,3 +365,25 @@ grid_reader_cursor_jump_back(struct grid_reader *gr, const struct utf8_data *jc)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Jump back to the first non-blank character of the line. */
|
||||||
|
void
|
||||||
|
grid_reader_cursor_back_to_indentation(struct grid_reader *gr)
|
||||||
|
{
|
||||||
|
struct grid_cell gc;
|
||||||
|
u_int px, py, xx, yy;
|
||||||
|
|
||||||
|
yy = gr->gd->hsize + gr->gd->sy - 1;
|
||||||
|
grid_reader_cursor_start_of_line(gr, 1);
|
||||||
|
|
||||||
|
for (py = gr->cy; py <= yy; py++) {
|
||||||
|
xx = grid_line_length(gr->gd, py);
|
||||||
|
for (px = 0; px < xx; px++) {
|
||||||
|
grid_get_cell(gr->gd, px, py, &gc);
|
||||||
|
if (gc.data.size != 1 || *gc.data.data != ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (~grid_get_line(gr->gd, py)->flags & GRID_LINE_WRAPPED)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
3
tmux.h
3
tmux.h
@ -2584,7 +2584,7 @@ void grid_reader_get_cursor(struct grid_reader *, u_int *, u_int *);
|
|||||||
u_int grid_reader_line_length(struct grid_reader *);
|
u_int grid_reader_line_length(struct grid_reader *);
|
||||||
int grid_reader_in_set(struct grid_reader *, const char *);
|
int grid_reader_in_set(struct grid_reader *, const char *);
|
||||||
void grid_reader_cursor_right(struct grid_reader *, int, int);
|
void grid_reader_cursor_right(struct grid_reader *, int, int);
|
||||||
void grid_reader_cursor_left(struct grid_reader *);
|
void grid_reader_cursor_left(struct grid_reader *, int);
|
||||||
void grid_reader_cursor_down(struct grid_reader *);
|
void grid_reader_cursor_down(struct grid_reader *);
|
||||||
void grid_reader_cursor_up(struct grid_reader *);
|
void grid_reader_cursor_up(struct grid_reader *);
|
||||||
void grid_reader_cursor_start_of_line(struct grid_reader *, int);
|
void grid_reader_cursor_start_of_line(struct grid_reader *, int);
|
||||||
@ -2597,6 +2597,7 @@ int grid_reader_cursor_jump(struct grid_reader *,
|
|||||||
const struct utf8_data *);
|
const struct utf8_data *);
|
||||||
int grid_reader_cursor_jump_back(struct grid_reader *,
|
int grid_reader_cursor_jump_back(struct grid_reader *,
|
||||||
const struct utf8_data *);
|
const struct utf8_data *);
|
||||||
|
void grid_reader_cursor_back_to_indentation(struct grid_reader *);
|
||||||
|
|
||||||
/* grid-view.c */
|
/* grid-view.c */
|
||||||
void grid_view_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
|
void grid_view_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
|
||||||
|
@ -4291,23 +4291,19 @@ static void
|
|||||||
window_copy_cursor_back_to_indentation(struct window_mode_entry *wme)
|
window_copy_cursor_back_to_indentation(struct window_mode_entry *wme)
|
||||||
{
|
{
|
||||||
struct window_copy_mode_data *data = wme->data;
|
struct window_copy_mode_data *data = wme->data;
|
||||||
u_int px, py, xx;
|
struct screen *back_s = data->backing;
|
||||||
struct grid_cell gc;
|
struct grid_reader gr;
|
||||||
|
u_int px, py, oldy, hsize;
|
||||||
|
|
||||||
px = 0;
|
px = data->cx;
|
||||||
py = screen_hsize(data->backing) + data->cy - data->oy;
|
hsize = screen_hsize(back_s);
|
||||||
xx = window_copy_find_length(wme, py);
|
py = hsize + data->cy - data->oy;
|
||||||
|
oldy = data->cy;
|
||||||
|
|
||||||
while (px < xx) {
|
grid_reader_start(&gr, back_s->grid, px, py);
|
||||||
grid_get_cell(data->backing->grid, px, py, &gc);
|
grid_reader_cursor_back_to_indentation(&gr);
|
||||||
if (gc.data.size != 1 || *gc.data.data != ' ')
|
grid_reader_get_cursor(&gr, &px, &py);
|
||||||
break;
|
window_copy_acquire_cursor_up(wme, hsize, data->oy, oldy, px, py);
|
||||||
px++;
|
|
||||||
}
|
|
||||||
|
|
||||||
window_copy_update_cursor(wme, px, data->cy);
|
|
||||||
if (window_copy_update_selection(wme, 1, 0))
|
|
||||||
window_copy_redraw_lines(wme, data->cy, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4398,7 +4394,7 @@ window_copy_cursor_left(struct window_mode_entry *wme)
|
|||||||
oldy = data->cy;
|
oldy = data->cy;
|
||||||
|
|
||||||
grid_reader_start(&gr, back_s->grid, px, py);
|
grid_reader_start(&gr, back_s->grid, px, py);
|
||||||
grid_reader_cursor_left(&gr);
|
grid_reader_cursor_left(&gr, 1);
|
||||||
grid_reader_get_cursor(&gr, &px, &py);
|
grid_reader_get_cursor(&gr, &px, &py);
|
||||||
window_copy_acquire_cursor_up(wme, hsize, data->oy, oldy, px, py);
|
window_copy_acquire_cursor_up(wme, hsize, data->oy, oldy, px, py);
|
||||||
}
|
}
|
||||||
@ -4583,10 +4579,8 @@ window_copy_cursor_jump_back(struct window_mode_entry *wme)
|
|||||||
py = hsize + data->cy - data->oy;
|
py = hsize + data->cy - data->oy;
|
||||||
oldy = data->cy;
|
oldy = data->cy;
|
||||||
|
|
||||||
if (px > 0)
|
|
||||||
px--;
|
|
||||||
|
|
||||||
grid_reader_start(&gr, back_s->grid, px, py);
|
grid_reader_start(&gr, back_s->grid, px, py);
|
||||||
|
grid_reader_cursor_left(&gr, 0);
|
||||||
if (grid_reader_cursor_jump_back(&gr, data->jumpchar)) {
|
if (grid_reader_cursor_jump_back(&gr, data->jumpchar)) {
|
||||||
grid_reader_get_cursor(&gr, &px, &py);
|
grid_reader_get_cursor(&gr, &px, &py);
|
||||||
window_copy_acquire_cursor_up(wme, hsize, data->oy, oldy, px,
|
window_copy_acquire_cursor_up(wme, hsize, data->oy, oldy, px,
|
||||||
@ -4609,7 +4603,7 @@ window_copy_cursor_jump_to(struct window_mode_entry *wme)
|
|||||||
|
|
||||||
grid_reader_start(&gr, back_s->grid, px, py);
|
grid_reader_start(&gr, back_s->grid, px, py);
|
||||||
if (grid_reader_cursor_jump(&gr, data->jumpchar)) {
|
if (grid_reader_cursor_jump(&gr, data->jumpchar)) {
|
||||||
grid_reader_cursor_left(&gr);
|
grid_reader_cursor_left(&gr, 1);
|
||||||
grid_reader_get_cursor(&gr, &px, &py);
|
grid_reader_get_cursor(&gr, &px, &py);
|
||||||
window_copy_acquire_cursor_down(wme, hsize,
|
window_copy_acquire_cursor_down(wme, hsize,
|
||||||
screen_size_y(back_s), data->oy, oldy, px, py, 0);
|
screen_size_y(back_s), data->oy, oldy, px, py, 0);
|
||||||
@ -4629,13 +4623,9 @@ window_copy_cursor_jump_to_back(struct window_mode_entry *wme)
|
|||||||
py = hsize + data->cy - data->oy;
|
py = hsize + data->cy - data->oy;
|
||||||
oldy = data->cy;
|
oldy = data->cy;
|
||||||
|
|
||||||
if (px > 0)
|
|
||||||
px--;
|
|
||||||
|
|
||||||
if (px > 0)
|
|
||||||
px--;
|
|
||||||
|
|
||||||
grid_reader_start(&gr, back_s->grid, px, py);
|
grid_reader_start(&gr, back_s->grid, px, py);
|
||||||
|
grid_reader_cursor_left(&gr, 0);
|
||||||
|
grid_reader_cursor_left(&gr, 0);
|
||||||
if (grid_reader_cursor_jump_back(&gr, data->jumpchar)) {
|
if (grid_reader_cursor_jump_back(&gr, data->jumpchar)) {
|
||||||
grid_reader_cursor_right(&gr, 1, 0);
|
grid_reader_cursor_right(&gr, 1, 0);
|
||||||
grid_reader_get_cursor(&gr, &px, &py);
|
grid_reader_get_cursor(&gr, &px, &py);
|
||||||
@ -4688,7 +4678,7 @@ window_copy_cursor_next_word_end_pos(struct window_mode_entry *wme,
|
|||||||
grid_reader_cursor_right(&gr, 0, 0);
|
grid_reader_cursor_right(&gr, 0, 0);
|
||||||
grid_reader_cursor_next_word_end(&gr, separators);
|
grid_reader_cursor_next_word_end(&gr, separators);
|
||||||
if (keys == MODEKEY_VI)
|
if (keys == MODEKEY_VI)
|
||||||
grid_reader_cursor_left(&gr);
|
grid_reader_cursor_left(&gr, 1);
|
||||||
grid_reader_get_cursor(&gr, &px, &py);
|
grid_reader_get_cursor(&gr, &px, &py);
|
||||||
*ppx = px;
|
*ppx = px;
|
||||||
*ppy = py;
|
*ppy = py;
|
||||||
@ -4718,7 +4708,7 @@ window_copy_cursor_next_word_end(struct window_mode_entry *wme,
|
|||||||
grid_reader_cursor_right(&gr, 0, 0);
|
grid_reader_cursor_right(&gr, 0, 0);
|
||||||
grid_reader_cursor_next_word_end(&gr, separators);
|
grid_reader_cursor_next_word_end(&gr, separators);
|
||||||
if (keys == MODEKEY_VI)
|
if (keys == MODEKEY_VI)
|
||||||
grid_reader_cursor_left(&gr);
|
grid_reader_cursor_left(&gr, 1);
|
||||||
grid_reader_get_cursor(&gr, &px, &py);
|
grid_reader_get_cursor(&gr, &px, &py);
|
||||||
window_copy_acquire_cursor_down(wme, hsize, screen_size_y(back_s),
|
window_copy_acquire_cursor_down(wme, hsize, screen_size_y(back_s),
|
||||||
data->oy, oldy, px, py, no_reset);
|
data->oy, oldy, px, py, no_reset);
|
||||||
|
Loading…
Reference in New Issue
Block a user