@@ -182,13 +182,6 @@ public FindReplace(Editor editor) {
182182 findButton .addActionListener (e -> findNext ());
183183 previousButton .addActionListener (e -> findPrevious ());
184184
185- // you mustn't replace what you haven't found, my son
186- // semantics of replace are "replace the current selection with the replace field"
187- // so whether we have found before or not is irrelevant
188- // replaceButton.setEnabled(false);
189- // replaceFindButton.setEnabled(false);
190-
191- // make the find button the blinky default
192185 getRootPane ().setDefaultButton (findButton );
193186
194187 setDefaultCloseOperation (WindowConstants .DO_NOTHING_ON_CLOSE );
@@ -200,12 +193,10 @@ public void windowClosing(WindowEvent e) {
200193 Toolkit .registerWindowCloseKeys (getRootPane (), actionEvent -> handleClose ());
201194 Toolkit .setIcon (this );
202195
203- // hack to get first field to focus properly on osx
196+ // hack to get first field to focus properly on macOS
204197 addWindowListener (new WindowAdapter () {
205198 public void windowActivated (WindowEvent e ) {
206- //System.out.println("activating");
207- /*boolean ok =*/ findField .requestFocusInWindow ();
208- //System.out.println("got " + ok);
199+ findField .requestFocusInWindow ();
209200 findField .selectAll ();
210201 }
211202 });
@@ -233,13 +224,11 @@ private boolean find(boolean wrap, boolean backwards) {
233224 if (searchTerm .length () != 0 ) {
234225 String text = editor .getText ();
235226
236- // Started work on find/replace across tabs. These two variables store
237- // the original tab and selection position so that it knew when to stop
238- // rotating through.
227+ // Started work on find/replace across tabs. These two variables
228+ // store the original tab and selection position so that it knew
229+ // when to stop rotating through.
239230 Sketch sketch = editor .getSketch ();
240231 int tabIndex = sketch .getCurrentCodeIndex ();
241- // int selIndex = backwards ?
242- // editor.getSelectionStart() : editor.getSelectionStop();
243232
244233 if (ignoreCase ) {
245234 searchTerm = searchTerm .toLowerCase ();
@@ -265,8 +254,9 @@ private boolean find(boolean wrap, boolean backwards) {
265254 if (tabIndex == sketch .getCodeCount () - 1 ) {
266255 // System.out.println("wrapping.");
267256 tabIndex = -1 ;
268- } else if (tabIndex == sketch .getCodeCount () - 1 ) {
269- break ;
257+ // removing for 4.1.2, this was never being run, but is it hiding a bug? [fry 230116]
258+ // } else if (tabIndex == sketch.getCodeCount() - 1) {
259+ // break;
270260 }
271261
272262 try {
@@ -317,8 +307,9 @@ private boolean find(boolean wrap, boolean backwards) {
317307 if (tabIndex == 0 ) {
318308 //System.out.println("wrapping.");
319309 tabIndex = sketch .getCodeCount ();
320- } else if (tabIndex == 0 ) {
321- break ;
310+ // removing for 4.1.2, this was never being run, but is it hiding a bug? [fry 230116]
311+ // } else if (tabIndex == 0) {
312+ // break;
322313 }
323314 try {
324315 Document doc = sketch .getCode (tabIndex - 1 ).getDocument ();
0 commit comments