AutoComplete icon indicating copy to clipboard operation
AutoComplete copied to clipboard

Doesn't work on Linux

Open skylarmt opened this issue 10 years ago • 7 comments

On Windows and Mac, I can press Ctrl-space and get the popup box. On Ubuntu, it doesn't do anything.

skylarmt avatar Feb 26 '15 20:02 skylarmt

I'm using Linux and is working (I use GNOME)

I found a problem that eg when you have a window "Always on Top"

ricardojlrufino avatar Mar 09 '15 02:03 ricardojlrufino

I'm using it inside a JInternalFrame if that makes a difference.

skylarmt avatar Mar 15 '15 01:03 skylarmt

I am also using it on linux (KDE/Ubuntu) and it works with the only glitch (related to RoundrobinAutoCompleter), that when using it fo rthe second time the popup window does not get updated with the current active completer (so it stillshows the old one previousely active while it has already selected the correct entry)

eitzenbe avatar Oct 28 '16 02:10 eitzenbe

Unfortunately I have no access to a Ubuntu box, so pull requests are welcome!

bobbylight avatar Oct 29 '16 03:10 bobbylight

@bobbylight You can run Ubuntu easily from a USB stick or virtual machine.

skylarmt avatar Oct 29 '16 07:10 skylarmt

@bobbylight I analyzed in more detail and found that it also FAILS on Windows. The workaround (due to too high encapsulation policy AKA privte members and fields EVERYWHERE ;) that got it working on BOTH platforms is:

    rrac = new RoundRobinAutoCompletion(p) {

      @Override
      protected int refreshPopupWindow() {
        // Do this once to make sure the popupwindow is instantiated
        int res = super.refreshPopupWindow();
        resetProvider();
        CompletionProvider c0 = getCompletionProvider();
        do {
          advanceProvider();
          if (getCompletionProvider() == c0) {
            if (getCompletionProvider().getCompletions(getTextComponent()).size() == 0) {
              hidePopupWindow();
              return -1;
            } else {
              break;
            }
          }
        } while (getCompletionProvider().getCompletions(getTextComponent()).size() == 0);
        res = super.refreshPopupWindow();
        return res;
      }
    };

in other words your code is missing to analyze which auto completion provider to use as the one to display the possible solutions IF the window is already open. You assume that its always the current one that i fine, steps to reproduce:

Create RRAC with at least TWO Completion Providers, populate one with AA* completions, second one with BB*** Then enter first AA, chose any completion by pressing return NOW enter BB and trigger auto completion and you will only see AA proposals... At least on my Editor ;)

eitzenbe avatar Nov 01 '16 09:11 eitzenbe

RoundRobinAutoCompletion was actually contributed by someone else, and I don't use it. If you want this fixed quicker, pull requests are welcome!

bobbylight avatar Nov 02 '16 02:11 bobbylight