~glacambre/firenvim

f760055806b985b268ba2f528f7a0ccb757f98af — Dundar Göc 2 years ago 8eac911
chore: fix typos
M CONTRIBUTING.md => CONTRIBUTING.md +2 -2
@@ 66,7 66,7 @@ Firenvim's architecture is briefly described in [SECURITY.md](SECURITY.md). Fire
The background process is started on browser startup and takes care of several tasks:

- Starting the Neovim server and loading the settings from your init.vim.
- Handling browser shortcuts such as `<C-w>`, `<C-n>` or `<C-t>` that cannot be overriden by the Neovim Frame process.
- Handling browser shortcuts such as `<C-w>`, `<C-n>` or `<C-t>` that cannot be overridden by the Neovim Frame process.
- Logging errors and sending them to the browserAction. 
- Forwarding messages from the Neovim Frame process to the content process and vice versa.



@@ 92,6 92,6 @@ The browser action process corresponds to the small Firenvim button next to the 

## Testing your changes

The CI tests changes automatically, so running tests on your machine is not required. If you do want to test Firenvim on your machine, you will need to install either Geckodriver (firefox) or Chromedriver (Chrome & Chromium). Once that is done, run `npm run test-firefox` or `npm run test-chrome`. This will build the add-on in testing mode, load it in a browser and run a few tests to make sure nothing is particularily broken.
The CI tests changes automatically, so running tests on your machine is not required. If you do want to test Firenvim on your machine, you will need to install either Geckodriver (firefox) or Chromedriver (Chrome & Chromium). Once that is done, run `npm run test-firefox` or `npm run test-chrome`. This will build the add-on in testing mode, load it in a browser and run a few tests to make sure nothing is particularly broken.

Writing new tests is currently rather complicated, so feel free to let me handle that if you don't want to deal with it.

M README.md => README.md +2 -2
@@ 119,7 119,7 @@ au BufEnter github.com_*.txt set filetype=markdown

### Understanding Firenvim's configuration object

You can configure everything else about Firenvim by creating a dictionnary named `g:firenvim_config` in your init.vim and setting the keys "globalSettings" and "localSettings". In the dictionary `g:firenvim_config["localSettings"]` you can map Javascript patterns that match against the full URL to settings that are used for all URLs matched by that pattern. When multiple patterns match a URL, the pattern with the highest "priority" value is used. Here is an example (the settings and their possible values will be explained in the next subsections):
You can configure everything else about Firenvim by creating a dictionary named `g:firenvim_config` in your init.vim and setting the keys "globalSettings" and "localSettings". In the dictionary `g:firenvim_config["localSettings"]` you can map Javascript patterns that match against the full URL to settings that are used for all URLs matched by that pattern. When multiple patterns match a URL, the pattern with the highest "priority" value is used. Here is an example (the settings and their possible values will be explained in the next subsections):

```vim
let g:firenvim_config = { 


@@ 297,7 297,7 @@ let g:firenvim_config = {

### Configuring the filename

It is possible to configure the name of the file used by Firenvim with the `filename` localSetting. This setting is a format string where each element in curly braces will be replaced with a value and where the maxium length can be specified with a percentage. Possible format elements are `hostname` (= the domain name of the website), `pathname` (= the path of the page), `selector` (= the CSS selector of the text area), `timestamp` (= the current date) and `extension` (the language extension when using Firenvim on a code editor or `txt` otherwise). For example:
It is possible to configure the name of the file used by Firenvim with the `filename` localSetting. This setting is a format string where each element in curly braces will be replaced with a value and where the maximum length can be specified with a percentage. Possible format elements are `hostname` (= the domain name of the website), `pathname` (= the path of the page), `selector` (= the CSS selector of the text area), `timestamp` (= the current date) and `extension` (the language extension when using Firenvim on a code editor or `txt` otherwise). For example:

```vim
let g:firenvim_config = {

M lua/firenvim-websocket.lua => lua/firenvim-websocket.lua +1 -1
@@ 43,7 43,7 @@ end

-- The server's opening handshake is described here: https://tools.ietf.org/html/rfc6455#section-4.2.2
local function accept_connection(headers)
        return "HTTP/1.1 101 Swithing Protocols\n" ..
        return "HTTP/1.1 101 Switching Protocols\n" ..
        "Connection: Upgrade\r\n" ..
        "Sec-WebSocket-Accept: " .. compute_key(headers["Sec-WebSocket-Key"]) .. "\r\n" ..
        "Upgrade: websocket\r\n" ..

M src/FirenvimElement.ts => src/FirenvimElement.ts +1 -1
@@ 182,7 182,7 @@ export class FirenvimElement {
        this.span.attachShadow({ mode: "closed" }).appendChild(this.iframe);

        // So pages (e.g. Jira, Confluence) remove spans from the page as soon
        // as they're inserted. We don't wan't that, so for the 5 seconds
        // as they're inserted. We don't want that, so for the 5 seconds
        // following the insertion, detect if the span is removed from the page
        // by checking visibility changes and re-insert if needed.
        let reinserts = 0;

M src/KeyHandler.ts => src/KeyHandler.ts +1 -1
@@ 2,7 2,7 @@ import { EventEmitter } from "./EventEmitter";
import { GlobalSettings, NvimMode } from "./utils/configuration";
import { addModifier, nonLiteralKeys, translateKey } from "./utils/keys";

// KeyHandler is the interface expecte by getInput
// KeyHandler is the interface expected by getInput
export interface KeyHandler extends EventEmitter<"input", (s: string) => void> {
    setMode: (m: NvimMode) => void,
    focus: () => void,

M src/autofill.ts => src/autofill.ts +1 -1
@@ 28,7 28,7 @@ export async function autofill() {
        [ name, version ] = browserString[0].split("/");
    } else {
        name = "unknown";
        version = "unknwon";
        version = "unknown";
    }
    const vendor = navigator.vendor || "";
    const textarea = document.getElementById("issue_body") as any;

M src/background.ts => src/background.ts +1 -1
@@ 329,7 329,7 @@ browser.windows.onFocusChanged.addListener(async (windowId: number) => {

updateIcon();

// browser.commmands doesn't exist in thunderbird. Else branch can't be covered
// browser.commands doesn't exist in thunderbird. Else branch can't be covered
// so don't instrument the if.
/* istanbul ignore next */
if (!isThunderbird()) {

M src/renderer.ts => src/renderer.ts +2 -2
@@ 75,7 75,7 @@ type HighlightInfo = {
// the grids are represented as arrays and thus have a .length attribute, but
// it's not: storing grid size in a separate datastructure allows us to never
// have to shrink arrays, and to not need allocations if enlarging an array
// that has been shrinked.
// that has been shrunk.
type GridDimensions = {
    width: number,
    height: number,


@@ 667,7 667,7 @@ const handlers : { [key:string] : (...args: any[])=>void } = {
    },
};

// keep track of wheter a frame is already being scheduled or not. This avoids
// keep track of whether a frame is already being scheduled or not. This avoids
// asking for multiple frames where we'd paint the same thing anyway.
let frameScheduled = false;
function scheduleFrame() {

M tests/_common.ts => tests/_common.ts +5 -5
@@ 294,7 294,7 @@ export const testDynamicTextareas = retryTest(withLocalPage("dynamic.html", asyn
        );
        await driver.wait(Until.stalenessOf(span), WAIT_DELAY, "Firenvim span did not go stale.");
        const txtarea = await driver.wait(Until.elementLocated(By.css("body > textarea")), WAIT_DELAY, "body > textarea not found");
        await driver.wait(async () => (await txtarea.getAttribute("value") !== ""), WAIT_DELAY, "Input alue did not change");
        await driver.wait(async () => (await txtarea.getAttribute("value") !== ""), WAIT_DELAY, "Input value did not change");
        expect(await txtarea.getAttribute("value")).toMatch("Test");
}));



@@ 403,7 403,7 @@ ${backup}
                .concat(webdriver.Key.ESCAPE)
                .concat(":wq!".split(""))
                .concat(webdriver.Key.ENTER));
        // We don't test for a specific value because size is dependant on browser config
        // We don't test for a specific value because size is dependent on browser config
        await driver.wait(async () => (await input.getAttribute("value") !== initVal), WAIT_DELAY, "Input value did not change");
        expect(await input.getAttribute("value")).toMatch(/a*ba+ba*/);
}));


@@ 572,7 572,7 @@ ${backup}
                `);
        await reloadNeovim(server, driver);
        let [input, span] = await createFirenvimFor(server, driver, By.id("content-input"));
        // Makign sure that whitespace == empty
        // Making sure that whitespace == empty
        await sendKeys(driver, "i".split("")
            .concat(webdriver.Key.ENTER)
            .concat(webdriver.Key.ENTER)


@@ 690,7 690,7 @@ export const testInputResizes = retryTest(withLocalPage("resize.html", async (te
                       .concat(webdriver.Key.ESCAPE)
                       .concat(":wq!".split(""))
                       .concat(webdriver.Key.ENTER));
        // We don't test for a specific value because size is dependant on browser config
        // We don't test for a specific value because size is dependent on browser config
        await driver.wait(async () => (await input.getAttribute("value") !== ""), WAIT_DELAY, "Input value did not change");
        expect(await input.getAttribute("value")).toMatch(/a*ba+ba*/);
}));


@@ 1123,7 1123,7 @@ export const testBrowserShortcuts = retryTest(withLocalPage("simple.html", async
        expect(newTabCount).toBe(tabCount - 1);

        // <CS-n> creates a new incognito window. This is chrome behavior but
        // we can't emulate firefox because it requires an additonal permission
        // we can't emulate firefox because it requires an additional permission
        windowCount = await getWindowCount();
        await server.browserShortcut("<CS-n>");
        await windowCountChange(windowCount, "<CS-n> did not change the number of windows");

M tests/chrome.ts => tests/chrome.ts +1 -1
@@ 171,7 171,7 @@ describe("Chrome", () => {
        t("Large buffers", testLargeBuffers);
        t("Modifiers work", testModifiers);
        t("Config priorities", testConfigPriorities);
        t("Add-on udpates", testUpdates);
        t("Add-on updates", testUpdates);
        t("CodeMirror", testCodemirror);
        t("Contenteditable", testContentEditable);
        t("Input resize", testInputResizes);

M tests/firefox.ts => tests/firefox.ts +1 -1
@@ 144,7 144,7 @@ describe("Firefox", () => {
        t("Large buffers", testLargeBuffers);
        t("Modifiers work", testModifiers);
        t("Config priorities", testConfigPriorities);
        t("Add-on udpates", testUpdates);
        t("Add-on updates", testUpdates);
        t("CodeMirror", testCodemirror);
        t("Contenteditable", testContentEditable);
        t("Input resize", testInputResizes);