Skip to content

Commit

Permalink
Prevent infinite recursion in command tabbing
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git committed Aug 10, 2024
1 parent 2071d20 commit 209a3f9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion play.pokemonshowdown.com/js/client-chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,12 @@
return x.startsWith(prefix);
}).length : prefix != this.tabComplete.prefix);
var isCommandSearch = (text.startsWith('/') && !text.startsWith('//')) || text.startsWith('!');
if (isCommandSearch && shouldSearchCommands) {
var resultsExist = this.tabComplete.lastSearch === text && this.tabComplete.commands;
if (isCommandSearch && shouldSearchCommands && !resultsExist) {
if (this.tabComplete.searchPending) return true; // wait
this.tabComplete.isCommand = true;
this.tabComplete.searchPending = true;
this.tabComplete.lastSearch = text;
var self = this;
app.once('response:cmdsearch', function (data) {
delete self.tabComplete.searchPending;
Expand Down

0 comments on commit 209a3f9

Please sign in to comment.