Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: erase lastIndex state for previous searches
  • Loading branch information
Theo-Steiner committed Mar 1, 2023
commit 395054215dc3b053a17ae3955a8cb4902940ad0e
2 changes: 2 additions & 0 deletions lib/internal/readline/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,8 @@ class Interface extends InterfaceConstructor {
// falls through
default:
if (typeof s === 'string' && s) {
// Erase state of previous searches.
lineEnding.lastIndex = 0;
let nextMatch = RegExpPrototypeExec(lineEnding, s);
// If no line endings are found, just insert the string as is.
if (nextMatch === null) {
Expand Down