Skip to content

Commit 760d4f0

Browse files
authored
fix: corrected controls to M1 m1 and j1 (#633)
1 parent 3bc11d1 commit 760d4f0

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

src/js/constants.js

+17
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ class Constants {
660660
* @default Array(10).fill(null)
661661
*/
662662
mark = Array(10).fill(null);
663+
markText = Array(10).fill(null);
663664

664665
/**
665666
* Stops the autoplay if it is currently running.
@@ -1053,6 +1054,22 @@ class Menu {
10531054
<td>Copy full chat history in AI Chat View</td>
10541055
<td>${constants.alt} + Shift + A</td>
10551056
</tr>
1057+
<tr>
1058+
<td>Mark current position</td>
1059+
<td>M # (Shift + m, then a number 0-9)</td>
1060+
</tr>
1061+
<tr>
1062+
<td>Play marked position</td>
1063+
<td>m # (m, then a number 0-9)</td>
1064+
</tr>
1065+
<tr>
1066+
<td>Jump to marked position</td>
1067+
<td>j # (j, then a number 0-9)</td>
1068+
</tr>
1069+
<tr>
1070+
<td>Goto location menu</td>
1071+
<td>g</td>
1072+
</tr>
10561073
</tbody>
10571074
</table>
10581075
</div>

src/js/controls.js

+22-3
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ class Control {
551551
]);
552552

553553
// mark and recall
554-
// mark with M + # (0-9), recall with m + # (0-9)
554+
// mark with M + # (0-9), play with m + # (0-9), jump to with j + #
555555
// available in chart and braille, not review
556556
let lastKeytime = 0;
557557
let lastKey = null;
@@ -569,17 +569,36 @@ class Control {
569569
if (lastKey == 'M' && /[0-9]/.test(key)) {
570570
const markIndex = parseInt(key, 10);
571571
constants.mark[markIndex] = JSON.parse(JSON.stringify(position)); // deep copy
572+
constants.markText[markIndex] = JSON.parse(
573+
JSON.stringify(constants.verboseText)
574+
); // deep copy
572575
display.announceText('Marked position ' + markIndex);
573576
}
574577

575-
// recall with m
576-
if (lastKey == 'm' && /[0-9]/.test(key)) {
578+
// jump with j
579+
if (lastKey == 'j' && /[0-9]/.test(key)) {
577580
const recallIndex = parseInt(key, 10);
578581
if (constants.mark[recallIndex]) {
579582
position = JSON.parse(
580583
JSON.stringify(constants.mark[recallIndex])
581584
); // deep copy
582585
control.UpdateAll();
586+
} else {
587+
display.announceText(
588+
'No position marked at index ' + recallIndex
589+
);
590+
}
591+
}
592+
593+
// play with m
594+
if (lastKey == 'm' && /[0-9]/.test(key)) {
595+
const recallIndex = parseInt(key, 10);
596+
if (constants.markText[recallIndex]) {
597+
display.announceText(constants.markText[recallIndex]);
598+
} else {
599+
display.announceText(
600+
'No position marked at index ' + recallIndex
601+
);
583602
}
584603
}
585604
}

src/js/goto.js

+6
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,15 @@ class Goto {
3838
}
3939

4040
openMenu() {
41+
// save the current focus so we can return to it later
4142
this.whereWasMyFocus = document.activeElement;
4243
constants.tabMovement = 0; // to prevent maidr from being destroyed as we leave the chart
4344

45+
// clear the search input
46+
this.menuSearch.value = '';
47+
this.filterItems('');
48+
49+
// open the menu etc
4450
this.menuOpen = true;
4551
this.menu.style.display = 'block';
4652
this.menuSearch.focus();

0 commit comments

Comments
 (0)