diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-09-25 18:01:09 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-09-25 18:01:09 +0100 |
commit | 20c3adca41675b30593e39fa6fa9dfda615997ef (patch) | |
tree | c834821241b3cae2b5be95db7d6a3e9fb1f26359 /grid.c | |
parent | b0372840e7461089412a8ddf705533f9f72f1426 (diff) | |
parent | 28f23f18e9d79405a60348c4f7aeded33da9135b (diff) | |
download | rtmux-20c3adca41675b30593e39fa6fa9dfda615997ef.tar.gz rtmux-20c3adca41675b30593e39fa6fa9dfda615997ef.tar.bz2 rtmux-20c3adca41675b30593e39fa6fa9dfda615997ef.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'grid.c')
-rw-r--r-- | grid.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -170,6 +170,18 @@ grid_scroll_history(struct grid *gd) gd->hsize++; } +/* Clear the history. */ +void +grid_clear_history(struct grid *gd) +{ + grid_clear_lines(gd, 0, gd->hsize); + grid_move_lines(gd, 0, gd->hsize, gd->sy); + + gd->hsize = 0; + gd->linedata = xreallocarray(gd->linedata, gd->sy, + sizeof *gd->linedata); +} + /* Scroll a region up, moving the top line into the history. */ void grid_scroll_history_region(struct grid *gd, u_int upper, u_int lower) @@ -344,8 +356,8 @@ grid_move_lines(struct grid *gd, u_int dy, u_int py, u_int ny) grid_clear_lines(gd, yy, 1); } - memmove( - &gd->linedata[dy], &gd->linedata[py], ny * (sizeof *gd->linedata)); + memmove(&gd->linedata[dy], &gd->linedata[py], + ny * (sizeof *gd->linedata)); /* Wipe any lines that have been moved (without freeing them). */ for (yy = py; yy < py + ny; yy++) { @@ -371,8 +383,8 @@ grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx) grid_expand_line(gd, py, px + nx); grid_expand_line(gd, py, dx + nx); - memmove( - &gl->celldata[dx], &gl->celldata[px], nx * sizeof *gl->celldata); + memmove(&gl->celldata[dx], &gl->celldata[px], + nx * sizeof *gl->celldata); /* Wipe any cells that have been moved. */ for (xx = px; xx < px + nx; xx++) { |