Commit b6f4e01
readline,repl: add substring based history search
This improves the current history search feature by adding substring
based history search similar to ZSH. In case the `UP` or `DOWN`
buttons are pressed after writing a few characters, the start string
up to the current cursor is used to search the history.
All other history features work exactly as they used to.
PR-URL: #31112
Fixes: #28437
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent d84c394 commit b6f4e01Copy full SHA for b6f4e01
File tree
Expand file treeCollapse file tree
7 files changed
+163
-33
lines changedOpen diff view settings
Filter options
- doc/api
- lib
- internal
- readline
- repl
- test/parallel
Expand file treeCollapse file tree
7 files changed
+163
-33
lines changedOpen diff view settings
Collapse file
+5-4Lines changed: 5 additions & 4 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
29 | 30 | |
30 | 31 | |
31 | 32 | |
|
Collapse file
lib/internal/readline/utils.js
Copy file name to clipboardExpand all lines: lib/internal/readline/utils.js+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
4 | 4 | |
5 | 5 | |
6 | 6 | |
| 7 | + |
7 | 8 | |
8 | 9 | |
9 | 10 | |
| ||
17 | 18 | |
18 | 19 | |
19 | 20 | |
| 21 | + |
20 | 22 | |
21 | 23 | |
22 | 24 | |
| ||
470 | 472 | |
471 | 473 | |
472 | 474 | |
| 475 | + |
473 | 476 | |
474 | 477 | |
475 | 478 | |
|
Collapse file
+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
33 | 33 | |
34 | 34 | |
35 | 35 | |
| 36 | + |
36 | 37 | |
37 | 38 | |
38 | 39 | |
| ||
646 | 647 | |
647 | 648 | |
648 | 649 | |
| 650 | + |
649 | 651 | |
650 | 652 | |
651 | 653 | |
|
Collapse file
+49-16Lines changed: 49 additions & 16 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
54 | 54 | |
55 | 55 | |
56 | 56 | |
| 57 | + |
57 | 58 | |
58 | 59 | |
59 | 60 | |
| ||
153 | 154 | |
154 | 155 | |
155 | 156 | |
| 157 | + |
156 | 158 | |
157 | 159 | |
158 | 160 | |
| ||
688 | 690 | |
689 | 691 | |
690 | 692 | |
691 | | - |
| 693 | + |
| 694 | + |
| 695 | + |
| 696 | + |
| 697 | + |
| 698 | + |
| 699 | + |
692 | 700 | |
693 | | - |
694 | | - |
695 | | - |
| 701 | + |
| 702 | + |
| 703 | + |
| 704 | + |
| 705 | + |
| 706 | + |
| 707 | + |
| 708 | + |
| 709 | + |
| 710 | + |
| 711 | + |
| 712 | + |
| 713 | + |
696 | 714 | |
697 | 715 | |
698 | | - |
699 | | - |
700 | | - |
701 | | - |
702 | | - |
703 | | - |
704 | 716 | |
705 | 717 | |
706 | 718 | |
707 | | - |
708 | 719 | |
709 | | - |
710 | | - |
711 | | - |
| 720 | + |
| 721 | + |
| 722 | + |
| 723 | + |
| 724 | + |
| 725 | + |
| 726 | + |
| 727 | + |
| 728 | + |
| 729 | + |
| 730 | + |
| 731 | + |
| 732 | + |
712 | 733 | |
713 | | - |
714 | 734 | |
715 | 735 | |
716 | 736 | |
717 | 737 | |
718 | | - |
719 | 738 | |
720 | 739 | |
721 | 740 | |
| ||
856 | 875 | |
857 | 876 | |
858 | 877 | |
| 878 | + |
| 879 | + |
| 880 | + |
| 881 | + |
| 882 | + |
| 883 | + |
| 884 | + |
| 885 | + |
| 886 | + |
| 887 | + |
| 888 | + |
| 889 | + |
| 890 | + |
| 891 | + |
859 | 892 | |
860 | 893 | |
861 | 894 | |
|
Collapse file
test/parallel/test-readline-interface.js
Copy file name to clipboardExpand all lines: test/parallel/test-readline-interface.js+34-2Lines changed: 34 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
430 | 430 | |
431 | 431 | |
432 | 432 | |
| 433 | + |
433 | 434 | |
434 | 435 | |
435 | 436 | |
| ||
450 | 451 | |
451 | 452 | |
452 | 453 | |
| 454 | + |
453 | 455 | |
454 | 456 | |
| 457 | + |
| 458 | + |
| 459 | + |
| 460 | + |
| 461 | + |
455 | 462 | |
456 | 463 | |
457 | | - |
458 | | - |
| 464 | + |
| 465 | + |
| 466 | + |
| 467 | + |
| 468 | + |
| 469 | + |
| 470 | + |
| 471 | + |
| 472 | + |
| 473 | + |
| 474 | + |
| 475 | + |
| 476 | + |
| 477 | + |
| 478 | + |
| 479 | + |
| 480 | + |
| 481 | + |
| 482 | + |
| 483 | + |
| 484 | + |
| 485 | + |
| 486 | + |
| 487 | + |
| 488 | + |
| 489 | + |
| 490 | + |
459 | 491 | |
460 | 492 | |
461 | 493 | |
|
Collapse file
test/parallel/test-repl-history-navigation.js
Copy file name to clipboardExpand all lines: test/parallel/test-repl-history-navigation.js+66-7Lines changed: 66 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
78 | 78 | |
79 | 79 | |
80 | 80 | |
| 81 | + |
81 | 82 | |
82 | 83 | |
83 | 84 | |
| ||
102 | 103 | |
103 | 104 | |
104 | 105 | |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
105 | 152 | |
106 | 153 | |
107 | 154 | |
| ||
190 | 237 | |
191 | 238 | |
192 | 239 | |
193 | | - |
| 240 | + |
194 | 241 | |
195 | 242 | |
196 | 243 | |
| ||
259 | 306 | |
260 | 307 | |
261 | 308 | |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
262 | 314 | |
263 | 315 | |
264 | 316 | |
| ||
300 | 352 | |
301 | 353 | |
302 | 354 | |
| 355 | + |
303 | 356 | |
304 | 357 | |
305 | 358 | |
| ||
330 | 383 | |
331 | 384 | |
332 | 385 | |
333 | | - |
334 | 386 | |
| 387 | + |
335 | 388 | |
336 | 389 | |
337 | 390 | |
| ||
344 | 397 | |
345 | 398 | |
346 | 399 | |
347 | | - |
| 400 | + |
348 | 401 | |
349 | | - |
| 402 | + |
350 | 403 | |
351 | | - |
| 404 | + |
352 | 405 | |
353 | 406 | |
354 | 407 | |
355 | 408 | |
356 | 409 | |
357 | 410 | |
358 | 411 | |
359 | | - |
| 412 | + |
| 413 | + |
360 | 414 | |
361 | 415 | |
362 | 416 | |
| ||
365 | 419 | |
366 | 420 | |
367 | 421 | |
| 422 | + |
368 | 423 | |
369 | 424 | |
370 | 425 | |
| ||
376 | 431 | |
377 | 432 | |
378 | 433 | |
379 | | - |
| 434 | + |
| 435 | + |
| 436 | + |
| 437 | + |
380 | 438 | |
381 | 439 | |
| 440 | + |
382 | 441 | |
383 | 442 | |
384 | 443 | |
|
Collapse file
test/parallel/test-repl-reverse-search.js
Copy file name to clipboardExpand all lines: test/parallel/test-repl-reverse-search.js+4-4Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
309 | 309 | |
310 | 310 | |
311 | 311 | |
312 | | - |
| 312 | + |
313 | 313 | |
314 | | - |
315 | | - |
| 314 | + |
316 | 315 | |
317 | 316 | |
318 | 317 | |
| ||
342 | 341 | |
343 | 342 | |
344 | 343 | |
345 | | - |
| 344 | + |
| 345 | + |
346 | 346 | |
347 | 347 | |
348 | 348 | |
|
0 commit comments