On 10/9/20 2:22 PM, Richard Kimberly Heck wrote:
> On 10/9/20 12:12 PM, Kornel Benko wrote:
>> Am Fri, 9 Oct 2020 11:34:57 -0400
>> schrieb Richard Kimberly Heck <rikih...@lyx.org>:
>>
>>> On 10/9/20 6:42 AM, Kornel Benko wrote:
>>>> Am Fri,  9 Oct 2020 03:34:36 +0200 (CEST)
>>>> schrieb Richard Kimberly Heck <rikih...@lyx.org>:
>>>>  
>>>>> commit 6b86a5a395175bd3a015856698d4dddae662b162
>>>>> Author: Richard Kimberly Heck <rikih...@lyx.org>
>>>>> Date:   Thu Oct 8 22:02:06 2020 -0400
>>>>>
>>>>>     Bind new template dialog to template shortcut (bug 11996).
>>>>>     
>>>>>     From Daniel.
>>>>> ---
>>>>>  lib/bind/aqua.bind |    2 +-
>>>>>  lib/bind/cua.bind  |    2 +-
>>>>>  lib/bind/mac.bind  |   10 +++++-----
>>>>>  3 files changed, 7 insertions(+), 7 deletions(-)
>>>>>
>>>>> diff --git a/lib/bind/aqua.bind b/lib/bind/aqua.bind
>>>>> index bea8b47..477c59d 100644  
>>>> ...
>>>>  
>>>>> +\bind "M-~S-f t"         "dialog-show lyxfiles templates"  
>>>> This seems to be a very fragile. I erroneously tested with
>>>>    "dialog-show  lyxfiles templates"
>>>> (didn't see the extra space) and could not find the reason why
>>>> the bind didn't work.
>>>> There should be better parsing IMHO.  
>>> Agreed! I think there's a problem with not trimming strings in
>>> LyXAction::lookupFunc. I can have a look later, but it ought to be easy
>>> to add something here.
>>>
>>> Riki
>>>
>>>
>> I have tried to look into it, but failed.
>> To reproduce:
>>
>> Open command window (M-x) and type 'dialog-show  lyxfiles templates' (with 2 
>> spaces
>> before 'lyxfiles')
> OK, I'll have a look later.

The attached fixes this problem by collapsing whitespace after the
command. It is fine so long as we can assume that whitespace after the
command is meaningless. Is that safe?

Riki


>From 792389e642593c5e583f02ff5ab5c72698564a89 Mon Sep 17 00:00:00 2001
From: Richard Kimberly Heck <rikih...@lyx.org>
Date: Sat, 10 Oct 2020 10:09:30 -0400
Subject: [PATCH] Improve command parsing

---
 src/LyXAction.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 23cc74504b..4685b07c32 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -4498,7 +4498,7 @@ FuncRequest LyXAction::lookupFunc(string const & func) const
 		return FuncRequest(LFUN_NOACTION);
 
 	string cmd;
-	string const arg = split(func2, cmd, ' ');
+	string const arg = trim(split(func2, cmd, ' '));
 
 	FuncMap::const_iterator const fit = lyx_func_map.find(cmd);
 
-- 
2.25.4

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to