diff options
author | Thomas Adam <thomas@xteddy.org> | 2021-04-05 10:01:19 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2021-04-05 10:01:19 +0100 |
commit | 22ccae1c9db19c610ea78052b221ad1e1876bf69 (patch) | |
tree | 4c92a36597f95de5fbe13e40c585fede7f50bdf8 /window-copy.c | |
parent | b307fc8cd5de31fc7038c9899328ca620f85c25a (diff) | |
parent | 5900b164a47689620db962e69f6d040bb82885b0 (diff) | |
download | rtmux-22ccae1c9db19c610ea78052b221ad1e1876bf69.tar.gz rtmux-22ccae1c9db19c610ea78052b221ad1e1876bf69.tar.bz2 rtmux-22ccae1c9db19c610ea78052b221ad1e1876bf69.zip |
Merge branch 'obsd-master' into master
Diffstat (limited to 'window-copy.c')
-rw-r--r-- | window-copy.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/window-copy.c b/window-copy.c index 6276c8f9..423cce8f 100644 --- a/window-copy.c +++ b/window-copy.c @@ -4291,23 +4291,19 @@ static void window_copy_cursor_back_to_indentation(struct window_mode_entry *wme) { struct window_copy_mode_data *data = wme->data; - u_int px, py, xx; - struct grid_cell gc; - - px = 0; - py = screen_hsize(data->backing) + data->cy - data->oy; - xx = window_copy_find_length(wme, py); + struct screen *back_s = data->backing; + struct grid_reader gr; + u_int px, py, oldy, hsize; - while (px < xx) { - grid_get_cell(data->backing->grid, px, py, &gc); - if (gc.data.size != 1 || *gc.data.data != ' ') - break; - px++; - } + px = data->cx; + hsize = screen_hsize(back_s); + py = hsize + data->cy - data->oy; + oldy = data->cy; - window_copy_update_cursor(wme, px, data->cy); - if (window_copy_update_selection(wme, 1, 0)) - window_copy_redraw_lines(wme, data->cy, 1); + grid_reader_start(&gr, back_s->grid, px, py); + grid_reader_cursor_back_to_indentation(&gr); + grid_reader_get_cursor(&gr, &px, &py); + window_copy_acquire_cursor_up(wme, hsize, data->oy, oldy, px, py); } static void @@ -4398,7 +4394,7 @@ window_copy_cursor_left(struct window_mode_entry *wme) oldy = data->cy; 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); 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; oldy = data->cy; - if (px > 0) - px--; - grid_reader_start(&gr, back_s->grid, px, py); + grid_reader_cursor_left(&gr, 0); if (grid_reader_cursor_jump_back(&gr, data->jumpchar)) { grid_reader_get_cursor(&gr, &px, &py); 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); 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); window_copy_acquire_cursor_down(wme, hsize, 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; oldy = data->cy; - if (px > 0) - px--; - - if (px > 0) - px--; - 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)) { grid_reader_cursor_right(&gr, 1, 0); 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_next_word_end(&gr, separators); if (keys == MODEKEY_VI) - grid_reader_cursor_left(&gr); + grid_reader_cursor_left(&gr, 1); grid_reader_get_cursor(&gr, &px, &py); *ppx = px; *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_next_word_end(&gr, separators); if (keys == MODEKEY_VI) - grid_reader_cursor_left(&gr); + grid_reader_cursor_left(&gr, 1); grid_reader_get_cursor(&gr, &px, &py); window_copy_acquire_cursor_down(wme, hsize, screen_size_y(back_s), data->oy, oldy, px, py, no_reset); |