mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-05 13:27:49 +08:00
fixed commandline not reacting correctly to removing/adding '>'. closes #1844
This commit is contained in:
parent
250d8055a2
commit
0512912ded
1 changed files with 12 additions and 12 deletions
|
@ -287,19 +287,19 @@ export function isSingleListCommandLineActive() {
|
|||
return $("#commandLine").hasClass("allCommands");
|
||||
}
|
||||
|
||||
function useSingleListCommandLine(show = true) {
|
||||
function useSingleListCommandLine(sshow = true) {
|
||||
let allCommands = generateSingleListOfCommands();
|
||||
if (Config.singleListCommandLine == "manual") {
|
||||
CommandlineLists.pushCurrent(allCommands);
|
||||
} else if (Config.singleListCommandLine == "on") {
|
||||
CommandlineLists.setCurrent([allCommands]);
|
||||
}
|
||||
// if (Config.singleListCommandLine == "manual") {
|
||||
// CommandlineLists.pushCurrent(allCommands);
|
||||
// } else if (Config.singleListCommandLine == "on") {
|
||||
CommandlineLists.setCurrent([allCommands]);
|
||||
// }
|
||||
if (Config.singleListCommandLine != "off")
|
||||
$("#commandLine").addClass("allCommands");
|
||||
if (show) show();
|
||||
if (sshow) show();
|
||||
}
|
||||
|
||||
function restoreOldCommandLine(show = true) {
|
||||
function restoreOldCommandLine(sshow = true) {
|
||||
if (isSingleListCommandLineActive()) {
|
||||
$("#commandLine").removeClass("allCommands");
|
||||
CommandlineLists.setCurrent(
|
||||
|
@ -308,7 +308,7 @@ function restoreOldCommandLine(show = true) {
|
|||
if (CommandlineLists.current.length < 1)
|
||||
CommandlineLists.setCurrent([CommandlineLists.defaultCommands]);
|
||||
}
|
||||
if (show) show();
|
||||
if (sshow) show();
|
||||
}
|
||||
|
||||
$("#commandLine input").keyup((e) => {
|
||||
|
@ -518,7 +518,7 @@ $(document).keydown((e) => {
|
|||
$("#commandLine input").focus();
|
||||
if (e.key == ">" && Config.singleListCommandLine == "manual") {
|
||||
if (!isSingleListCommandLineActive()) {
|
||||
useSingleListCommandLine();
|
||||
useSingleListCommandLine(false);
|
||||
return;
|
||||
} else if ($("#commandLine input").val() == ">") {
|
||||
//so that it will ignore succeeding ">" when input is already ">"
|
||||
|
@ -528,11 +528,11 @@ $(document).keydown((e) => {
|
|||
}
|
||||
if (
|
||||
e.key === "Backspace" &&
|
||||
$("#commandLine input").val().length == 1 &&
|
||||
$("#commandLine input").val()[0] == ">" &&
|
||||
Config.singleListCommandLine == "manual" &&
|
||||
isSingleListCommandLineActive()
|
||||
)
|
||||
restoreOldCommandLine();
|
||||
restoreOldCommandLine(false);
|
||||
if (e.key === "Enter") {
|
||||
//enter
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Reference in a new issue