Skip to content

Commit

Permalink
Merge branch 'master' into fix/swipe-typing-duplicate-word-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
HemendraSinghShekhawat authored Dec 1, 2024
2 parents 96ad5c9 + ca21b8d commit 9ea678e
Show file tree
Hide file tree
Showing 47 changed files with 9,236 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-failure-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v2.11.0
uses: dawidd6/action-download-artifact@v6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: peek_icons.yml
Expand Down
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"esbenp.prettier-vscode",
"vitest.explorer",
"huntertran.auto-markdown-toc",
"ms-vscode.vscode-typescript-next",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
Expand Down
6 changes: 3 additions & 3 deletions backend/src/constants/funbox-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const FunboxList: FunboxMetadata[] = [
frontendForcedConfig: {
highlightMode: ["letter", "off"],
},
frontendFunctions: ["applyCSS", "rememberSettings"],
frontendFunctions: ["applyCSS", "rememberSettings", "handleKeydown"],
name: "read_ahead_easy",
},
{
Expand All @@ -215,7 +215,7 @@ const FunboxList: FunboxMetadata[] = [
frontendForcedConfig: {
highlightMode: ["letter", "off"],
},
frontendFunctions: ["applyCSS", "rememberSettings"],
frontendFunctions: ["applyCSS", "rememberSettings", "handleKeydown"],
name: "read_ahead",
},
{
Expand All @@ -225,7 +225,7 @@ const FunboxList: FunboxMetadata[] = [
frontendForcedConfig: {
highlightMode: ["letter", "off"],
},
frontendFunctions: ["applyCSS", "rememberSettings"],
frontendFunctions: ["applyCSS", "rememberSettings", "handleKeydown"],
name: "read_ahead_hard",
},
{
Expand Down
3 changes: 3 additions & 0 deletions frontend/__tests__/root/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ describe("Config", () => {
expect(Config.setSmoothCaret("medium")).toBe(true);
expect(Config.setSmoothCaret("invalid" as any)).toBe(false);
});
it("setCodeUnindentOnBackspace", () => {
testBoolean(Config.setCodeUnindentOnBackspace);
});
it("setQuickRestartMode", () => {
expect(Config.setQuickRestartMode("off")).toBe(true);
expect(Config.setQuickRestartMode("tab")).toBe(true);
Expand Down
8 changes: 4 additions & 4 deletions frontend/scripts/json-validation.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ function validateOthers() {
},
row5: {
type: "array",
items: { type: "string", minLength: 1, maxLength: 1 },
items: { type: "string", minLength: 1, maxLength: 2 },
minItems: 1,
maxItems: 1,
maxItems: 2,
},
},
required: ["row1", "row2", "row3", "row4", "row5"],
Expand Down Expand Up @@ -280,9 +280,9 @@ function validateOthers() {
},
row5: {
type: "array",
items: { type: "string", minLength: 1, maxLength: 1 },
items: { type: "string", minLength: 1, maxLength: 2 },
minItems: 1,
maxItems: 1,
maxItems: 2,
},
},
required: ["row1", "row2", "row3", "row4", "row5"],
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/html/pages/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ <h2>
or
<key>esc</key>
- there you can access all the functionality you need without touching
your mouse
your mouse.
</p>
</div>
<div class="section">
Expand Down
14 changes: 14 additions & 0 deletions frontend/src/html/pages/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,20 @@
<select></select>
</div>
</div>
<div class="section" data-config-name="codeUnindentOnBackspace">
<div class="groupTitle">
<i class="fas fa-code"></i>
<span>code unindent on backspace</span>
</div>
<div class="text">
Automatically go back to the previous line when deleting line leading
tab characters. Only works in code languages.
</div>
<div class="buttons">
<button data-config-value="false">off</button>
<button data-config-value="true">on</button>
</div>
</div>
<div class="sectionSpacer"></div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/html/pages/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
<div class="top">characters</div>
<div
class="bottom"
aria-label="correct, incorrect, extra, and missed"
aria-label="correct&NewLine;incorrect&NewLine;extra&NewLine;missed"
data-balloon-break=""
data-balloon-pos="up"
>
Expand Down
104 changes: 90 additions & 14 deletions frontend/src/styles/keymap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
.r5 {
display: grid;
grid-template-columns: 3.5fr 6fr 3.5fr;
font-size: 0.5rem;
font-size: 1rem;
// &.matrixSpace {
// // grid-template-columns: 6.75fr 1.9fr 6.75fr;
// grid-template-columns: 6.9fr 4.6fr 6.9fr; // wider spacebar
Expand All @@ -110,6 +110,24 @@
// // grid-template-columns: 6.75fr 1.9fr 6.75fr;
// grid-template-columns: 4fr 7.5fr 4fr;
// }
.keySpace {
// since we can potentially have alphas in r5,
// we keep font-size: 1rem; for alphas to look the same as other rows,
// but reduce it again to 0.5rem for space, so layout name fits.
font-size: 0.5rem;
}

&[data-row5-has-alpha="true"] {
// space-alpha
&[data-row5-grid="3-1"] {
grid-template-columns: 4fr 4fr 1fr 4fr;
}

// alpha-space
&[data-row5-grid="1-3"] {
grid-template-columns: 4fr 1fr 4fr 4fr;
}
}
}
&.matrix {
.r1,
Expand All @@ -121,6 +139,18 @@

.r5 {
grid-template-columns: 1fr 3fr 4fr 3fr 1fr;

&[data-row5-has-alpha="true"] {
// space-alpha
&[data-row5-grid="3-1"] {
grid-template-columns: 1fr 2fr 3fr 1fr 5fr;
}

// alpha-space
&[data-row5-grid="1-3"] {
grid-template-columns: 2fr 3fr 1fr 3fr 3fr;
}
}
}
}
&.split {
Expand Down Expand Up @@ -152,6 +182,18 @@
}
.r5 {
grid-template-columns: 5fr 3fr 1fr 3fr 4.5fr;

&[data-row5-has-alpha="true"] {
// space-alpha
&[data-row5-grid="3-1"] {
grid-template-columns: 5fr 3fr 1fr 1fr 6.5fr;
}

// alpha-space
&[data-row5-grid="1-3"] {
grid-template-columns: 7fr 1fr 1fr 3fr 4.5fr;
}
}
}
.keySpace.right {
opacity: 1;
Expand Down Expand Up @@ -180,6 +222,18 @@

.r5 {
grid-template-columns: 1fr 2fr 3fr 1fr 3fr 2fr 1fr;

&[data-row5-has-alpha="true"] {
// space-alpha
&[data-row5-grid="3-1"] {
grid-template-columns: 2fr 1fr 3fr 1fr 1fr 2fr 3fr;
}

// alpha-space
&[data-row5-grid="1-3"] {
grid-template-columns: 4fr 1fr 1fr 1fr 3fr 1fr 2fr;
}
}
}
.keySpace.right {
opacity: 1;
Expand Down Expand Up @@ -433,20 +487,42 @@
}
.r5 {
grid-template-columns: 5fr 3fr 1fr 3fr 4.5fr;
}
.keySpace.right {
opacity: 1;
}

div.keySpace {
transform: rotate(10deg);
margin-left: -5%;
margin-top: 21%;
}
div.keySpace.right {
transform: rotate(-10deg);
margin-left: -33%;
margin-top: 20%;
// rotation/position of r5 keys moved under .r5 styles
// and made generic to left/right to account for alphas
div.keymapKey.left {
transform: rotate(10deg);
margin-left: -5%;
margin-top: 21%;
}
div.keymapKey.right {
opacity: 1;
transform: rotate(-10deg);
margin-left: -33%;
margin-top: 20%;
}

&[data-row5-has-alpha="true"] {
// space-alpha
&[data-row5-grid="3-1"] {
grid-template-columns: 5fr 3fr 1fr 3fr 4.5fr;

div.keymapKey.right {
margin-left: -30%;
margin-top: 25%;
}
}

// alpha-space
&[data-row5-grid="1-3"] {
grid-template-columns: 5fr 3fr 1fr 3fr 4.5fr;

div.keymapKey.left {
margin-left: 50%;
margin-top: 25%;
}
}
}
}
div#KeyBackslash.keymapKey {
visibility: hidden;
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/ts/commandline/commandline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,11 @@ async function showCommands(): Promise<void> {
await updateActiveCommand();
});
command.addEventListener("click", async () => {
const previous = activeIndex;
activeIndex = parseInt(command.getAttribute("data-index") ?? "0");
if (previous !== activeIndex) {
await updateActiveCommand();
}
await runActiveCommand();
});
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/ts/commandline/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import ResultScreenCommands from "./lists/result-screen";
import CustomBackgroundSizeCommands from "./lists/background-size";
import CustomBackgroundFilterCommands from "./lists/background-filter";
import AddOrRemoveThemeToFavorite from "./lists/add-or-remove-theme-to-favorites";
import CodeUnindentOnBackspace from "./lists/code-unindent-on-backspace";

import TagsCommands from "./lists/tags";
import CustomThemesListCommands from "./lists/custom-themes-list";
Expand Down Expand Up @@ -264,6 +265,7 @@ export const commands: CommandsSubgroup = {
...HideExtraLettersCommands,
...LazyModeCommands,
...LayoutsCommands,
...CodeUnindentOnBackspace,

//sound
...SoundVolumeCommands,
Expand Down
36 changes: 36 additions & 0 deletions frontend/src/ts/commandline/lists/code-unindent-on-backspace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as UpdateConfig from "../../config";
import { Command, CommandsSubgroup } from "../types";

const subgroup: CommandsSubgroup = {
title: "Code unindent on backspace...",
configKey: "codeUnindentOnBackspace",
list: [
{
id: "setCodeUnindentOnBackspaceOff",
display: "off",
configValue: false,
exec: (): void => {
UpdateConfig.setCodeUnindentOnBackspace(false);
},
},
{
id: "changeCodeUnindentOnBackspaceOn",
display: "on",
configValue: true,
exec: (): void => {
UpdateConfig.setCodeUnindentOnBackspace(true);
},
},
],
};

const commands: Command[] = [
{
id: "changeCodeUnindentOnBackspace",
display: "Code unindent on backspace...",
icon: "fa-code",
subgroup,
},
];

export default commands;
19 changes: 19 additions & 0 deletions frontend/src/ts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,24 @@ export function setSmoothCaret(
return true;
}

export function setCodeUnindentOnBackspace(
mode: boolean,
nosave?: boolean
): boolean {
if (!isConfigValueValidBoolean("code unindent on backspace", mode)) {
return false;
}
config.codeUnindentOnBackspace = mode;

saveToLocalStorage("codeUnindentOnBackspace", nosave);
ConfigEvent.dispatch(
"codeUnindentOnBackspace",
config.codeUnindentOnBackspace,
nosave
);
return true;
}

export function setStartGraphsAtZero(mode: boolean, nosave?: boolean): boolean {
if (!isConfigValueValidBoolean("start graphs at zero", mode)) {
return false;
Expand Down Expand Up @@ -1993,6 +2011,7 @@ export async function apply(
setKeymapSize(configObj.keymapSize, true);
setFontFamily(configObj.fontFamily, true);
setSmoothCaret(configObj.smoothCaret, true);
setCodeUnindentOnBackspace(configObj.codeUnindentOnBackspace, true);
setSmoothLineScroll(configObj.smoothLineScroll, true);
setAlwaysShowDecimalPlaces(configObj.alwaysShowDecimalPlaces, true);
setAlwaysShowWordsHistory(configObj.alwaysShowWordsHistory, true);
Expand Down
1 change: 1 addition & 0 deletions frontend/src/ts/constants/default-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const obj = {
favThemes: [],
showKeyTips: true,
smoothCaret: "medium",
codeUnindentOnBackspace: false,
quickRestart: "off",
punctuation: false,
numbers: false,
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/ts/constants/ignored-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export const IgnoredKeys = [
"AudioVolumeUp",
"AudioVolumeDown",
"AudioVolumeMute",
"Home",
"End",
];
Loading

0 comments on commit 9ea678e

Please sign in to comment.