Commit 8bd6ab7
readline: add option to stop duplicates in history
Adds `options.deDupeHistory` for `readline.createInterface(options)`. If
`options.deDupeHistory` is `true`, when a new input line being added to
the history list duplicates an older one, removes the older line from
the list. Defaults to `false`.
Many users would appreciate this option, as it is a common setting in
shells. This option certainly should not be default behavior, as it
would be problematic in applications such as the `repl`, which inherits
from the readline `Interface`.
Extends documentation to reflect this API addition.
Adds tests for when `options.deDupeHistory` is truthy, and when
`options.deDupeHistory` is falsey.
PR-URL: #2982
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>1 parent 62a8f47 commit 8bd6ab7Copy full SHA for 8bd6ab7
File tree
Expand file treeCollapse file tree
3 files changed
+73
-0
lines changedOpen diff view settings
Filter options
- doc/api
- lib
- test/parallel
Expand file treeCollapse file tree
3 files changed
+73
-0
lines changedOpen diff view settings
Collapse file
+3Lines changed: 3 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
363 | 363 | |
364 | 364 | |
365 | 365 | |
| 366 | + |
| 367 | + |
| 368 | + |
366 | 369 | |
367 | 370 | |
368 | 371 | |
|
Collapse file
+9Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
39 | 39 | |
40 | 40 | |
41 | 41 | |
| 42 | + |
42 | 43 | |
43 | 44 | |
44 | 45 | |
| ||
48 | 49 | |
49 | 50 | |
50 | 51 | |
| 52 | + |
51 | 53 | |
52 | 54 | |
53 | 55 | |
| ||
80 | 82 | |
81 | 83 | |
82 | 84 | |
| 85 | + |
83 | 86 | |
84 | 87 | |
85 | 88 | |
| ||
249 | 252 | |
250 | 253 | |
251 | 254 | |
| 255 | + |
| 256 | + |
| 257 | + |
| 258 | + |
| 259 | + |
| 260 | + |
252 | 261 | |
253 | 262 | |
254 | 263 | |
|
Collapse file
test/parallel/test-readline-interface.js
Copy file name to clipboardExpand all lines: test/parallel/test-readline-interface.js+61Lines changed: 61 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
303 | 303 | |
304 | 304 | |
305 | 305 | |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
| 315 | + |
| 316 | + |
| 317 | + |
| 318 | + |
| 319 | + |
| 320 | + |
| 321 | + |
| 322 | + |
| 323 | + |
| 324 | + |
| 325 | + |
| 326 | + |
| 327 | + |
| 328 | + |
| 329 | + |
| 330 | + |
| 331 | + |
| 332 | + |
| 333 | + |
| 334 | + |
| 335 | + |
| 336 | + |
| 337 | + |
| 338 | + |
| 339 | + |
| 340 | + |
| 341 | + |
| 342 | + |
| 343 | + |
| 344 | + |
| 345 | + |
| 346 | + |
| 347 | + |
| 348 | + |
| 349 | + |
| 350 | + |
| 351 | + |
| 352 | + |
| 353 | + |
| 354 | + |
| 355 | + |
| 356 | + |
| 357 | + |
| 358 | + |
| 359 | + |
| 360 | + |
| 361 | + |
| 362 | + |
| 363 | + |
| 364 | + |
| 365 | + |
| 366 | + |
306 | 367 | |
307 | 368 | |
308 | 369 | |
|
0 commit comments