mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add comment explaining the custom insertMatch
This commit is contained in:
parent
96d269e348
commit
08faa64b57
1 changed files with 9 additions and 0 deletions
|
@ -155,6 +155,15 @@ define [
|
|||
if this.completions.filterText.match(/^\\begin\{/) and nextChar == "}"
|
||||
editor.session.remove(range)
|
||||
|
||||
# Provide our own `insertMatch` implementation.
|
||||
# See the `insertMatch` method of Autocomplete in `ext-language_tools.js`.
|
||||
# We need this to account for editing existing commands, particularly when
|
||||
# adding a prefix.
|
||||
# We fix this by detecting when the cursor is in the middle of an existing
|
||||
# command, and adjusting the insertions/deletions accordingly.
|
||||
# Example:
|
||||
# when changing `\ref{}` to `\href{}`, ace default behaviour
|
||||
# is likely to end up with `\href{}ref{}`
|
||||
if !data?
|
||||
completions = this.completions
|
||||
popup = editor.completer.popup
|
||||
|
|
Loading…
Reference in a new issue