Skip to content

Commit

Permalink
fix: avoid navigating hidden completions
Browse files Browse the repository at this point in the history
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
  • Loading branch information
Snehil-Shah committed Jun 28, 2024
1 parent e8e0e9f commit 535986f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/node_modules/@stdlib/repl/lib/completer_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,14 +536,17 @@ setNonEnumerableReadOnly( CompleterEngine.prototype, '_navigateLeft', function n
* @returns {void}
*/
setNonEnumerableReadOnly( CompleterEngine.prototype, '_navigateRight', function navigateRight( data, key ) {
var columns = this._completionColumns();
var rows = this._completionRows( columns );

// If on current line, trigger default behavior and stop navigating...
if ( this._idx === -1 ) {
this._closeCompleter();
this._ttyWrite.call( this._rli, data, key );
return;
}
// If navigating, move ahead an index...
if ( this._idx < this._completionsList.length - 1 ) {
if ( this._idx + 1 < rows * columns ) {
this._idx += 1;
this.updateCompletions();
}
Expand Down

0 comments on commit 535986f

Please sign in to comment.