summaryrefslogtreecommitdiffstats
path: root/grid-reader.c
diff options
context:
space:
mode:
authornicm <nicm>2021-03-09 08:24:09 +0000
committernicm <nicm>2021-03-09 08:24:09 +0000
commit81e57365102b8f7d067b1bd8b431529aef74fe14 (patch)
treeae6316e4c1c039e077c3acb29dd0450ec96229ab /grid-reader.c
parent81f9a23d25237f2b0c52a2867ddd2db59cc8f368 (diff)
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.
Diffstat (limited to 'grid-reader.c')
-rw-r--r--grid-reader.c10
1 files changed, 5 insertions, 5 deletions
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--;