summaryrefslogtreecommitdiffstats
path: root/grid-reader.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2021-04-18 08:47:11 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2021-04-18 08:47:11 +0100
commit5fa8e5e13f86cccd3bff6d6118328d0772d6f147 (patch)
tree70c595cf73ee5389155a58f023c7ef23075ddcd7 /grid-reader.c
parent73cf767a35f2123cc0ba40080ae1d58da9ed6e35 (diff)
back-to-indentation fixes, from Anindya Mukherjee.
Diffstat (limited to 'grid-reader.c')
-rw-r--r--grid-reader.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/grid-reader.c b/grid-reader.c
index 89fe90fb..df0dd450 100644
--- a/grid-reader.c
+++ b/grid-reader.c
@@ -371,19 +371,26 @@ void
grid_reader_cursor_back_to_indentation(struct grid_reader *gr)
{
struct grid_cell gc;
- u_int px, py, xx, yy;
+ u_int px, py, xx, yy, oldx, oldy;
yy = gr->gd->hsize + gr->gd->sy - 1;
+ oldx = gr->cx;
+ oldy = gr->cy;
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 (gc.data.size != 1 || *gc.data.data != ' ') {
+ gr->cx = px;
+ gr->cy = py;
+ return;
+ }
}
if (~grid_get_line(gr->gd, py)->flags & GRID_LINE_WRAPPED)
break;
}
+ gr->cx = oldx;
+ gr->cy = oldy;
}