Normally the terminal uses CSI escape sequences when the UP, DOWN,
LEFT, RIGHT and HOME, END keys are pressed. These look like the
following ESC [ A etc, where ESC [ is the CSI sequence.
xterm and other terminals however can generate an alternative
escape sequence called SS3 if in the application keypad mode.
This sequence is ESC O A etc.
Bash readline understands both modes so nowadays you rarely
see OA being printed when you press the up arrow while the terminal
is using the keypad mode. readline currently does not understand
these sequences.
To test this fix, I used an xterm and put it in keypad mode
using the command "tput smkx". Then I started the readline-demo
and tried using arrow keys. Without this fix, OA is printed when
I press up. With this fix, readline fetches the previous command
as per regular mode. After testing you can escape back to
regular mode using "tput rmkx".
This commit adds support for AIX operating system.
- move term_solaris.go to term_nosyscall6.go. AIX like solaris doesn't
provide syscall.Syscall6 and must rely on x/sys/unix in order to perform
syscalls.
- This patch won't work with versions prior to 1.13 because it needs
some constants added by https://go-review.googlesource.com/c/go/+/171339.
The display width will not be right if there have Chinese characters in the display. It will overflow the line, if the Chinese characters are at the end of a line. And makes "lines" value not the right number of line rows, which makes "239: fmt.Fprintf" produce wrong output.
* Expose RuneBuffer.Set through Operation's API
This allows a user to prefill a line before the user is given a prompt,
so that you can provide a default, user-editable input line.
* Add a Instance.ReadlineWithDefault API method
This will pre-fill the Operation.RuneBuffer with text before prompting
the user, and provide her with a method to edit the provided default.
* Add support for solaris
* Change state to handle system dependent termios type.
* Move syscalls to get and set termios to functions in files only built
for respective platforms.
* Create `term_unix.go` go file built on all supported unices except
solaris with types and functions valid for all of them.
* Change `MakeRaw` to set VMIN and VTIME to default values.
Fixes#95.
* Fix error handling
Doing the string comparison could be improved, but at least we should
return an error, if it is not "errno 0".
usql is a new project that is making extensive use of readline. usql is
roughly 3 days old, and already has over 1100 stars. This change adds
usql to the README.md and reorders projects listed in the "Repos using
readline" section.
The calculation to determine how many spaces to use when padding
columns wasn't taking into account the length of the 'same' portion of
the completions and was only using the length of the completion
itself. This frequently caused the printed completions to wrap, making
the completion list much harder to read.
It is possible for `opHistory.Rewrite` to be called from
`opHistory.historyUpdatePath`. This is problematic, because both methods
grab a lock, and Mutexes in go are not reentrant. This change pulls out
the logic in Rewrite into `opHistory.rewriteLocked`, and retains the
public facing method.
I updated the switch in vim.go to treat 'w' and 'W' differently to 'e' and 'E'.
I then added a method to runebuf.go to provide the logic for that motion.
tested and working.
* Dynamic autocompletion implemented
Now there is a new item type "PcItemDynamic" which takes function as
parameter.
When it comes to autocomplete at this position, the function is called,
the whole line is given to it (for example if autocompletion depend on
previous autocompleted field) and functio should return possible strings
how to continue.
Example usage:
* listing some dynamic key-value storage
* listing files in directory
* Dynamic autocompletion: Updated example
* Dynamic autocompletion: Internal Do() is passing the original full line
To serve it to dynamic autocompletion functions. Previously passed line
was only following segment (which doesn't work).
* Dynamic autocompletion: New dynamic interface added + type assertion in Do function
Do function was split into doInternal with changed declaration and Do
with original declaration.