From 81e57365102b8f7d067b1bd8b431529aef74fe14 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 9 Mar 2021 08:24:09 +0000 Subject: Copy mode improvements from Anindya Mukherjee: - Fix word and word-end for wrapped lines. - Fix copying of selection end on wrapped lines. - Fix wrapped word selection edge case. - Update select-line to respect wrapped lines. - Update window_copy_..._pos() functions to use grid_reader. GitHub issue 2605. --- grid-reader.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'grid-reader.c') diff --git a/grid-reader.c b/grid-reader.c index c011ea1d..ae2f4d2b 100644 --- a/grid-reader.c +++ b/grid-reader.c @@ -172,7 +172,7 @@ grid_reader_cursor_next_word(struct grid_reader *gr, const char *separators) /* Do not break up wrapped words. */ if (grid_get_line(gr->gd, gr->cy)->flags & GRID_LINE_WRAPPED) - xx = grid_reader_line_length(gr) - 1; + xx = gr->gd->sx - 1; else xx = grid_reader_line_length(gr); yy = gr->gd->hsize + gr->gd->sy - 1; @@ -197,7 +197,7 @@ grid_reader_cursor_next_word(struct grid_reader *gr, const char *separators) if (grid_get_line(gr->gd, gr->cy)->flags & GRID_LINE_WRAPPED) - xx = grid_reader_line_length(gr) - 1; + xx = gr->gd->sx - 1; else xx = grid_reader_line_length(gr); } else @@ -216,7 +216,7 @@ grid_reader_cursor_next_word_end(struct grid_reader *gr, const char *separators) /* Do not break up wrapped words. */ if (grid_get_line(gr->gd, gr->cy)->flags & GRID_LINE_WRAPPED) - xx = grid_reader_line_length(gr) - 1; + xx = gr->gd->sx - 1; else xx = grid_reader_line_length(gr); yy = gr->gd->hsize + gr->gd->sy - 1; @@ -241,7 +241,7 @@ grid_reader_cursor_next_word_end(struct grid_reader *gr, const char *separators) if (grid_get_line(gr->gd, gr->cy)->flags & GRID_LINE_WRAPPED) - xx = grid_reader_line_length(gr) - 1; + xx = gr->gd->sx - 1; else xx = grid_reader_line_length(gr); } else @@ -294,7 +294,7 @@ grid_reader_cursor_previous_word(struct grid_reader *gr, const char *separators, GRID_LINE_WRAPPED) break; grid_reader_cursor_up(gr); - grid_reader_cursor_end_of_line(gr, 0, 0); + grid_reader_cursor_end_of_line(gr, 0, 1); } if (gr->cx > 0) gr->cx--; -- cgit v1.2.3