bobbylight / RSyntaxTextArea

A syntax highlighting, code folding text editor for Java Swing applications.
BSD 3-Clause "New" or "Revised" License
1.12k stars 259 forks source link

hideOnNoText doesn't seems to work properly : the popup will always reappear with arrow keys #564

Closed olivbrau closed 4 months ago

olivbrau commented 4 months ago

Description I would like that when the popup is visible, and I type ; or space, it disappears. So call setHideOnNoText(true) (via a sub class because the method is protected : should it be public, by the way ?) It works well.

But I would also like that when I move the caret with Left/Right key, the behaviour is the same. For example :

But the popup is still there

I think it is because AutoCompletePopupWindow receive 2 events 1) right arrow -> it calls refreshPopupWindow() as the popup is visible and text.length==0 this method hide it 2) caretUpdate -> it calls refreshPopupWindow() again !! as the popup is not visible, refreshPopupWindow() ignore the flag hideOnNoText and continue and then show the popup ...

To correct this, I think that in the refreshPopupWindow() method : return getLineOfCaret(); shoud be out of the test if (isPopupVisible()) and executed each time (textLen == 0 && isHideOnNoText()) is true

olivbrau commented 4 months ago

sorry, this was for autocomplete, I close it ...