mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
Allow comments in multiline RC file commands. Fixes issue #4555
Signed-off-by: Tushar <tusharbarman123@gmail.com>
This commit is contained in:
parent
2b6a27c678
commit
e1b0b7da75
1 changed files with 8 additions and 4 deletions
|
@ -59,17 +59,21 @@ export async function runRc(rc: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function rcFileToExCmds(rcText: string): string[] {
|
export function rcFileToExCmds(rcText: string): string[] {
|
||||||
// string-join lines that end with /
|
|
||||||
const joined = rcText.replace(/\\\n/g, "")
|
|
||||||
|
|
||||||
// Split into individual excmds
|
// Split into individual excmds
|
||||||
const excmds = joined.split("\n")
|
const excmds = rcText.split("\n")
|
||||||
|
|
||||||
// Remove empty and comment lines
|
// Remove empty and comment lines
|
||||||
return excmds.filter(
|
const ex= excmds.filter(
|
||||||
x =>
|
x =>
|
||||||
/\S/.test(x) &&
|
/\S/.test(x) &&
|
||||||
!x.trim().startsWith('"') &&
|
!x.trim().startsWith('"') &&
|
||||||
!x.trim().startsWith("#"),
|
!x.trim().startsWith("#"),
|
||||||
)
|
)
|
||||||
|
const res= ex.join("\n")
|
||||||
|
|
||||||
|
// string-join lines that end with /
|
||||||
|
const joined = res.replace(/\\\n/g, "")
|
||||||
|
|
||||||
|
return joined.split("\n")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue