@@ -233,6 +233,8 @@ coverage.index_ready = function ($) {
233233
234234// -- pyfile stuff --
235235
236+ coverage . LINE_FILTERS_STORAGE = "COVERAGE_LINE_FILTERS" ;
237+
236238coverage . pyfile_ready = function ( $ ) {
237239 // If we're directed to a particular line number, highlight the line.
238240 var frag = location . hash ;
@@ -256,6 +258,22 @@ coverage.pyfile_ready = function ($) {
256258 $ ( ".button_toggle_mis" ) . click ( function ( evt ) { coverage . toggle_lines ( evt . target , "mis" ) ; } ) ;
257259 $ ( ".button_toggle_par" ) . click ( function ( evt ) { coverage . toggle_lines ( evt . target , "par" ) ; } ) ;
258260
261+ coverage . filters = undefined ;
262+ try {
263+ coverage . filters = localStorage . getItem ( coverage . LINE_FILTERS_STORAGE ) ;
264+ } catch ( err ) { }
265+
266+ if ( coverage . filters ) {
267+ coverage . filters = JSON . parse ( coverage . filters ) ;
268+ }
269+ else {
270+ coverage . filters = { run : false , exc : true , mis : true , par : true } ;
271+ }
272+
273+ for ( cls in coverage . filters ) {
274+ coverage . set_line_visibilty ( cls , coverage . filters [ cls ] ) ;
275+ }
276+
259277 coverage . assign_shortkeys ( ) ;
260278 coverage . wire_up_help_panel ( ) ;
261279
@@ -266,17 +284,26 @@ coverage.pyfile_ready = function ($) {
266284} ;
267285
268286coverage . toggle_lines = function ( btn , cls ) {
269- btn = $ ( btn ) ;
270- var show = "show_" + cls ;
271- if ( btn . hasClass ( show ) ) {
272- $ ( "#source ." + cls ) . removeClass ( show ) ;
273- btn . removeClass ( show ) ;
274- }
275- else {
287+ var onoff = ! $ ( btn ) . hasClass ( "show_" + cls ) ;
288+ coverage . set_line_visibilty ( cls , onoff ) ;
289+ coverage . build_scroll_markers ( ) ;
290+ coverage . filters [ cls ] = onoff ;
291+ try {
292+ localStorage . setItem ( coverage . LINE_FILTERS_STORAGE , JSON . stringify ( coverage . filters ) ) ;
293+ } catch ( err ) { }
294+ } ;
295+
296+ coverage . set_line_visibilty = function ( cls , onoff ) {
297+ var show = "show_" + cls ;
298+ var btn = $ ( ".button_toggle_" + cls ) ;
299+ if ( onoff ) {
276300 $ ( "#source ." + cls ) . addClass ( show ) ;
277301 btn . addClass ( show ) ;
278302 }
279- coverage . build_scroll_markers ( ) ;
303+ else {
304+ $ ( "#source ." + cls ) . removeClass ( show ) ;
305+ btn . removeClass ( show ) ;
306+ }
280307} ;
281308
282309// Return the nth line div.
0 commit comments