summaryrefslogtreecommitdiffstats
path: root/screen.c
diff options
context:
space:
mode:
authornicm <nicm>2019-04-02 08:45:32 +0000
committernicm <nicm>2019-04-02 08:45:32 +0000
commitffa4d489676f40582b63c1791d3bf5d3b75d8421 (patch)
tree84a7d46b769da7c6e84da3e8a7a053871218eaa6 /screen.c
parent792fcb1dbfbc23b65422753cf8d2e1bb1ddd3738 (diff)
Store and restore cursor across reflow by working out a position based
on unwrapped lines, rather than a grid offset. Fixes problems reported by Thomas Sattler and Paul de Weerd.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/screen.c b/screen.c
index 92eb31de..d24f4ba4 100644
--- a/screen.c
+++ b/screen.c
@@ -464,17 +464,17 @@ screen_select_cell(struct screen *s, struct grid_cell *dst,
static void
screen_reflow(struct screen *s, u_int new_x)
{
- u_int offset, cx = s->cx, cy = s->grid->hsize + s->cy;
+ u_int cx = s->cx, cy = s->grid->hsize + s->cy, wx, wy;
struct timeval start, tv;
gettimeofday(&start, NULL);
- offset = grid_to_offset(s->grid, cx, cy);
- log_debug("%s: cursor %u,%u offset is %u", __func__, cx, cy, offset);
+ grid_wrap_position(s->grid, cx, cy, &wx, &wy);
+ log_debug("%s: cursor %u,%u is %u,%u", __func__, cx, cy, wx, wy);
grid_reflow(s->grid, new_x);
- grid_from_offset(s->grid, offset, &cx, &cy);
+ grid_unwrap_position(s->grid, &cx, &cy, wx, wy);
log_debug("%s: new cursor is %u,%u", __func__, cx, cy);
if (cy >= s->grid->hsize) {