On Tue, May 01, 2018 at 05:03:26PM +0000, Miod Vallat wrote: > > scrollback isn't part of wsdisplay_emulops but rather wsdisplay_accessops. > > It isn't clear how to properly get an attr in wsscrollback() > > GETCHAR/getchar is part of wsmoused and sc->sc_accessops->getchar > > may be NULL. > > Ok, ignore that. There is a simpler solution.
Thanks, looks good/ok. Shouldn't the eraserows call in rasops_doswitch() also use scr->rs_defattr for the attr argument? Index: rasops.c =================================================================== RCS file: /cvs/src/sys/dev/rasops/rasops.c,v retrieving revision 1.53 diff -u -p -r1.53 rasops.c --- rasops.c 27 Apr 2018 21:36:12 -0000 1.53 +++ rasops.c 2 May 2018 01:53:38 -0000 @@ -1373,6 +1373,7 @@ struct rasops_screen { int rs_visible; int rs_crow; int rs_ccol; + long rs_defattr; int rs_sbscreens; #define RS_SCROLLBACK_SCREENS 5 @@ -1412,10 +1413,11 @@ rasops_alloc_screen(void *v, void **cook scr->rs_visible = (ri->ri_nscreens == 0); scr->rs_crow = -1; scr->rs_ccol = -1; + scr->rs_defattr = *attrp; for (i = 0; i < scr->rs_dispoffset; i++) { scr->rs_bs[i].uc = ' '; - scr->rs_bs[i].attr = *attrp; + scr->rs_bs[i].attr = scr->rs_defattr; } if (ri->ri_bs && scr->rs_visible) { @@ -1425,7 +1427,8 @@ rasops_alloc_screen(void *v, void **cook } else { for (i = 0; i < ri->ri_rows * ri->ri_cols; i++) { scr->rs_bs[scr->rs_dispoffset + i].uc = ' '; - scr->rs_bs[scr->rs_dispoffset + i].attr = *attrp; + scr->rs_bs[scr->rs_dispoffset + i].attr = + scr->rs_defattr; } } @@ -1474,12 +1477,10 @@ rasops_doswitch(void *v) struct rasops_info *ri = v; struct rasops_screen *scr = ri->ri_switchcookie; int row, col; - long attr; rasops_cursor(ri, 0, 0, 0); ri->ri_active->rs_visible = 0; - ri->ri_alloc_attr(ri, 0, 0, 0, &attr); - ri->ri_eraserows(ri, 0, ri->ri_rows, attr); + ri->ri_eraserows(ri, 0, ri->ri_rows, scr->rs_defattr); ri->ri_active = scr; ri->ri_active->rs_visible = 1; ri->ri_active->rs_visibleoffset = ri->ri_active->rs_dispoffset; @@ -1906,7 +1907,6 @@ rasops_scrollback(void *v, void *cookie, struct rasops_info *ri = v; struct rasops_screen *scr = cookie; int row, col, oldvoff; - long attr; oldvoff = scr->rs_visibleoffset; @@ -1927,7 +1927,7 @@ rasops_scrollback(void *v, void *cookie, return; rasops_cursor(ri, 0, 0, 0); - ri->ri_eraserows(ri, 0, ri->ri_rows, attr); + ri->ri_eraserows(ri, 0, ri->ri_rows, scr->rs_defattr); for (row = 0; row < ri->ri_rows; row++) { for (col = 0; col < ri->ri_cols; col++) { int off = row * scr->rs_ri->ri_cols + col +