forked from codemirror/codemirror5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support tag text objects in xml / htmlmixed mode.
User can use `t` to operate on tag text objects. For example, given the following html: ``` <div> <span>hello world!</span> </div> ``` If the user's cursor (denoted by █) is inside "hello world!": ``` <div> <span>hello█world!</span> </div> ``` And they enter `dit` (delete inner tag), then the text inside the enclosing tag is deleted -- the following is the expected result: ``` <div> <span></span> </div> ``` If they enter `dat` (delete around tag), then the surrounding tags are deleted as well: ``` <div> </div> ``` This logic depends on the following: - mode/xml/xml.js - addon/fold/xml-fold.js - editor is in htmlmixedmode / xml mode Caveats This is _NOT_ a 100% accurate implementation of vim tag text objects. For example, the following cases noop / are inconsistent with vim behavior: - Does not work inside comments: ``` <!-- <div>broken</div> --> ``` - Does not work when tags have different cases: ``` <div>broken</div> ``` - Does not work when inside a broken tag: ``` <div><brok><en></div> ``` This addresses codemirror#3828.
- Loading branch information
1 parent
772d09e
commit a0a533e
Showing
3 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters