Merge pull request #6633 from overleaf/jk-cm6-spelling-ignore-commands

[web] Ace/CM6 Spelling: don't send commands to backend

GitOrigin-RevId: 7fbd14240facb71b6d110eb95e271b07fced76b1
This commit is contained in:
June Kelly 2022-02-08 09:22:14 +00:00 committed by Copybot
parent ef4e137676
commit ab5135957a
2 changed files with 7 additions and 1 deletions

View file

@ -389,6 +389,10 @@ class SpellCheckManager {
WORD_REGEX.lastIndex = 0 // reset global stateful regexp for this usage
while ((result = WORD_REGEX.exec(line))) {
let word = result[0]
// Skip latex commands, as they are ignored by the backend anyway
if (word.slice(0, 1) === '\\') {
continue
}
if (word[0] === "'") {
word = word.slice(1)
}

View file

@ -206,7 +206,9 @@ export default describe('SpellCheckManager', function () {
this.adapter.getLineCount.returns(1)
this.adapter.getFirstVisibleRowNum.returns(1)
this.adapter.getLastVisibleRowNum.returns(1)
this.adapter.getLinesByRows.returns(['Lorem ipsum dolor'])
this.adapter.getLinesByRows.returns([
'Lorem \\somecommand ipsum dolor \\othercommand',
])
})
it('hits the backend with all words at startup', function () {