]> git.lyx.org Git - features.git/commitdiff
When previewing a format, change to the directory of the previewed file
authorEnrico Forestieri <forenr@lyx.org>
Tue, 2 Aug 2011 21:50:00 +0000 (21:50 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Tue, 2 Aug 2011 21:50:00 +0000 (21:50 +0000)
and invoke the previewer with only its filename without the path.
This solves the problem about forward search on Windows reported here:
http://thread.gmane.org/gmane.editors.lyx.general/71130

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@39413 a592a061-630c-0410-9148-cb99ea01b6c8

lib/doc/Additional.lyx
src/Format.cpp
status.20x

index 4c42d8a03abba8412f846e8c48075c834112e5bf..e956349cecca4f848dae21a7f8c42b2d3c5ef82b 100644 (file)
@@ -6862,7 +6862,7 @@ In order to use SumatraPDF for inverse search, enter
 status collapsed
 
 \begin_layout Plain Layout
-SumatraPDF.sh
+SumatraPDF -inverse-search "lyxeditor -g %f %l"
 \end_layout
 
 \end_inset
@@ -6880,46 +6880,8 @@ PDF (pdflatex)
 
 \end_inset
 
-, where 
-\begin_inset Flex Code
-status collapsed
-
-\begin_layout Plain Layout
-SumatraPDF.sh
-\end_layout
-
-\end_inset
-
- is the following script (to be placed in your command PATH, 
-\begin_inset Flex Code
-status collapsed
-
-\begin_layout Plain Layout
-/usr/local/bin
-\end_layout
-
-\end_inset
-
- being the best choice):
-\end_layout
-
-\begin_layout LyX-Code
-#!/bin/bash
-\begin_inset Newline newline
-\end_inset
-
-cd $(dirname $1)
-\begin_inset Newline newline
-\end_inset
-
-SumatraPDF -inverse-search "lyxeditor -g %f %l" $(basename $1)
-\end_layout
-
-\begin_layout Standard
-This wrapper script is needed because SumatraPDF is a native Windows application
- and does not understand the posix paths used by the Cygwin version of LyX.
- If SumatraPDF.exe is not in your command PATH, use its full posix path in
- the script above.
+.
+ If SumatraPDF.exe is not in your command PATH, use its full posix path.
  The 
 \begin_inset Flex Code
 status collapsed
index cc85b8500008165cb586f6c2ebccb2fb80fefaf3..a528ce20c8c5bb5e49132a270687029690648383 100644 (file)
@@ -23,6 +23,7 @@
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/os.h"
+#include "support/Path.h"
 #include "support/Systemcall.h"
 #include "support/textutils.h"
 #include "support/Translator.h"
@@ -312,13 +313,14 @@ bool Formats::view(Buffer const & buffer, FileName const & filename,
        if (!contains(command, token_from_format))
                command += ' ' + token_from_format;
 
-       command = subst(command, token_from_format, quoteName(filename.toFilesystemEncoding()));
+       command = subst(command, token_from_format, quoteName(onlyFileName(filename.toFilesystemEncoding())));
        command = subst(command, token_path_format, quoteName(onlyPath(filename.toFilesystemEncoding())));
        command = subst(command, token_socket_format, quoteName(theServerSocket().address()));
        LYXERR(Debug::FILES, "Executing command: " << command);
        // FIXME UNICODE utf8 can be wrong for files
        buffer.message(_("Executing command: ") + from_utf8(command));
 
+       PathChanger p(filename.onlyPath());
        Systemcall one;
        one.startscript(Systemcall::DontWait, command, buffer.filePath());
 
index f389b328e69c8352cdbaf275ebb44b879b2e8623..8076a5dcf503ae2c54853b5302fe5b86b6101643 100644 (file)
@@ -166,6 +166,9 @@ What's new
 - Fix bug when exporting documents containing the command/character
   "\iddots" in math to LyX 1.6.x.
 
+- Fix forward-search on Windows with SumatraPDF and, as a by-product,
+  allow using SumatraPDF on Cygwin without the need for a wrapper script.
+
 
 * USER INTERFACE