Menu

#2163 File completion doesn't work properly in Windows

open
nobody
None
1
2018-03-16
2017-05-15
No

When file completion starts working in the \input{} or \include{} macros, it opens the first-level folder but you can't select second and lower-level folders. It's extremely inconvenient if you have a lot of includes organized into directory hierarchy.

Also, file completion inserts the file path using the \\ symbol which becomes interpreted as the start of the macro instead of part of the file path. Windows perfectly understands the / symbol in file paths so you can safely unify the behavior between platforms.

If there's no resources to fix it, I can work on the fix myself, if somebody points me to the place in the codebase where the file completion resides.

Discussion

  • Mark Safronov

    Mark Safronov - 2017-05-15

    Attached a screenshot with what I'm seeing each time I try to autocomplete a file path inside include. Cursor is at the end of the line and I pressed Ctrl+Space.

     
  • Jan  Sundermeyer

    Jan Sundermeyer - 2017-05-16

    latexcompleter.cpp

    if (flags & CF_FORCE_GRAPHIC) {
    QString fn = lineText.mid(start, c.columnNumber() - start);
    int lastIndex = fn.lastIndexOf(QDir::separator());
    if (lastIndex >= 0)
    start = start + lastIndex + 1;
    if (fn.isEmpty())
    fn = workingDir + QDir::separator();

            QFileInfo fi(QDir(workingDir),fn);
            path = fi.absolutePath();
        }
    

    the fi(QDir... seems to givs odd results on windows, works fine on linux.
    The code is already changed a bit, so I have not tried if it still fails on win.

     
    • Mark Safronov

      Mark Safronov - 2017-05-19

      Interesting enough, after I built the project on Windows with Qt 5.8.0 (MinGW compiler), autocompletion started working as it should.

      However, it faithfully completes with Windows-style backslash (and spurious .tex extension as well) which results in the "undefined control sequence" error messages.

      It's interesting how it can be solved. I suggest I will add some postprocessing to the fi.absolutePath() with converting of backslash to forward slash. Or someone will. This is harmless on Windows and we don't have any other choice anyway, as backslash inside include macro is still considered a special character parsable by LaTeX.

       
  • basseur

    basseur - 2018-03-15

    I just wanted to submit the same bug. Any progress? Auto-completion would be so nice, if it didn't use the backslash.

     
  • Tim Hoffmann

    Tim Hoffmann - 2018-03-16

    The bug is still open, so no further progress.

     

Log in to post a comment.