mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-05 15:05:15 +08:00
impr: changing keymap mode will no longer restart the test
This commit is contained in:
parent
85124413eb
commit
897cfde4eb
2 changed files with 23 additions and 15 deletions
|
|
@ -323,7 +323,7 @@ export async function refresh(
|
|||
}
|
||||
}
|
||||
|
||||
ConfigEvent.subscribe((eventKey) => {
|
||||
ConfigEvent.subscribe((eventKey, newValue) => {
|
||||
if (eventKey === "layout" && Config.keymapLayout === "overrideSync") {
|
||||
refresh(Config.keymapLayout);
|
||||
}
|
||||
|
|
@ -335,6 +335,9 @@ ConfigEvent.subscribe((eventKey) => {
|
|||
) {
|
||||
refresh();
|
||||
}
|
||||
if (eventKey === "keymapMode") {
|
||||
newValue === "off" ? hide() : show();
|
||||
}
|
||||
});
|
||||
|
||||
KeymapEvent.subscribe((mode, key, correct) => {
|
||||
|
|
|
|||
|
|
@ -344,13 +344,10 @@ export function restart(options = {} as RestartOptions): void {
|
|||
TestUI.showWords();
|
||||
if (Config.keymapMode === "next" && Config.mode !== "zen") {
|
||||
KeymapEvent.highlight(
|
||||
TestWords.words
|
||||
.getCurrent()
|
||||
.substring(
|
||||
TestInput.input.current.length,
|
||||
TestInput.input.current.length + 1
|
||||
)
|
||||
.toString()
|
||||
Misc.nthElementFromArray(
|
||||
[...TestWords.words.getCurrent()],
|
||||
0
|
||||
) as string
|
||||
);
|
||||
}
|
||||
Funbox.toggleScript(TestWords.words.getCurrent());
|
||||
|
|
@ -361,12 +358,6 @@ export function restart(options = {} as RestartOptions): void {
|
|||
TestState.setRepeated(false);
|
||||
}
|
||||
|
||||
if (Config.keymapMode !== "off") {
|
||||
Keymap.show();
|
||||
} else {
|
||||
Keymap.hide();
|
||||
}
|
||||
|
||||
for (const f of FunboxList.get(Config.funbox)) {
|
||||
if (f.functions?.restart) f.functions.restart();
|
||||
}
|
||||
|
|
@ -1519,7 +1510,6 @@ ConfigEvent.subscribe((eventKey, eventValue, nosave) => {
|
|||
if (ActivePage.get() === "test") {
|
||||
if (eventKey === "difficulty" && !nosave) restart();
|
||||
if (eventKey === "showAllLines" && !nosave) restart();
|
||||
if (eventKey === "keymapMode" && !nosave) restart();
|
||||
if (eventKey === "tapeMode" && !nosave) restart();
|
||||
if (
|
||||
eventKey === "customLayoutFluid" &&
|
||||
|
|
@ -1527,6 +1517,21 @@ ConfigEvent.subscribe((eventKey, eventValue, nosave) => {
|
|||
) {
|
||||
restart();
|
||||
}
|
||||
|
||||
if (
|
||||
eventKey === "keymapMode" &&
|
||||
eventValue === "next" &&
|
||||
Config.mode !== "zen"
|
||||
) {
|
||||
setTimeout(() => {
|
||||
KeymapEvent.highlight(
|
||||
Misc.nthElementFromArray(
|
||||
[...TestWords.words.getCurrent()],
|
||||
0
|
||||
) as string
|
||||
);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
if (eventKey === "lazyMode" && eventValue === false && !nosave) {
|
||||
rememberLazyMode = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue