Any thoughts?

Scott
From dfd265bbcb4c00d06ddd064fa64da5000ebc5cb2 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Fri, 14 Oct 2016 10:41:11 -0400
Subject: [PATCH] Fix color when branch name has a space

The argument to set-color is "<LYX_NAME> <X11_NAME>", where in the
case of branches <LYX_NAME> is the name of the branch. Since branch
names are allowed to contain spaces, instead of splitting on the
first space in the argument we now split on the last space.
---
 src/LyXAction.cpp                    | 1 +
 src/frontends/qt4/GuiApplication.cpp | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 836f97b..fdf736a 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -3566,6 +3566,7 @@ void LyXAction::init()
  * \li Action: Set the given LyX color to the color defined by the X11 name 
given.
  * \li Notion: A new color entry is created if the color is unknown.
                Color names can be stored as a part of user settings.
+               Color names may contain spaces.
  * \li Syntax: set-color <LYX_NAME> <X11_NAME>
  * \li Origin: SLior, 11 Jun 2000
  * \endvar
diff --git a/src/frontends/qt4/GuiApplication.cpp 
b/src/frontends/qt4/GuiApplication.cpp
index 81d5373..6b30ed7 100644
--- a/src/frontends/qt4/GuiApplication.cpp
+++ b/src/frontends/qt4/GuiApplication.cpp
@@ -1736,7 +1736,8 @@ void GuiApplication::dispatch(FuncRequest const & cmd, 
DispatchResult & dr)
 
        case LFUN_SET_COLOR: {
                string lyx_name;
-               string const x11_name = split(to_utf8(cmd.argument()), 
lyx_name, ' ');
+               // *r*split because lyx_name (e.g. branch name) might have 
spaces
+               string const x11_name = rsplit(to_utf8(cmd.argument()), 
lyx_name, ' ');
                if (lyx_name.empty() || x11_name.empty()) {
                        if (current_view_)
                                current_view_->message(
-- 
2.7.4

Attachment: signature.asc
Description: PGP signature

Reply via email to