@@ -142,7 +142,7 @@ else if (!isEscapeChar(line, i)) {
142142 }
143143
144144 String openingQuote = quoteStart >= 0 ? line .substring (quoteStart , quoteStart + 1 ) : null ;
145- return new ExtendedArgumentList (line , words , wordIndex , wordCursor , cursor , openingQuote );
145+ return wrap ( new ExtendedArgumentList (line , words , wordIndex , wordCursor , cursor , openingQuote ) );
146146 }
147147
148148 /**
@@ -321,4 +321,46 @@ private boolean isRawQuoteChar(char key) {
321321 return false ;
322322 }
323323
324+ /**
325+ * Another copy from JLine's {@link org.jline.reader.impl.LineReaderImpl}
326+ *
327+ * Used to wrap {@link org.jline.reader.ParsedLine} into {@link org.jline.reader.CompletingParsedLine}
328+ */
329+ private static org .jline .reader .CompletingParsedLine wrap (ParsedLine line ) {
330+ if (line instanceof org .jline .reader .CompletingParsedLine ) {
331+ return (org .jline .reader .CompletingParsedLine ) line ;
332+ }
333+ else {
334+ return new org .jline .reader .CompletingParsedLine () {
335+ public String word () {
336+ return line .word ();
337+ }
338+ public int wordCursor () {
339+ return line .wordCursor ();
340+ }
341+ public int wordIndex () {
342+ return line .wordIndex ();
343+ }
344+ public List <String > words () {
345+ return line .words ();
346+ }
347+ public String line () {
348+ return line .line ();
349+ }
350+ public int cursor () {
351+ return line .cursor ();
352+ }
353+ public CharSequence escape (CharSequence candidate , boolean complete ) {
354+ return candidate ;
355+ }
356+ public int rawWordCursor () {
357+ return wordCursor ();
358+ }
359+ public int rawWordLength () {
360+ return word ().length ();
361+ }
362+ };
363+ }
364+ }
365+
324366}
0 commit comments