@@ -47,7 +47,7 @@ grid_view_set_cell(struct grid *gd, u_int px, u_int py,
4747
4848/* Clear into history. */
4949void
50- grid_view_clear_history (struct grid * gd )
50+ grid_view_clear_history (struct grid * gd , u_int bg )
5151{
5252struct grid_line * gl ;
5353u_int yy , last ;
@@ -56,38 +56,43 @@ grid_view_clear_history(struct grid *gd)
5656last = 0 ;
5757for (yy = 0 ; yy < gd -> sy ; yy ++ ) {
5858gl = & gd -> linedata [grid_view_y (gd , yy )];
59- if (gl -> cellsize != 0 )
59+ if (gl -> cellused != 0 )
6060last = yy + 1 ;
6161}
62- if (last == 0 )
62+ if (last == 0 ) {
63+ grid_view_clear (gd , 0 , 0 , gd -> sx , gd -> sy , bg );
6364return ;
65+ }
6466
6567/* Scroll the lines into the history. */
6668for (yy = 0 ; yy < last ; yy ++ ) {
67- grid_collect_history (gd );
68- grid_scroll_history (gd );
69+ grid_collect_history (gd , bg );
70+ grid_scroll_history (gd , bg );
6971}
72+ if (last < gd -> sy )
73+ grid_view_clear (gd , 0 , 0 , gd -> sx , gd -> sy - last , bg );
7074gd -> hscrolled = 0 ;
7175}
7276
7377/* Clear area. */
7478void
75- grid_view_clear (struct grid * gd , u_int px , u_int py , u_int nx , u_int ny )
79+ grid_view_clear (struct grid * gd , u_int px , u_int py , u_int nx , u_int ny ,
80+ u_int bg )
7681{
7782px = grid_view_x (gd , px );
7883py = grid_view_y (gd , py );
7984
80- grid_clear (gd , px , py , nx , ny );
85+ grid_clear (gd , px , py , nx , ny , bg );
8186}
8287
8388/* Scroll region up. */
8489void
8590grid_view_scroll_region_up (struct grid * gd , u_int rupper , u_int rlower )
8691{
8792if (gd -> flags & GRID_HISTORY ) {
88- grid_collect_history (gd );
93+ grid_collect_history (gd , 8 );
8994if (rupper == 0 && rlower == gd -> sy - 1 )
90- grid_scroll_history (gd );
95+ grid_scroll_history (gd , 8 );
9196else {
9297rupper = grid_view_y (gd , rupper );
9398rlower = grid_view_y (gd , rlower );
@@ -96,7 +101,7 @@ grid_view_scroll_region_up(struct grid *gd, u_int rupper, u_int rlower)
96101} else {
97102rupper = grid_view_y (gd , rupper );
98103rlower = grid_view_y (gd , rlower );
99- grid_move_lines (gd , rupper , rupper + 1 , rlower - rupper );
104+ grid_move_lines (gd , rupper , rupper + 1 , rlower - rupper , 8 );
100105}
101106}
102107
@@ -107,26 +112,26 @@ grid_view_scroll_region_down(struct grid *gd, u_int rupper, u_int rlower)
107112rupper = grid_view_y (gd , rupper );
108113rlower = grid_view_y (gd , rlower );
109114
110- grid_move_lines (gd , rupper + 1 , rupper , rlower - rupper );
115+ grid_move_lines (gd , rupper + 1 , rupper , rlower - rupper , 8 );
111116}
112117
113118/* Insert lines. */
114119void
115- grid_view_insert_lines (struct grid * gd , u_int py , u_int ny )
120+ grid_view_insert_lines (struct grid * gd , u_int py , u_int ny , u_int bg )
116121{
117122u_int sy ;
118123
119124py = grid_view_y (gd , py );
120125
121126sy = grid_view_y (gd , gd -> sy );
122127
123- grid_move_lines (gd , py + ny , py , sy - py - ny );
128+ grid_move_lines (gd , py + ny , py , sy - py - ny , bg );
124129}
125130
126131/* Insert lines in region. */
127132void
128133grid_view_insert_lines_region (struct grid * gd , u_int rlower , u_int py ,
129- u_int ny )
134+ u_int ny , u_int bg )
130135{
131136u_int ny2 ;
132137
@@ -135,28 +140,28 @@ grid_view_insert_lines_region(struct grid *gd, u_int rlower, u_int py,
135140py = grid_view_y (gd , py );
136141
137142ny2 = rlower + 1 - py - ny ;
138- grid_move_lines (gd , rlower + 1 - ny2 , py , ny2 );
139- grid_clear (gd , 0 , py + ny2 , gd -> sx , ny - ny2 );
143+ grid_move_lines (gd , rlower + 1 - ny2 , py , ny2 , bg );
144+ grid_clear (gd , 0 , py + ny2 , gd -> sx , ny - ny2 , bg );
140145}
141146
142147/* Delete lines. */
143148void
144- grid_view_delete_lines (struct grid * gd , u_int py , u_int ny )
149+ grid_view_delete_lines (struct grid * gd , u_int py , u_int ny , u_int bg )
145150{
146151u_int sy ;
147152
148153py = grid_view_y (gd , py );
149154
150155sy = grid_view_y (gd , gd -> sy );
151156
152- grid_move_lines (gd , py , py + ny , sy - py - ny );
153- grid_clear (gd , 0 , sy - ny , gd -> sx , py + ny - (sy - ny ));
157+ grid_move_lines (gd , py , py + ny , sy - py - ny , bg );
158+ grid_clear (gd , 0 , sy - ny , gd -> sx , py + ny - (sy - ny ), bg );
154159}
155160
156161/* Delete lines inside scroll region. */
157162void
158163grid_view_delete_lines_region (struct grid * gd , u_int rlower , u_int py ,
159- u_int ny )
164+ u_int ny , u_int bg )
160165{
161166u_int ny2 ;
162167
@@ -165,13 +170,13 @@ grid_view_delete_lines_region(struct grid *gd, u_int rlower, u_int py,
165170py = grid_view_y (gd , py );
166171
167172ny2 = rlower + 1 - py - ny ;
168- grid_move_lines (gd , py , py + ny , ny2 );
169- grid_clear (gd , 0 , py + ny2 , gd -> sx , ny - ny2 );
173+ grid_move_lines (gd , py , py + ny , ny2 , bg );
174+ grid_clear (gd , 0 , py + ny2 , gd -> sx , ny - ny2 , bg );
170175}
171176
172177/* Insert characters. */
173178void
174- grid_view_insert_cells (struct grid * gd , u_int px , u_int py , u_int nx )
179+ grid_view_insert_cells (struct grid * gd , u_int px , u_int py , u_int nx , u_int bg )
175180{
176181u_int sx ;
177182
@@ -181,14 +186,14 @@ grid_view_insert_cells(struct grid *gd, u_int px, u_int py, u_int nx)
181186sx = grid_view_x (gd , gd -> sx );
182187
183188if (px == sx - 1 )
184- grid_clear (gd , px , py , 1 , 1 );
189+ grid_clear (gd , px , py , 1 , 1 , bg );
185190else
186- grid_move_cells (gd , px + nx , px , py , sx - px - nx );
191+ grid_move_cells (gd , px + nx , px , py , sx - px - nx , bg );
187192}
188193
189194/* Delete characters. */
190195void
191- grid_view_delete_cells (struct grid * gd , u_int px , u_int py , u_int nx )
196+ grid_view_delete_cells (struct grid * gd , u_int px , u_int py , u_int nx , u_int bg )
192197{
193198u_int sx ;
194199
@@ -197,8 +202,8 @@ grid_view_delete_cells(struct grid *gd, u_int px, u_int py, u_int nx)
197202
198203sx = grid_view_x (gd , gd -> sx );
199204
200- grid_move_cells (gd , px , px + nx , py , sx - px - nx );
201- grid_clear (gd , sx - nx , py , px + nx - (sx - nx ), 1 );
205+ grid_move_cells (gd , px , px + nx , py , sx - px - nx , bg );
206+ grid_clear (gd , sx - nx , py , px + nx - (sx - nx ), 1 , bg );
202207}
203208
204209/* Convert cells into a string. */
0 commit comments