Skip to content

Commit 012c9e3

Browse files
author
afffsdd
committed
Fix file navigation typing issues
When you type in the navigation pane it just selects the quick search bar. (party)
1 parent 7740ae1 commit 012c9e3

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
*
4949
* @author Konloch
5050
* @author WaterWolf
51+
* @author afffsdd
5152
*
5253
*/
5354

@@ -64,6 +65,7 @@ public class FileNavigationPane extends VisibleComponent implements
6465
MyTree tree = new MyTree(treeRoot);
6566
final String quickSearchText = "Quick file search (no file extension)";
6667
final JTextField quickSearch = new JTextField(quickSearchText);
68+
boolean cancel = false;
6769

6870
public KeyAdapter search = new KeyAdapter() {
6971
@Override
@@ -191,6 +193,10 @@ public void mousePressed(MouseEvent e) {
191193
this.tree.addTreeSelectionListener(new TreeSelectionListener() {
192194
@Override
193195
public void valueChanged(final TreeSelectionEvent arg0) {
196+
if (cancel) {
197+
cancel = false;
198+
return;
199+
}
194200
openPath(arg0.getPath());
195201
}
196202
});
@@ -203,11 +209,24 @@ public void keyReleased(KeyEvent arg0) {
203209
MyTree tree = (MyTree) arg0.getSource();
204210
openPath(tree.getSelectionPath());
205211
}
212+
} else {
213+
cancel = true;
206214
}
207215
}
208216

209-
@Override public void keyPressed(KeyEvent arg0) { }
210-
@Override public void keyTyped(KeyEvent arg0) { }
217+
@Override
218+
public void keyTyped(KeyEvent e) {
219+
quickSearch.grabFocus();
220+
quickSearch.setText("" + e.getKeyChar()); // fuck
221+
cancel = true;
222+
}
223+
224+
@Override
225+
public void keyPressed(KeyEvent e) {
226+
quickSearch.grabFocus();
227+
quickSearch.setText("" + e.getKeyChar()); // fuck
228+
cancel = true;
229+
}
211230
});
212231

213232
quickSearch.addKeyListener(search);

0 commit comments

Comments
 (0)