Skip to content

Commit 517c5a3

Browse files
committed
Merge pull request #337 from petereichinger/master
Fixes keep_focus and forward_sync
2 parents 89409d1 + ce5ffd8 commit 517c5a3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

jumpToPDF.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,21 @@ def run(self, edit, **args):
9292
# self.view.run_command("send_dde",
9393
# { "service": "SUMATRA", "topic": "control", "command": command})
9494
# Now send ForwardSearch command if needed
95+
96+
si = subprocess.STARTUPINFO()
97+
if setfocus == 0:
98+
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
99+
si.wShowWindow = 4 #constant for SHOWNOACTIVATE
100+
101+
startCommands = ["SumatraPDF.exe","-reuse-instance"]
95102
if forward_sync:
96-
subprocess.Popen(["SumatraPDF.exe","-reuse-instance","-forward-search", srcfile, str(line), pdffile])
103+
startCommands.append("-forward-search")
104+
startCommands.append(srcfile)
105+
startCommands.append(str(line))
106+
107+
startCommands.append(pdffile)
108+
109+
subprocess.Popen(startCommands, startupinfo = si)
97110
# command = "[ForwardSearch(\"%s\",\"%s\",%d,%d,0,%d)]" \
98111
# % (pdffile, srcfile, line, col, setfocus)
99112
# print (command)

0 commit comments

Comments
 (0)