GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — readline: rename `deDupeHistory` option · nodejs/node@e9f33e3

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • readline.md
  • lib
    • readline.js
  • test/parallel
    • test-readline-interface.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/readline.md‎

Copy file name to clipboardExpand all lines: doc/api/readline.md
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ added: v0.1.98
363363
`crlfDelay` milliseconds, both `\r` and `\n` will be treated as separate
364364
end-of-line input. Default to `100` milliseconds.
365365
`crlfDelay` will be coerced to `[100, 2000]` range.
366-
* `deDupeHistory` {boolean} If `true`, when a new input line added to the
367-
history list duplicates an older one, this removes the older line from the
368-
list. Defaults to `false`.
366+
* `removeHistoryDuplicates` {boolean} If `true`, when a new input line added
367+
to the history list duplicates an older one, this removes the older line
368+
from the list. Defaults to `false`.
369369

370370
The `readline.createInterface()` method creates a new `readline.Interface`
371371
instance.
Collapse file

‎lib/readline.js‎

Copy file name to clipboardExpand all lines: lib/readline.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function Interface(input, output, completer, terminal) {
3939

4040
EventEmitter.call(this);
4141
var historySize;
42-
var deDupeHistory = false;
42+
var removeHistoryDuplicates = false;
4343
let crlfDelay;
4444
let prompt = '> ';
4545

@@ -49,7 +49,7 @@ function Interface(input, output, completer, terminal) {
4949
completer = input.completer;
5050
terminal = input.terminal;
5151
historySize = input.historySize;
52-
deDupeHistory = input.deDupeHistory;
52+
removeHistoryDuplicates = input.removeHistoryDuplicates;
5353
if (input.prompt !== undefined) {
5454
prompt = input.prompt;
5555
}
@@ -82,7 +82,7 @@ function Interface(input, output, completer, terminal) {
8282
this.output = output;
8383
this.input = input;
8484
this.historySize = historySize;
85-
this.deDupeHistory = !!deDupeHistory;
85+
this.removeHistoryDuplicates = !!removeHistoryDuplicates;
8686
this.crlfDelay = Math.max(kMincrlfDelay,
8787
Math.min(kMaxcrlfDelay, crlfDelay >>> 0));
8888

@@ -252,7 +252,7 @@ Interface.prototype._addHistory = function() {
252252
if (this.line.trim().length === 0) return this.line;
253253

254254
if (this.history.length === 0 || this.history[0] !== this.line) {
255-
if (this.deDupeHistory) {
255+
if (this.removeHistoryDuplicates) {
256256
// Remove older history line if identical to new one
257257
const dupIndex = this.history.indexOf(this.line);
258258
if (dupIndex !== -1) this.history.splice(dupIndex, 1);
Collapse file

‎test/parallel/test-readline-interface.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-readline-interface.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,14 @@ function isWarned(emitter) {
303303
return false;
304304
});
305305

306-
// duplicate lines are removed from history when `options.deDupeHistory`
307-
// is `true`
306+
// duplicate lines are removed from history when
307+
// `options.removeHistoryDuplicates` is `true`
308308
fi = new FakeInput();
309309
rli = new readline.Interface({
310310
input: fi,
311311
output: fi,
312312
terminal: true,
313-
deDupeHistory: true
313+
removeHistoryDuplicates: true
314314
});
315315
expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat'];
316316
callCount = 0;
@@ -333,14 +333,14 @@ function isWarned(emitter) {
333333
assert.strictEqual(callCount, 0);
334334
rli.close();
335335

336-
// duplicate lines are not removed from history when `options.deDupeHistory`
337-
// is `false`
336+
// duplicate lines are not removed from history when
337+
// `options.removeHistoryDuplicates` is `false`
338338
fi = new FakeInput();
339339
rli = new readline.Interface({
340340
input: fi,
341341
output: fi,
342342
terminal: true,
343-
deDupeHistory: false
343+
removeHistoryDuplicates: false
344344
});
345345
expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat'];
346346
callCount = 0;

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.