summaryrefslogtreecommitdiff
path: root/lib/readline.js
Commit message (Collapse)AuthorAgeFilesLines
* repl: Private Buffer object in lib/* filesEmmanuel Odeke2014-10-251-0/+1
| | | | | | | | | | | Fixes usage of global object 'Buffer' in lib/* files by ensuring that each file does an explicit require('buffer').Buffer. Previously, when running a repl, due to usage of global 'Buffer', any redefinition of Buffer would cause a crash eg var Buffer = {}. Fixes: https://github.com/joyent/node/issues/8588 PR-URL: https://github.com/joyent/node/pull/8603 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* readline: handle input starting with control charsEric Schrock2013-09-231-1/+1
| | | | | Handle control characters only when there is a single byte in the stream, otherwise fall through to the standard multibyte handling.
* readline: pause stdin before turning off terminal raw modeDaniel Chatfield2013-08-171-1/+1
| | | | | | | | | | | | | | | | | | | On windows, libuv will immediately make a `ReadConsole` call (in the thread pool) when a 'flowing' `uv_tty_t` handle is switched to line-buffered mode. That causes an immediate issue for some users, since libuv can't cancel the `ReadConsole` operation on Windows 8 / Server 2012 and up if the program switches back to raw mode later. But even if this will be fixed in libuv at some point, it's better to avoid the overhead of starting work in the thread pool and immediately cancelling it afther that. See also f34f1e3, where the same change is made for the opposite flow, e.g. move `resume()` after `_setRawMode(true)`. Fixes #5927 This is a backport of dfb0461 (see #5930) to the v0.10 branch.
* readline: make `ctrl + L` clear the screenYuan Chuan2013-06-171-0/+6
|
* events: add check for listeners lengthTrevor Norris2013-03-011-4/+4
| | | | | | Ability to return just the length of listeners for a given type, using EventEmitter.listenerCount(emitter, event). This will be a lot cheaper than creating a copy of the listeners array just to check its length.
* lintisaacs2013-01-291-1/+1
|
* readline: treat bare \r as a line endingisaacs2013-01-291-4/+26
| | | | Fixes #3305
* readline: make \r\n emit one 'line' eventBen Noordhuis2013-01-291-3/+8
| | | | | | | | | Make lines ending \r\n emit one 'line' event, not two (where the second one is an empty string). This adds a new keypress name: 'return' (as in: 'carriage return'). Fixes #3305.
* readline: use a "string_decoder" to parse "keypress" eventsNathan Rajlich2012-11-061-3/+5
| | | | | | | While updating the readline test cases to test both "terimal: false" and "terminal: true" mode, it turned out that the test case testing utf8 chars being sent over multiple write() calls was failing. The solution is to use a string_decoder instance when parsing the "keypress" events.
* readline: don't emit "line" events with a trailing '\n' charNathan Rajlich2012-11-061-1/+1
| | | | | | | | | | Before this commit, readline was inconsistent in whether or not it would emit "line" events with or without the trailing "\n" included. When "terminal" mode was true, then there would be no "\n", when it was false, then the "\n" would be present. However, the trailing "\n" doesn't add much, and most of the time people just end up stripping it manually. Part of #4243.
* repl: call resume() after setRawMode()Bert Belder2012-10-241-1/+2
| | | | Solves #4178, but does not fix the underlying issue
* Merge remote-tracking branch 'ry/v0.8'isaacs2012-07-261-10/+26
|\ | | | | | | | | | | | | Conflicts: AUTHORS ChangeLog src/node_version.h
| * readline: Remove event listeners on closeisaacs2012-07-241-10/+26
| | | | | | | | Fix #3756
* | Merge remote-tracking branch 'ry/v0.8' into v0.8-mergeisaacs2012-07-111-29/+28
|\ \ | |/ | | | | | | Conflicts: src/node_version.h
| * readline: don't use Function#call()Nathan Rajlich2012-07-061-4/+3
| | | | | | | | It wasn't necessary.
| * Forgotten commit: add arguments to handleGroupJonas Westerlund2012-07-061-3/+3
| |
| * Move function declaration to top-levelJonas Westerlund2012-07-061-28/+28
| | | | | | | | Gets rid of a strict mode error and a few levels of indentation.
| * readline: fix for unicode promptsTim Macfarlane2012-07-061-1/+1
| | | | | | | | prompt length is char length, not byte length
* | readline: Use one history item for reentered lineVladimir Beloborodov2012-07-051-4/+6
|/ | | | | If the command entered is exactly the same as the last history item, don't dupe it in the history
* domain: the EventEmitter constructor is now always called in nodecoreAndreas Madsen2012-06-151-2/+2
|
* readline: don't cache the "keypress" listenersNathan Rajlich2012-06-141-4/+2
| | | | | it's not safe to since `removeAllListeners()` will detach the returned Array from the stream instance if that's ever called by the user.
* lintisaacs2012-06-111-3/+4
|
* readline: explicitly disable and re-enable "raw mode" on Ctrl+ZNathan Rajlich2012-05-211-0/+5
| | | | Fixes #3295.
* readline: move the "setRawMode" logic into a private functionNathan Rajlich2012-05-211-6/+9
|
* readline: remove unused vars in _ttyWriteKyle Robinson Young2012-04-211-1/+0
|
* readline: _normalWrite() doesn't take a key modifier argKyle Robinson Young2012-04-181-1/+1
|
* readline: change char to ch to avoid reserved wordKyle Robinson Young2012-04-181-4/+4
|
* readline: re-add the Interface#close() method; rename "end" to "close"Nathan Rajlich2012-04-171-13/+17
| | | | | | | | | | | The idea here is to reduce the number of times that `setRawMode()` is called on the `input` stream, since it is expensive, and simply pause()/resume() should not call it. So now `setRawMode()` only gets called at the beginning of the Interface instance, and then when `Interface#close()` is called. Test case included.
* readline: use StringDecoder for decoding "normal" dataNathan Rajlich2012-04-061-8/+15
| | | | The fix from #3059 was not handling multi-byte utf8 data properly.
* readline: buffer data to only emit 'line' on '\n'Nathan Friedly2012-04-061-4/+15
| | | | | | | | | | | | | In "terminal: false" mode. (And fire it multiple times if multiple lines arrive at once.) This is necessary because the Windows telnet client sends every single keystroke as it's typed. See: http://stackoverflow.com/questions/9962197/node-js-readline-not-waiting-for-a-full-line-on-socket-connections Closes #3059.
* tty, readline: fix style errorsBen Noordhuis2012-03-291-2/+2
|
* repl: make ^D emit an 'end' event on the readline instanceNathan Rajlich2012-03-271-0/+4
| | | | | | Also emit 'exit' on the repl when 'end' is emitted on the readline. Fixes `node debug test/fixtures/breakpoints.js` when ^D is pressed.
* readline: migrate ansi/vt100 logic from tty to readlineNathan Rajlich2012-03-261-40/+394
| | | | | | | | The overall goal here is to make readline more interoperable with other node Streams like say a net.Socket instance, in "terminal" mode. See #2922 for all the details. Closes #2922.
* readline: fix for terminals that insert newlines automaticallyAlex Kocharin2012-03-261-2/+7
| | | | Fixes #2985.
* lint readline.js - single-quotes preferredisaacs2012-03-201-2/+2
|
* readline: row-agnostic multiline readline implementationAlex Kocharin2012-03-201-37/+92
| | | | Fixes #2959.
* Revert "readline: add multiline support"Nathan Rajlich2012-03-201-78/+8
| | | | | | | | This reverts commit 443071db5749603f816199b9ec8bc512fb441d98. Patch was overly compilicated and made some incorrect assumptions about the position of the cursor being at the bottom of the screen. @rlidwka and I are working on getting a proper implementation written.
* readline: ignore stray escape sequenceColton Baker2012-03-071-0/+3
| | | | Fixes #2876.
* readline: add multiline supportRlidwka2012-03-061-8/+78
|
* readline: ^Z (SIGSTP) handlingColton Baker2012-02-221-1/+3
| | | | | | | | | | | | | | Bugfix and update. - Fixed bug where Node's REPL wouldn't continue when returning from ^Z (SIGTSTP) - Removed old readline callback Readline API update with docs. - ^Z (SIGTSTP) is now bypassed on Windows systems. - SIGCONT is now bypassed on Windows systems. - Docs updated to reflect above.
* Readline proposal and bugfixes. Related: #2737 #2756Colton Baker2012-02-161-32/+29
| | | | | | | | | | | | | | | | | | | - Removed extra newline from .question(); Users can input a newline if it they require it. - Removed .close() due to it only emulating closing, causing a bug where readline is left open to trigger events such as .on('line', ...'). - Removed ._attemptClose() - .pause() now triggers event .on('pause', ...) - .resume() now triggers event .on('resume', ...) - CTRL-C (SIGINT) in readline will now default to .pause() if no SIGINT event is present. - CTRL-D (delete right) will also default to .pause() if there is nothing to delete (signaling the end of the file). - Added new event `SIGTSTP` - Added new event `SIGCONT` - Added `resume` to `write` to resume the stream if paused. - Docs updated. - Updated repl.js
* preserve cursor posFedor Indutny2011-12-191-2/+2
| | | | * configurable via .prompt()'s preserveCursor argument (false by default)
* Fixes #2052. Readline get win cols correctlyRyan Dahl2011-11-081-2/+2
|
* doc: fix linksMaciej Małecki2011-11-011-1/+1
| | | | | | | | | | | Changes: * 'http://github.com' => 'https://github.com' * 'https://github.com/ry/node' => 'https://github.com/joyent/node' * 'https://github.com/ry/http-parser' => 'https://github.com/joyent/http-parser' * old issue links * wiki link
* Fixed a lot of jslint errors.Colton Baker2011-10-051-1/+2
| | | | Fixes #1831
* Bind uv_tty_get_winsizeRyan Dahl2011-09-271-2/+2
|
* readline: handle null completer graciouslyBen Noordhuis2011-09-141-3/+7
| | | | Fixes #1698.
* [debugger] call silent resume in debugEval to prevent incorrect cursor ↵Fedor Indutny2011-09-091-2/+1
| | | | position after repl autocompletion, small refactor in readline
* [repl, readline] refactor async completion and executionFedor Indutny2011-09-091-2/+2
|
* [readline, repl] Fix completion grouping, fix parens eval resultsFedor Indutny2011-09-091-1/+1
| | | | handling