Index: Completion.java =================================================================== RCS file: /cvs/editor/libsrc/org/netbeans/editor/ext/Completion.java,v retrieving revision 1.19 diff -c -r1.19 Completion.java *** Completion.java 13 May 2002 11:55:48 -0000 1.19 --- Completion.java 10 Jul 2002 11:59:07 -0000 *************** *** 57,62 **** --- 57,64 ---- * would be invalid. */ private CompletionQuery.Result lastResult; + + private boolean keyPressed = false; /** Completion view component displaying the completion help */ private CompletionView view; *************** *** 101,106 **** --- 103,109 ---- docL = new DocumentListener() { public void insertUpdate(DocumentEvent evt) { if (evt.getLength() > 0) { + setKeyPressed(true); invalidateLastResult(); refresh( false ); } *************** *** 108,113 **** --- 111,117 ---- public void removeUpdate(DocumentEvent evt) { if (evt.getLength() > 0) { + setKeyPressed(true); invalidateLastResult(); refresh( false ); } *************** *** 269,274 **** --- 273,286 ---- lastResult = null; } + public synchronized final void setKeyPressed(boolean value) { + keyPressed = true; + } + + public synchronized boolean isKeyPressed() { + return keyPressed; + } + public synchronized Object getSelectedValue() { if (lastResult != null) { int index = getView().getSelectedIndex(); *************** *** 404,410 **** try{ if((caretPos!=-1) && (Utilities.getRowStart(component,component.getCaret().getDot()) != ! Utilities.getRowStart(component,caretPos)) && (caretPos!=component.getCaret().getDot()+1) ){ getJDCPopupPanel().setCompletionVisible(false); caretPos=-1; return; --- 416,422 ---- try{ if((caretPos!=-1) && (Utilities.getRowStart(component,component.getCaret().getDot()) != ! Utilities.getRowStart(component,caretPos)) && ((component.getCaret().getDot()-caretPos)>0)){ getJDCPopupPanel().setCompletionVisible(false); caretPos=-1; return; *************** *** 415,421 **** caretPos = component.getCaret().getDot(); lastResult = getQuery().query( component, caretPos, doc.getSyntaxSupport()); ! SwingUtilities.invokeLater( new Runnable() { public void run() { --- 427,433 ---- caretPos = component.getCaret().getDot(); lastResult = getQuery().query( component, caretPos, doc.getSyntaxSupport()); ! setKeyPressed(false); SwingUtilities.invokeLater( new Runnable() { public void run() { *************** *** 432,439 **** --- 444,454 ---- getJDCPopupPanel().setCompletionVisible(true); } } else { + if (!isKeyPressed()) { getJDCPopupPanel().setCompletionVisible(false); caretPos=-1; + } else + setKeyPressed(false); } } }