#606 Autocompletion deletes line

Pat Schweitzer


When I insert a reference using ctrl+ SPACE to something, the rest of the line is deleted.
Example. I type

see Section for details.

Then I go back and type \ref{sec:A} between "see Section" and "for details".
Then I remember, the reference should be sec:very_long_word. So I delete the A} from \ref{sec:A} and
hit CTRL+SPACE to get the popup about auto completion. I use the
arrow keys to go to the correct reference and hit ENTER. And puff
the rest of the line, e.g. for details is gone.

Note the line doesn't get removed, when I type \ref{ for the first time and select the proper reference.

Linux LTS 10.04 + SVN 3319


  • Tim Hoffmann
    Tim Hoffmann


    Anyway, you can just delete A and hit Ctrl+Space (leave the closing bracket).

  • Tim Hoffmann
    Tim Hoffmann

    The behaviour could be changed, however the question is if it should.
    When triggering the completer on an existing label text, this text has to be replaced by the new label. The problem is to detect the boundary of the label. It's unambigous if a closing bracket is there. That is not the case if it is missing. One could additionally regard spaces as terminating characters, however that is not strictly correct in LaTeX, because spaces are allowed in labels. The following two cases yield the same result when deleting the terminating '}'
    \ref{sec a} b c
    \ref{sec a b} c
    Then, there is no way to determine, if the string to replace is "sec a b" or "sec a". Currently TXS assumes everything up to the next closing bracket to be part of the label.

  • Tim Hoffmann
    Tim Hoffmann

    As a compromize, I changed the behaviour of the completer. It does not delete beyond the next space if the closing bracket of the reference is missing (rev. 3326). Without closing bracket, this can lead to remaining parts of a spaced label. However, this is better than deleting the whole line in the other case.