MCPcopy Index your code
hub / github.com/nodejs/node / reset

Function reset

lib/internal/repl/utils.js:682–714  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

680 }
681
682 function reset(string) {
683 isInReverseSearch = string !== undefined;
684
685 // In case the reverse search ends and a history entry is found, reset the
686 // line to the found entry.
687 if (!isInReverseSearch) {
688 if (lastMatch !== -1) {
689 repl[kSetLine](repl.history[lastMatch]);
690 repl.cursor = lastCursor;
691 repl.historyIndex = lastMatch;
692 }
693
694 lastMatch = -1;
695
696 // Clear screen and write the current repl.line before exiting.
697 cursorTo(repl.output, promptPos.cols);
698 moveCursor(repl.output, 0, promptPos.rows);
699 clearScreenDown(repl.output);
700 if (repl.line !== '') {
701 repl.output.write(repl.line);
702 if (repl.line.length !== repl.cursor) {
703 const { cols, rows } = repl.getCursorPos();
704 cursorTo(repl.output, cols);
705 moveCursor(repl.output, 0, rows);
706 }
707 }
708 }
709
710 input = string || '';
711 cursor = -1;
712 historyIndex = repl.historyIndex;
713 alreadyMatched.clear();
714 }
715
716 function reverseSearch(string, key) {
717 if (!isInReverseSearch) {

Callers 1

reverseSearchFunction · 0.70

Calls 6

cursorToFunction · 0.85
moveCursorFunction · 0.85
clearScreenDownFunction · 0.85
getCursorPosMethod · 0.80
clearMethod · 0.65
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…