readline-listener: fix tab completion to complete from where the pointer is.
parent
61fa05942b
commit
2f4573b6f4
|
@ -39,7 +39,7 @@ M: readline-reader prompt.
|
||||||
|
|
||||||
: get-completions ( prefix -- completions )
|
: get-completions ( prefix -- completions )
|
||||||
completions tget [ nip ] [
|
completions tget [ nip ] [
|
||||||
current-line " \r\n" split {
|
completion-line " \r\n" split {
|
||||||
{ [ dup complete-vocab? ] [ drop prefixed-vocabs ] }
|
{ [ dup complete-vocab? ] [ drop prefixed-vocabs ] }
|
||||||
{ [ dup complete-CHAR:? ] [ drop prefixed-chars ] }
|
{ [ dup complete-CHAR:? ] [ drop prefixed-chars ] }
|
||||||
{ [ dup complete-COLOR:? ] [ drop prefixed-colors ] }
|
{ [ dup complete-COLOR:? ] [ drop prefixed-colors ] }
|
||||||
|
|
|
@ -18,6 +18,9 @@ IN: readline
|
||||||
: current-line ( -- str )
|
: current-line ( -- str )
|
||||||
readline.ffi:rl_line_buffer ;
|
readline.ffi:rl_line_buffer ;
|
||||||
|
|
||||||
|
: completion-line ( -- str )
|
||||||
|
current-line readline.ffi:rl_point head ;
|
||||||
|
|
||||||
: has-readline? ( -- ? )
|
: has-readline? ( -- ? )
|
||||||
"readline" dup load-library dlsym-raw >boolean ;
|
"readline" dup load-library dlsym-raw >boolean ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue