ahrm / sioyek

Sioyek is a PDF viewer with a focus on textbooks and research papers
https://sioyek.info/
GNU General Public License v3.0
6.82k stars 224 forks source link

Inverse-search gives wrong path inside WSL #1049

Open 594212 opened 3 months ago

594212 commented 3 months ago

Inverse-search gives wrong path inside WSL

OS ```yaml ❯ hostnamectl Static hostname: sul-IBR1 Icon name: computer-container Chassis: container Machine ID: 429ac08b232f467ab44eb35b05b94a3d Boot ID: d7d798959a794b879fa2ff57cf51162e Virtualization: wsl Operating System: Ubuntu 22.04.4 LTS Kernel: Linux 5.15.133.1-microsoft-standard-WSL2 Architecture: x86-64 ```

Command Executed:

sioyek.exe --inverse-search "wsl echo %2 %1 >> /home/sul/textest/test-sync.log" '/home/sul/textest/main.pdf'

Expected Behavior:

15 home/sul/textest/main.tex
7 home/sul/textest/main.tex
7 home/sul/textest/main.tex
3 home/sul/textest/main.tex
3 home/sul/textest/main.tex
3 home/sul/textest/main.tex
15 home/sul/textest/main.tex
15 home/sul/textest/main.tex
9 home/sul/texttest/main.tex
9 home/sul/textest/main.tex
7 home/sul/textest/main.tex

Actual Behavior:

15 homesul  extestmain.tex
7 homesul   extestmain.tex
7 homesul   extestmain.tex
3 homesul   extestmain.tex
3 homesul   extestmain.tex
3 homesul   extestmain.tex
15 homesul  extestmain.tex
15 homesul  extestmain.tex
9 homesul   extestmain.tex
9 homesul   extestmain.tex
7 homesul   extestmain.tex

it's look like /t is perceived like tab and single forwardslash / is ignored

ahrm commented 3 months ago

I don't use WSL so I don't directly debug the issue right now, but we do have a vimtex_wsl_fix config option which I don't exactly remember what it does, but maybe it helps your case?

594212 commented 3 months ago

we do have a vimtex_wsl_fix config option

Yea, it is exactly for setting up vimtex in wsl, but for some reason it doesn't fix my problem. I tried set vimtex_wsl_fix 1 and remove it, for me it doesn't change output in /home/sul/textest/test-sync.log.

which I don't exactly remember what it does

in repo we can see some comments about what vimtex_wsl_fix is for

#ifdef Q_OS_WIN
// the path returned by synctex is formatted in unix style, for example it is something like this
// in windows: d:/some/path/file.pdf
// this doesn't work with Vimtex for some reason, so here we have to convert the path separators
// to windows style and make sure the driver letter is capitalized
QDir file_path = QDir(file_name);
QString new_path = QDir::toNativeSeparators(file_path.absolutePath());
new_path[0] = new_path[0].toUpper();
if (VIMTEX_WSL_FIX) {
    new_path = file_name;
}
#endif

It's confusing because, as far as I understand people already using sioyek inverse-search with wsl, why is not working.

DaitiDay commented 1 month ago

Any updates on this?