comparison 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
comparison
equal deleted inserted replaced
16785:3d981b47be42 16786:0e75f5412f1e
123 if ([x(k), y(k), button(k)] == [0, 0, -1]) 123 if ([x(k), y(k), button(k)] == [0, 0, -1])
124 ## Mousing not active (no plot yet). 124 ## Mousing not active (no plot yet).
125 break; 125 break;
126 endif 126 endif
127 127
128 if (nargin > 1) 128 if (button(k) == 0x0D || button(k) == 0x0A)
129 ## Input argument n was given => stop when k == n. 129 ## Stop when hitting a RETURN or ENTER key.
130 if (k == n) 130 x(k:end) = [];
131 break; 131 y(k:end) = [];
132 endif 132 button(k:end) = [];
133 else 133 break;
134 ## Input argument n not given => stop when hitting a return key.
135 ## if (button(k) == 0x0D || button(k) == 0x0A)
136 ## ## hit Return or Enter
137 if (button(k) == 0x0D)
138 ## hit Return
139 x(k:end) = [];
140 y(k:end) = [];
141 button(k:end) = [];
142 break;
143 endif
144 endif 134 endif
135 if (nargin > 1 && k == n)
136 ## Input argument n was given, stop when k == n.
137 break;
138 endif
139
145 endwhile 140 endwhile
146 141
147 unwind_protect_cleanup 142 unwind_protect_cleanup
148 if (use_mkfifo) 143 if (use_mkfifo)
149 unlink (gpin_name); 144 unlink (gpin_name);