0

I'm writing a cli program which can send messages to users by commands. The messages are complex, consists of one or more single part(s), and each part can be a text, image, emoji, at (@somebody) and etc. To input that message by commands, I made a simple language. Sentences like ${At(...)} Hey! ${Image(...)} will be regarded as a message with 3 elements: [ At(...), Text(' Hey!'), Image(...) ].

I'm adding tab complete support for it. Consider following sitution:

  • User input: ${A· (· represents cursor position), because there's only one type whose name starts with A called At, and it hasn't a no-args constructor, maybe what user want to input is ${At(...)}, so replace ${A to ${At(·)}.
  • User input: ${At(12345L·), because there's only one constructor with one parameter in type At, maybe what user want is to move cursor position to the tail and append one space (${At(12345L) ·)

Are there APIs in JLine (or others cli tools) can change the cursor position like that while pressing tab to complete input command?

CHUANWISE
  • 68
  • 6

0 Answers0