SublimeText-Markdown/MarkdownEditing

Backtick overwrite does not work

Closed this issue · 1 comments

rchl commented
  1. In markdown file write
`test`
  1. Put the cursor just before the second `
  2. Press `

Expected: The backtick is overwritten
Actual: Another backtick is inserted before the existing one.

This works with built-in syntax.

The scopes at this position are:

text.html.markdown meta.paragraph.markdown markup.raw.inline.markdown punctuation.definition.raw.end.markdown

MarkdownEditing comes with a keybinding for handling this:

	{ "keys": ["`"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
		[
			{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw - markup.kbd", "match_all": true },
			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
			{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
		]
	},

but it doesn't handle this case because of the - markup.raw.

The built-in syntax comes with the following keybinding:

    {
        "keys": ["`"],
        "command": "move",
        "args": {"by": "characters", "forward": true},
        "context": [
            { "key": "setting.auto_match_enabled" },
            { "key": "selection_empty", "operand": true, "match_all": true },
            { "key": "selector", "operand": "text.html.markdown markup.raw - markup.raw.code-fence - meta.code-fence" },
            { "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
        ]
    },

So it works there because it doesn't exclude markup.raw.

rchl commented

The keybinding for backspace also has similar problem -- it doesn't handle pressing backspace between two backticks.