Commit Graph

232 Commits

Author SHA1 Message Date
Edward Betts 045fff973b correct spelling mistake (#127) 2017-10-01 22:57:10 -05:00
Davor Kapsa 8d510b4136 travis: update go version (#128) 2017-10-01 22:55:11 -05:00
Jordan Lewis 01c4e90c35 Bugfix in rewriteHistory (#121)
Previously, rewriteHistory was incorrect - it did not preserve the
newlines between history lines, which corrupts the history file.
2017-10-01 22:53:35 -05:00
Paul Tagliamonte 41eea22f71 Add two API methods to set RuneBuffer state before prompting the user (#105)
* 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.
2017-03-14 07:49:21 +08:00
Gereon Frey 8a1389155f Solaris support (#110)
* 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".
2017-03-13 07:57:45 +08:00
Kenneth Shaw 784bd70fe0 Adding knq/usql to README.md (#107)
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.
2017-03-05 19:31:14 +08:00
Jiří Setnička f892600c35 Ability to filter out input runes (#104)
Could be used to mask/disable some actions (like Ctrl-Z, or searching by
Ctrl-R and Ctrl-S)
2017-02-20 09:51:01 +08:00
chzyer eef24db1d5 fix terminal data race (#99) 2017-01-25 11:55:32 +08:00
Remi Reuvekamp c914be64f0 Fix panic: runtime error: slice bounds out of range (#94)
Reslicing line[10:] went wrong if only 'setprompt' was entered, without a space after.
2016-11-06 12:23:43 +08:00
chzyer 25c2772d5f fix deadlock in cancelable stdin (#89)
* fix deadlock in cancelable stdin

* fix notify back

* [cancelable stdin] fix c.notify
2016-10-06 12:35:07 +08:00
chzyer 94eaec69a7 add HistorySearchFold (#86)
* add HistorySearchFold

* [history] fix test
2016-10-03 14:51:04 +08:00
Ben Browning bc5e387904 Fix column padding calculation to prevent wrapping (#83)
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.
2016-09-29 09:01:11 +08:00
chzyer 283f5429f7 Bugfix/datarace prompt (#81)
* fix data race in PromptLen

* add lock for all operation in RuneBuffer

* add race test

* update travis
2016-09-15 18:11:25 +08:00
chzyer 820d6f2766 fix data race in PromptLen (#80) 2016-09-10 16:03:59 +08:00
chzyer 31ab3eee0c remove unused field 2016-09-04 21:05:21 +08:00
chzyer 6cbf970b0b lazy init CancelableStdin() (#78) 2016-09-04 21:02:24 +08:00
chzyer edfa7c9dbf lazy fire ioloop (#77) 2016-09-04 20:49:14 +08:00
chzyer bc5c91eb5b remove unused files 2016-09-03 11:26:39 +08:00
chzyer f533ef1caa update readme 2016-09-02 22:37:16 +08:00
chzyer 31eb6be473 support insert tag char (#74) 2016-09-02 20:10:31 +08:00
chzyer 4ffff9f41c fix cancelablestdin 2016-09-01 20:01:12 +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
Mehrdad Arshad Rad 8159bd380c mylg added to README->Who is using Readline (#70) 2016-08-24 22:42:54 +08:00
Nathan VanBenschoten a193146c91 Fix deadlock on rewrite of opHistory when history limit is reached (#69)
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.
2016-08-12 10:11:21 +08:00
chzyer c144c8dde4 [readme] update who is using readline 2016-07-29 17:49:00 +08:00
John Cramb a0c5244a21 added fd mutex to prevent data race on history updates with closing the history file (#66) 2016-07-29 11:49:51 +08:00
chzyer 62c6fe6193 update changelog 2016-07-26 21:51:17 +08:00
chzyer c2d777f687 update changelog 2016-07-26 21:49:48 +08:00
aktungmak 47d43db0fd fix #36 vim mode: 'e' moves to the beginning of the next word (#64)
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.
2016-07-26 21:40:22 +08:00
Jiří Setnička cffdf641d1 Dynamic autocompletion (#60)
* 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.
2016-07-26 21:39:09 +08:00
chzyer dc578a10ae [complete] avoid reach end of line in windows 2016-07-26 21:33:15 +08:00
chzyer f83f3269ca [windows] fix ansi parse by remove channel 2016-07-24 00:39:44 +08:00
chzyer 4f0ff8f850 fix windows compile error 2016-07-22 00:40:16 +08:00
chzyer d478c186fd Fix #62: move dependent package "terminal" to "term" (#65) 2016-07-22 00:31:42 +08:00
chzyer 683bf8ff7c Fix #59 , support HOME/END for <Esc>OH/F 2016-06-21 17:53:53 +08:00
chzyer 3717d7c383 [terminal] fix when only stderr is tty (1>/dev/null) 2016-06-21 17:53:53 +08:00
chzyer b411b0f4b2 fixes: flush chars if got io.EOF without '\n' (#58) 2016-06-19 23:06:37 +08:00
chzyer 03625fbce3 [readme] add who is using readline 2016-05-20 16:49:15 +08:00
Steven Oud 92c174e5fb Add ClearScreen operation on Ctrl+L (#56)
* Add ClearScreen operation on Ctrl+L

* Remove TODO from clear screen in readme

* Don't use external command for ClearScreen

* Remove duplicate ClearScreen function
2016-05-16 17:59:35 +08:00
chzyer 64a71f22be [release] 1.3 2016-05-09 21:28:16 +08:00
Ante Kresic dc15d0f641 [completer] Fix bug which causes integer divide by zero panicking when input buffer is empty (#54)
* [completer] Fixes issue #53

* Changing check to candidateSource
2016-05-09 18:10:47 +08:00
Xavier Damman 8fbe9eac1a Added sponsors (#51) 2016-05-04 01:20:02 +08:00
chzyer dc5da28fbf [history] fix bug that check equals with previous command (#49) 2016-04-21 14:10:50 +08:00
chzyer 1e0917c739 fix typo 2016-04-21 10:06:19 +08:00
chzyer fd07ffef1b update README 2016-04-18 11:38:46 +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 52d8a65723 [completer] add SegmentAutoComplete 2016-04-12 14:04:56 +08:00
chzyer de49e7f118 [remote] fix test 2016-04-11 01:54:54 +08:00
chzyer d4c46a49e6 [remote] fix remote 2016-04-11 01:46:08 +08:00