Skip to content

In WebKit, Auto-Close Brackets plugin creates incorrect text #131

@WebCoder49

Description

@WebCoder49

This is a problem for me only in GNOME Web and not in Firefox/Chromium, but it may be a problem in other WebKit-based browsers (if you use another WebKit-based browser* please let me know if you can reproduce the error).

* e.g. the Free Emacs or Konqueror, or the proprietary Apple Safari, non-EU iOS any browser, Amazon Kindle; some embedded systems

Steps to reproduce

code-input version 2.5.0.

  • Run either prism.html or hljs.html in the test file in this repo under GNOME Web
  • Optionally type some code then go onto a new line.
  • Either type some code before the caret (option a), some whitespace before the caret (option b), only newlines before the caret (option c) or nothing (option d).
  • Type an opening bracket ((/[/{) (option e) or a double quote (") (option f)

Expected behaviour

A closing bracket or other quote appears after the caret, as occurs in Gecko (Firefox) and Blink (Chromium). The opening bracket still appears typed as normal.

Actual behaviour

Option combination Result
a e Expected behaviour matched, except when an identical closing bracket is after the caret initially, in which case no other closing bracket is not added (it's as if the automatically-inserted closing bracket is being caught by the keydown event which allows closing brackets to be overwritten).
b e The end of the whitespace changes to ")(" while the caret stays visibly in the same position.
c e or d e The closing bracket appears but no opening bracket that should have been typed appears.
a f or b f After a delay, a large number of quotes appear, the caret moves after the first of them and a "RangeError: Maximum call stack size exceeded" error appears in the console, referencing document.execCommand on line 44 of auto-close-brackets.js.
c f A single double quote appears, with the caret after it. The same console error is logged.
d f A single double quote appears, with the caret before it. The same console error is logged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:existing-pluginA bug/feature for an existing plugin in the plugins folder of code-input.bugSomething isn't workinghelp wantedExtra attention is neededpriority:high

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions