mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
Remove obsolete code >:D
This commit is contained in:
parent
99f6dc4e8e
commit
d26402929d
8 changed files with 19 additions and 81 deletions
|
@ -24,7 +24,6 @@ import * as dom from "./dom"
|
|||
import * as hinting_background from "./hinting_background"
|
||||
import * as download_background from "./download_background"
|
||||
import * as gobble_mode from "./parsers/gobblemode"
|
||||
import * as input_mode from "./parsers/inputmode"
|
||||
import * as itertools from "./itertools"
|
||||
import * as keyseq from "./keyseq"
|
||||
import * as request from "./requests"
|
||||
|
@ -43,7 +42,6 @@ import * as webext from "./lib/webext"
|
|||
hinting_background,
|
||||
download_background,
|
||||
gobble_mode,
|
||||
input_mode,
|
||||
itertools,
|
||||
keydown_background,
|
||||
native,
|
||||
|
|
|
@ -34,11 +34,21 @@ let USERCONFIG = o({})
|
|||
const DEFAULTS = o({
|
||||
configversion: "0.0",
|
||||
// When creating new <modifier-letter> maps, make sure to make the modifier uppercase (e.g. <C-a> instead of <c-a>) otherwise some commands might not be able to find them (e.g. `bind <c-a>`)
|
||||
imaps: o({
|
||||
ignoremaps: o({
|
||||
"<S-Insert>": "mode normal",
|
||||
"<CA-Esc>": "mode normal",
|
||||
"<CA-`>": "mode normal",
|
||||
}),
|
||||
inputmaps: o({
|
||||
"<Esc>": "composite unfocus | mode normal",
|
||||
"<C-i>": "editor",
|
||||
"<Tab>": "focusinput -n",
|
||||
"<S-Tab>": "focusinput -N",
|
||||
}),
|
||||
imaps: o({
|
||||
"<Esc>": "composite unfocus | mode ignore",
|
||||
"<C-i>": "editor",
|
||||
}),
|
||||
nmaps: o({
|
||||
"<F1>": "help",
|
||||
o: "fillcmdline open",
|
||||
|
|
|
@ -8,24 +8,21 @@ import Logger from "./logging"
|
|||
import { parser as exmode_parser } from "./parsers/exmode"
|
||||
import { parser as hintmode_parser } from "./hinting_background"
|
||||
import { parser as findmode_parser } from "./finding_background"
|
||||
import * as normalmode from "./parsers/normalmode"
|
||||
import * as insertmode from "./parsers/insertmode"
|
||||
import * as ignoremode from "./parsers/ignoremode"
|
||||
import * as gobblemode from "./parsers/gobblemode"
|
||||
import * as inputmode from "./parsers/inputmode"
|
||||
import * as generic from "./parsers/genericmode"
|
||||
|
||||
const logger = new Logger("controller")
|
||||
|
||||
/** Accepts keyevents, resolves them to maps, maps to exstrs, executes exstrs */
|
||||
function* ParserController() {
|
||||
const parsers = {
|
||||
normal: normalmode.parser,
|
||||
insert: insertmode.parser,
|
||||
ignore: ignoremode.parser,
|
||||
normal: keys => generic.parser("nmaps",keys),
|
||||
insert: keys => generic.parser("imaps",keys),
|
||||
input: keys => generic.parser("inputmaps",keys),
|
||||
ignore: keys => generic.parser("ignoremaps",keys),
|
||||
hint: hintmode_parser,
|
||||
find: findmode_parser,
|
||||
gobble: gobblemode.parser,
|
||||
input: inputmode.parser,
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
|
|
@ -23,7 +23,8 @@ function keyeventHandler(ke: KeyboardEvent) {
|
|||
|
||||
import state from "./state"
|
||||
|
||||
import * as normalmode from "./parsers/normalmode"
|
||||
import * as generic from "./parsers/genericmode"
|
||||
let normparser = keys => generic.parser("nmaps", keys)
|
||||
let keys = []
|
||||
|
||||
/** Choose to suppress a key or not */
|
||||
|
@ -53,7 +54,7 @@ function modeSpecificSuppression(ke: KeyboardEvent) {
|
|||
switch (mode) {
|
||||
case "normal":
|
||||
keys.push(ke)
|
||||
const response = normalmode.parser(keys)
|
||||
const response = normparser(keys)
|
||||
|
||||
// Suppress if there's a match.
|
||||
if (response.isMatch) {
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
import { hasModifiers } from "../keyseq"
|
||||
|
||||
import * as generic from "./genericmode"
|
||||
|
||||
// Placeholder - should be moved into generic parser
|
||||
// export function parser(keys) {
|
||||
// const response = { keys: [], exstr: undefined }
|
||||
// if (
|
||||
// (keys[0].shiftKey && keys[0].key === "Insert") ||
|
||||
// (keys[0].altKey && keys[0].ctrlKey && keys[0].key === "Escape") ||
|
||||
// (keys[0].altKey && keys[0].ctrlKey && keys[0].key === "`")
|
||||
// ) {
|
||||
// return { keys: [], exstr: "mode normal" }
|
||||
// }
|
||||
// return { keys: [], exstr: undefined }
|
||||
// }
|
||||
|
||||
export let parser = keys => generic.parser("imaps",keys)
|
|
@ -1,20 +0,0 @@
|
|||
import state from "../state"
|
||||
import { MsgSafeKeyboardEvent } from "../msgsafe"
|
||||
|
||||
export function init() {
|
||||
state.mode = "input"
|
||||
}
|
||||
|
||||
export function parser(keys: MsgSafeKeyboardEvent[]) {
|
||||
const key = keys[0].key
|
||||
|
||||
if (key === "Escape") {
|
||||
state.mode = "normal"
|
||||
return { keys: [], exstr: "unfocus" }
|
||||
} else if (key === "Tab") {
|
||||
if (keys[0].shiftKey) return { keys: [], exstr: "focusinput -N" }
|
||||
else return { keys: [], exstr: "focusinput -n" }
|
||||
} else if (key === "i" && keys[0].ctrlKey)
|
||||
return { keys: [], exstr: "editor" }
|
||||
return { keys: [], exstr: "" }
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
import state from "../state"
|
||||
import { hasModifiers } from "../keyseq"
|
||||
|
||||
// Placeholder - should be moved into generic parser
|
||||
export function parser(keys) {
|
||||
const response = { keys: [], exstr: undefined }
|
||||
const key = keys[0]
|
||||
if (!hasModifiers(key)) {
|
||||
if (key.key === "Escape") {
|
||||
state.mode = "normal"
|
||||
return { keys: [], exstr: "unfocus" }
|
||||
}
|
||||
} else if (key.key === "i" && key.ctrlKey)
|
||||
return { keys: [], exstr: "editor" }
|
||||
return { keys: [], exstr: undefined }
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
/** Tridactyl normal mode */
|
||||
|
||||
import * as config from "../config"
|
||||
import * as keyseq from "../keyseq"
|
||||
|
||||
export function parser(keys): keyseq.ParserResponse {
|
||||
let nmaps: any = config.get("nmaps")
|
||||
// Remove unbound keys
|
||||
nmaps = Object.entries(nmaps).filter(([k, v]) => v !== "")
|
||||
// Convert to KeyMap
|
||||
nmaps = keyseq.mapstrMapToKeyMap(new Map(nmaps))
|
||||
|
||||
return keyseq.parse(keys, nmaps)
|
||||
}
|
Loading…
Add table
Reference in a new issue