# HG changeset patch # User John W. Eaton # Date 1627312814 14400 # Node ID 12d77b69df12a8c4d18a4f1d5131bb9bfb148a6a # Parent 4559cdcc45628450cc55615c61eb246d45baf4fa figure: correctly detect "visible" option for existing figure (bug #60969) * figure.m: Fix detection of "visible", "off" option pair. diff -r 4559cdcc4562 -r 12d77b69df12 scripts/plot/util/figure.m --- a/scripts/plot/util/figure.m Sun Jul 25 16:28:44 2021 +0200 +++ b/scripts/plot/util/figure.m Mon Jul 26 11:20:14 2021 -0400 @@ -106,9 +106,17 @@ ## When switching to figure N, make figure visible and on top of stack, ## unless visibility is explicitly switched off. - if (! init_new_figure && ! any (strcmpi (varargin(1:2:end), "visible") - && strcmpi (varargin(2:2:end), "off"))) - set (f, "visible", "on"); + if (! init_new_figure) + vis_on = true; + idx = find (strcmpi (varargin(1:2:end), "visible"), 1) * 2 - 1; + if (! isempty (idx)) + if (idx < numel (varargin) && strcmpi (varargin{idx+1}, "off")) + vis_on = false; + endif + endif + if (vis_on) + set (f, "visible", "on"); + endif __show_figure__ (f); endif