Mercurial > hg > octave-lyh
diff scripts/plot/private/__gnuplot_ginput__.m @ 16786:0e75f5412f1e
__gnuplot_ginput__.m: Correctly stop early if <RETURN> key pressed (bug #32178).
* scripts/plot/private/__gnuplot_ginput__.m: Check for abort condition
(<RETURN>) before checking whether number of desired inputs has been reached so
that an abort for the last keystroke is not included with the returned buttons.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 20 Jun 2013 12:54:59 -0700 |
parents | 3cce6b4e0f7c |
children |
line wrap: on
line diff
--- a/scripts/plot/private/__gnuplot_ginput__.m +++ b/scripts/plot/private/__gnuplot_ginput__.m @@ -125,23 +125,18 @@ break; endif - if (nargin > 1) - ## Input argument n was given => stop when k == n. - if (k == n) - break; - endif - else - ## Input argument n not given => stop when hitting a return key. - ## if (button(k) == 0x0D || button(k) == 0x0A) - ## ## hit Return or Enter - if (button(k) == 0x0D) - ## hit Return - x(k:end) = []; - y(k:end) = []; - button(k:end) = []; - break; - endif + if (button(k) == 0x0D || button(k) == 0x0A) + ## Stop when hitting a RETURN or ENTER key. + x(k:end) = []; + y(k:end) = []; + button(k:end) = []; + break; endif + if (nargin > 1 && k == n) + ## Input argument n was given, stop when k == n. + break; + endif + endwhile unwind_protect_cleanup