On Tue, Dec 22, 2009 at 10:44:14PM +0100, [email protected] wrote:
> Author: forenr
> Date: Tue Dec 22 22:44:14 2009
> New Revision: 32615
> URL: http://www.lyx.org/trac/changeset/32615
>
> Log:
> Allow spaces in path names for LFUN_SERVER_GOTO_FILE_ROW.
Jürgen, find attached the corresponding patch for branch.
> Modified:
> lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
>
> Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
> ==============================================================================
> --- lyx-devel/trunk/src/frontends/qt4/GuiView.cpp Tue Dec 22 13:00:01
> 2009 (r32614)
> +++ lyx-devel/trunk/src/frontends/qt4/GuiView.cpp Tue Dec 22 22:44:14
> 2009 (r32615)
> @@ -2599,9 +2599,18 @@
> {
> string file_name;
> int row;
> - istringstream is(argument);
> - is >> file_name >> row;
> - file_name = os::internal_path(file_name);
> + size_t i = argument.find_last_of(' ');
> + if (i != string::npos) {
> + file_name = os::internal_path(trim(argument.substr(0, i)));
> + istringstream is(argument.substr(i + 1));
> + is >> row;
> + if (is.fail())
> + i = string::npos;
> + }
> + if (i == string::npos) {
> + LYXERR0("Wrong argument: " << argument);
> + return false;
> + }
> Buffer * buf = 0;
> string const abstmp = package().temp_dir().absFilename();
> string const realtmp = package().temp_dir().realPath();
>
--
Enrico
Index: src/LyXFunc.cpp
===================================================================
--- src/LyXFunc.cpp (revisione 32586)
+++ src/LyXFunc.cpp (copia locale)
@@ -1178,9 +1178,19 @@ void LyXFunc::dispatch(FuncRequest const
LASSERT(lyx_view_, /**/);
string file_name;
int row;
- istringstream is(argument);
- is >> file_name >> row;
- file_name = os::internal_path(file_name);
+ size_t i = argument.find_last_of(' ');
+ if (i != string::npos) {
+ file_name = os::internal_path(trim(
+ argument.substr(0, i)));
+ istringstream is(argument.substr(i + 1));
+ is >> row;
+ if (is.fail())
+ i = string::npos;
+ }
+ if (i == string::npos) {
+ LYXERR0("Wrong argument: " << argument);
+ break;
+ }
Buffer * buf = 0;
bool loaded = false;
string const abstmp = package().temp_dir().absFilename();