commit a85e04b761f4528b95bd0cfe990da0b29edffe25
Author: Pavel Sanda <[email protected]>
Date:   Sun Sep 13 17:08:32 2026 +0200

    Route the citation-search script through argv form
    
    DiD - by default citation search false & does not autotrigger.
    
    Original runCommand() read its pipe in text mode, so on Windows
    CRLF used to be LF. QProcess returns raw, so we need to handle
    CRLF manually.
    
    Tier 01 DiD / argv 04a: argv-form citation search
    
    https://www.mail-archive.com/[email protected]/msg226810.html
    
    Assisted-by: Claude Opus 5
---
 src/frontends/qt/qt_helpers.cpp | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/frontends/qt/qt_helpers.cpp b/src/frontends/qt/qt_helpers.cpp
index ae9db8ac41..4246f74042 100644
--- a/src/frontends/qt/qt_helpers.cpp
+++ b/src/frontends/qt/qt_helpers.cpp
@@ -317,16 +317,29 @@ void showTarget(string const & target_in, Buffer const & 
buf)
                string tmp, tar;
                tar = split(target, tmp, ' ');
                string const scriptcmd = subst(lyxrc.citation_search_view, 
"$${python}", os::python());
-               string const command = scriptcmd + " " + tar;
-               cmd_ret const ret = runCommand(commandPrep(command));
-               if (!ret.valid) {
+               // tar string is controlled by user's biblio & script comes 
from user prefs.
+               vector<string> argv = 
splitCommandTokens(commandPrep(scriptcmd));
+               if (argv.empty()) {
+                       frontend::Alert::error(_("Could not open file"),
+                               _("The lyxpaperview script failed."));
+                       return;
+               }
+               string const program = argv.front();
+               argv.erase(argv.begin());
+               argv.push_back(tar);
+
+               Systemcall one;
+               string out;
+               if (one.startscriptArgv(program, argv, &out) != Systemcall::OK) 
{
                        // Script failed
                        frontend::Alert::error(_("Could not open file"),
                                _("The lyxpaperview script failed."));
                        return;
                }
-               // lyxpaperview returns a \n-separated list of paths
-               targets = getVectorFromString(rtrim(ret.result, "\n"), "\n");
+               // lyxpaperview returns a \n-separated list of paths. QProcess
+               // returns untranslated bytes, handle CRLF on Windows as well.
+               out = subst(out, "\r\n", "\n");
+               targets = getVectorFromString(rtrim(out, "\n"), "\n");
                if (targets.empty()) {
                        frontend::Alert::error(_("Could not open file"),
                                bformat(_("No file was found using the pattern 
`%1$s'."),
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to