GeezerVison is showing github.com — readline: rename `deDupeHistory` option · nodejs/node@e9f33e3
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file 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 number | Diff line number | Diff line change |
|---|
@@ -363,9 +363,9 @@ added: v0.1.98 | 363 | 363 | `crlfDelay` milliseconds, both `\r` and `\n` will be treated as separate | 364 | 364 | end-of-line input. Default to `100` milliseconds. | 365 | 365 | `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`. | 369 | 369 |
| 370 | 370 | The `readline.createInterface()` method creates a new `readline.Interface` | 371 | 371 | instance. | |
Collapse file Copy file name to clipboardExpand all lines: lib/readline.js +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -39,7 +39,7 @@ function Interface(input, output, completer, terminal) { | 39 | 39 |
| 40 | 40 | EventEmitter.call(this); | 41 | 41 | var historySize; | 42 | | - var deDupeHistory = false; | | 42 | + var removeHistoryDuplicates = false; | 43 | 43 | let crlfDelay; | 44 | 44 | let prompt = '> '; | 45 | 45 |
| @@ -49,7 +49,7 @@ function Interface(input, output, completer, terminal) { | 49 | 49 | completer = input.completer; | 50 | 50 | terminal = input.terminal; | 51 | 51 | historySize = input.historySize; | 52 | | - deDupeHistory = input.deDupeHistory; | | 52 | + removeHistoryDuplicates = input.removeHistoryDuplicates; | 53 | 53 | if (input.prompt !== undefined) { | 54 | 54 | prompt = input.prompt; | 55 | 55 | } | @@ -82,7 +82,7 @@ function Interface(input, output, completer, terminal) { | 82 | 82 | this.output = output; | 83 | 83 | this.input = input; | 84 | 84 | this.historySize = historySize; | 85 | | - this.deDupeHistory = !!deDupeHistory; | | 85 | + this.removeHistoryDuplicates = !!removeHistoryDuplicates; | 86 | 86 | this.crlfDelay = Math.max(kMincrlfDelay, | 87 | 87 | Math.min(kMaxcrlfDelay, crlfDelay >>> 0)); | 88 | 88 |
| @@ -252,7 +252,7 @@ Interface.prototype._addHistory = function() { | 252 | 252 | if (this.line.trim().length === 0) return this.line; | 253 | 253 |
| 254 | 254 | if (this.history.length === 0 || this.history[0] !== this.line) { | 255 | | - if (this.deDupeHistory) { | | 255 | + if (this.removeHistoryDuplicates) { | 256 | 256 | // Remove older history line if identical to new one | 257 | 257 | const dupIndex = this.history.indexOf(this.line); | 258 | 258 | if (dupIndex !== -1) this.history.splice(dupIndex, 1); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-readline-interface.js +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -303,14 +303,14 @@ function isWarned(emitter) { | 303 | 303 | return false; | 304 | 304 | }); | 305 | 305 |
| 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` | 308 | 308 | fi = new FakeInput(); | 309 | 309 | rli = new readline.Interface({ | 310 | 310 | input: fi, | 311 | 311 | output: fi, | 312 | 312 | terminal: true, | 313 | | - deDupeHistory: true | | 313 | + removeHistoryDuplicates: true | 314 | 314 | }); | 315 | 315 | expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat']; | 316 | 316 | callCount = 0; | @@ -333,14 +333,14 @@ function isWarned(emitter) { | 333 | 333 | assert.strictEqual(callCount, 0); | 334 | 334 | rli.close(); | 335 | 335 |
| 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` | 338 | 338 | fi = new FakeInput(); | 339 | 339 | rli = new readline.Interface({ | 340 | 340 | input: fi, | 341 | 341 | output: fi, | 342 | 342 | terminal: true, | 343 | | - deDupeHistory: false | | 343 | + removeHistoryDuplicates: false | 344 | 344 | }); | 345 | 345 | expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat']; | 346 | 346 | callCount = 0; | |
|