Commit Graph

35 Commits

Author SHA1 Message Date
Thomas O'Dowd d9af567781 Various screen redraw fixes for wide characters, narrow screens etc.
- Don't overwrite existing text on same line as the prompt
- Don't refresh screen when simply appending characters to buffer
- Don't refresh screen unnessarily when pressing enter key
- Handle prompts longer than screen width.
- Fix wide characters in prompt
- Fix screen edge issue when next character is wide.
- Fix screen edge issue for masked characters
- Fix narrow masked characteter, masking wide input
- Fix wide masked character, masking narrow input
- Reworked backspacesequence for index to use same algorithm as used
  for lineedge and reduce the control sequences to 2.
- Reworked cleanup to incorporate initial cursor column position
  and avoid overwriting existing text as well as simplifying the
  control sequences used.
- Fixed double width character detection and updated unit tests
- Handle emoji in text or prompts.
- Implement windows ANSI absolute horizonal position ansi code.
- Get windows cursor position directly and don't send ansi DSR code
- Don't write out empty mask runes
- Cleanup - removed unused hadCLean variable
2023-02-28 11:00:57 +09:00
Thomas O'Dowd 8e4bd417b9
Handle keypad mode cursor key escape sequences. (#203)
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".
2022-05-20 21:29:21 +08:00
mrsinham 9cc74fe5ad Prefill user input (#101)
* Using a fillable stdin reader

* Adding some documentation to the new features
2017-10-02 20:43:15 +08:00
chzyer eef24db1d5 fix terminal data race (#99) 2017-01-25 11:55:32 +08:00
chzyer 6cbc078c57 let stdin cancelable (#72) 2016-09-01 18:13:06 +08:00
chzyer 27fdf0b285 Fix: a backup plan when can't get size of terminal (#71)
* fix (0,0) size

* fix
2016-08-31 23:51:28 +08:00
chzyer 683bf8ff7c Fix #59 , support HOME/END for <Esc>OH/F 2016-06-21 17:53:53 +08:00
chzyer 3ea5940c39 support suspend process (#48)
* support suspend process

* fix suspend in windows

* add comments
2016-04-17 21:05:00 +08:00
chzyer b57eccfd02 add remote mode 2016-03-13 18:32:48 +08:00
Cheney 867002449c refactory 2016-03-05 15:45:42 +08:00
Cheney 21acaf90fd fixed crash if stdin is not a tty (pipe) 2016-02-17 14:08:55 +08:00
Ryan Hileman 05d3fbcc2a add stdin remapping support 2015-12-23 21:54:46 -08:00
Cheney 71e9536f4b add password support 2015-11-20 20:56:42 +08:00
Chzyer ee4d466b62 Merge pull request #17 from michalpristas/master
int63 changed to int32
2015-11-20 17:14:10 +08:00
Pristáš Michal 4bc3b1f4f4 int63 changed to int32 in order to make readline runnable on arm 32bit devices [terminal.go] 2015-11-20 10:09:55 +01:00
Cheney 7a18498f5b treat `Ctrl+D` + EmptyLine = EOF, `Ctrl+C` = ErrInterrupt 2015-11-19 11:55:07 +08:00
Cheney 5ee706df9b only enter raw mode when calling Readline() 2015-11-09 11:20:26 +08:00
Pristáš Michal 391c225c0b delete redundancy char check moved to escapeExKey method 2015-10-26 09:41:48 +01:00
Pristáš Michal 1c411ac48c changes completed 2015-10-23 13:16:45 +02:00
Cheney 79d1bf27b4 add simple vim mode 2015-10-01 22:44:43 +08:00
Cheney bb60b8a58f finish windows support 2015-09-29 23:28:12 +08:00
Cheney 8dc3117d78 add todo: support windows 2015-09-27 11:41:05 +08:00
Cheney d4ceb57901 let stdout/stderr io.Writer configurable 2015-09-27 09:04:50 +08:00
Cheney af66dc48f7 fix Ctrl+C in search mode do not send EOF 2015-09-25 00:49:55 +08:00
Cheney a904b314b8 kickoff ioloop only needs, solved #1 2015-09-25 00:16:49 +08:00
Cheney 4ab9a96399 refactor 2015-09-23 11:46:56 +08:00
Cheney 3b1cf6b8fb add fwd/bck search 2015-09-22 23:01:15 +08:00
Cheney 3f23122fec support save history item 2015-09-22 18:16:24 +08:00
Cheney c9aba7b858 fix deleteword/kill 2015-09-21 22:51:48 +08:00
Cheney 9c65cb7ccf fix runebuffer refresh 2015-09-21 22:27:40 +08:00
Cheney e878807b59 add support for arrow/up/down/left/right 2015-09-21 21:14:05 +08:00
Cheney 772978399e improve history 2015-09-21 21:00:48 +08:00
Cheney c16e43d258 refactor 2015-09-21 13:30:10 +08:00
Cheney 6642cc6506 support history 2015-09-21 13:14:10 +08:00
Cheney 740e90a464 init commit 2015-09-20 23:14:29 +08:00