Skip to content

TailTipWidget issues #665

@krzsal

Description

@krzsal

Hi,
When using Windows Command Prompt od Power Shell with TailTipWidget I have following issues:

  1. On the start the prompt is reprinted in previous line and cursor is there also.
    backed_prompt
    This behaviour is not visible in gitbash(windows) or unix terminal. Without TailTips enabled everything is ok.
    regular_prompt
  2. The after-cursor suggestion when very long, the typing that causes new line break makes suggestion to start loosing characters in new line. However hitting onec "backspace" will fix the suggestion.
    long_suggestion_broken
    This issue is not visible for xterm terminals.
  3. Having only one suggestion, I would expect that it will disappear when I start typing but it looks like that this one suggestion is further somehow parsed.
    parsing
    parsing_stays

Regarding the code for terminal and reader:

Terminal terminal = TerminalBuilder.builder().system(true)
                    .streams(System.in, System.out).build();
LineReader reader =
                LineReaderBuilder.builder().terminal(terminal).completer(completer)
                        .option(LineReader.Option.BRACKETED_PASTE, false)
                        .build();

and for TailTipWidget:

Map<String, CmdDesc> tailTips = new HashMap<>();
Map<String, List<AttributedString>> widgetOpts = new HashMap<>();
for (String cmd : cmdSyntaxMap.keySet()) { 
/* The cmd variable will be e.g. for ping:
    "[-n|--number <number_of_pings>] [-s|--size <bytes>] [-b|--time_between <seconds|milliseconds>] [-t|--timeout <seconds>] [<address>]"
     or for httpdownload:
    "<url> [-t|--timeout <seconds>]"
     so It will put only one argument (String) per command.
*/
    tailTips.put(cmd, new CmdDesc(Arrays.asList(new AttributedString("")), ArgDesc.doArgNames(Arrays.asList(cmdSyntaxMap.get(cmd))), widgetOpts));
}
TailTipWidgets tailtipWidgets = new TailTipWidgets(reader, tailTips, 5, TailTipWidgets.TipType.TAIL_TIP);
tailtipWidgets.enable();

Btw. as you can see the example of the syntax in the code above I have tried to do autocompletion for it but I meet few problems. Is it possible to make completer that will know that argument will have some value (e.g. --timeout someValue) and autocompletion/suggestion will continue after the value?
Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions