From 8f870d3e5b2d4f8ae0236e3e3fbe1064d75a050e Mon Sep 17 00:00:00 2001 From: Jack Date: Fri, 2 Jul 2021 00:52:52 +0100 Subject: [PATCH 1/2] fixed presets and tags not working in new command line --- src/js/commandline-lists.js | 51 ++++++++++++++++++++++--------------- src/js/commandline.js | 13 +++++++++- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/js/commandline-lists.js b/src/js/commandline-lists.js index 6e8379bfb..2b35db653 100644 --- a/src/js/commandline-lists.js +++ b/src/js/commandline-lists.js @@ -206,7 +206,8 @@ export function updateTagCommands() { commandsTags.list.push({ id: "clearTags", - display: "Clear tags", + display: `Clear tags`, + icon: "fa-times", exec: () => { DB.getSnapshot().tags.forEach((tag) => { tag.active = false; @@ -220,13 +221,14 @@ export function updateTagCommands() { let dis = tag.name; if (tag.active === true) { - dis = '' + dis; + dis = '' + dis; } else { - dis = '' + dis; + dis = '' + dis; } commandsTags.list.push({ id: "toggleTag" + tag.id, + noIcon: true, display: dis, sticky: true, exec: () => { @@ -235,14 +237,17 @@ export function updateTagCommands() { let txt = tag.name; if (tag.active === true) { - txt = '' + txt; + txt = '' + txt; } else { - txt = '' + txt; + txt = '' + txt; } if (Commandline.isSingleListCommandLineActive()) { $( `#commandLine .suggestions .entry[command='toggleTag${tag.id}']` - ).html("Change tags > " + txt); + ).html( + `
Tags > ` + + txt + ); } else { $( `#commandLine .suggestions .entry[command='toggleTag${tag.id}']` @@ -256,7 +261,7 @@ export function updateTagCommands() { } let commandsPresets = { - title: "Apply preset...", + title: "Presets...", list: [], }; @@ -2208,10 +2213,6 @@ export let defaultCommands = { UpdateConfig.togglePunctuation(); }, }, - // exec: () => { - // UpdateConfig.togglePunctuation(); - // TestLogic.restart(); - // }, }, { id: "changeMode", @@ -2242,24 +2243,32 @@ export let defaultCommands = { { visible: false, id: "changeTags", - display: "Change tags...", - subgroup: true, - exec: () => { + display: "Tags...", + icon: "fa-tag", + subgroup: commandsTags, + beforeSubgroup: () => { updateTagCommands(); - current.push(commandsTags); - Commandline.show(); }, + // exec: () => { + // updateTagCommands(); + // current.push(); + // Commandline.show(); + // }, }, { visible: false, id: "applyPreset", - display: "Apply preset...", - subgroup: true, - exec: () => { + display: "Presets...", + icon: "fa-sliders-h", + subgroup: commandsPresets, + beforeSubgroup: () => { updatePresetCommands(); - current.push(commandsPresets); - Commandline.show(); }, + // exec: () => { + // updatePresetCommands(); + // current.push(commandsPresets); + // Commandline.show(); + // }, }, { id: "changeConfidenceMode", diff --git a/src/js/commandline.js b/src/js/commandline.js index b081ce0d1..f3ac92db3 100644 --- a/src/js/commandline.js +++ b/src/js/commandline.js @@ -46,7 +46,11 @@ function showFound() { icon = ``; } } - commandsHTML += `
${icon}
${obj.display}
`; + let iconHTML = `
${icon}
`; + if (obj.noIcon && !isSingleListCommandLineActive()) { + iconHTML = ""; + } + commandsHTML += `
${iconHTML}
${obj.display}
`; } }); $("#commandLine .suggestions").html(commandsHTML); @@ -169,6 +173,9 @@ function trigger(command) { showInput(obj.id, obj.display, obj.defaultValue); } else if (obj.subgroup) { subgroup = true; + if (obj.beforeSubgroup) { + obj.beforeSubgroup(); + } CommandlineLists.current.push(obj.subgroup); show(); } else { @@ -226,6 +233,10 @@ function addChildCommands( ) { icon = ``; } + if (commandItem.noIcon) { + icon = ""; + } + if (parentCommandDisplay) commandItemDisplay = parentCommandDisplay + " > " + icon + commandItemDisplay; From f5f23f41caff2528591a072159aadcd7df381a90 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Sun, 4 Jul 2021 16:36:41 -0400 Subject: [PATCH 2/2] fix stop on word replay error (#1594) by lukew3 --- src/js/input-controller.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/input-controller.js b/src/js/input-controller.js index 9944ee83f..6b1cba533 100644 --- a/src/js/input-controller.js +++ b/src/js/input-controller.js @@ -320,6 +320,7 @@ function handleSpace(event, isEnter) { } if (Config.stopOnError == "word") { TestLogic.input.appendCurrent(" "); + Replay.addReplayEvent("incorrectLetter", "_"); TestUI.updateWordElement(true); Caret.updatePosition(); }