]> git.lyx.org Git - features.git/commitdiff
Allow the input of an InsetInfo using command buffer (e.g. "info-insert menu paste...
authorBo Peng <bpeng@lyx.org>
Sun, 14 Oct 2007 00:47:52 +0000 (00:47 +0000)
committerBo Peng <bpeng@lyx.org>
Sun, 14 Oct 2007 00:47:52 +0000 (00:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20961 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text3.cpp
src/insets/InsetInfo.h

index f32007acb732ba22535f3eab2fda9cc622a3f68f..c95b90787cdbce684500e52ee4cd787548ed2252 100644 (file)
@@ -1097,16 +1097,18 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_INFO_INSERT: {
-               if (!cur.selection())
-                       break;
                Inset * inset = createInset(&cur.bv(), cmd);
                if (!inset)
                        break;
-               // use selected text as info to avoid a separate UI
-               docstring ds = cur.selectionAsString(false);
-               cutSelection(cur, true, false);
+               // if an empty inset is created (cmd.argument() is empty)
+               // use current selection as parameter.
+               if (cmd.argument().empty() && cur.selection()) {
+                       // use selected text as info to avoid a separate UI
+                       docstring ds = cur.selectionAsString(false);
+                       cutSelection(cur, true, false);
+                       static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
+               }
                insertInset(cur, inset);
-               static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
                cur.posRight();
                break;
        }
index a8c6dbdf67e2773c87c9b4e0463091448baad003..280303c05cb163d88a6193ec94b63367d606cf9e 100644 (file)
@@ -33,32 +33,36 @@ InsetInfo can have type "shortcut", "lyxrc", "package", "textclass", or
 "menu". Arguments and outputs vary by type.
 
 shortcut: name of the LFUN such as "math-insert \alpha". The syntax
-       is the same as what is used in the bind and ui files.
-       The output of this inset is all shortcuts separated by comma.
+    is the same as what is used in the bind and ui files.
+    The output of this inset is all shortcuts separated by comma.
 
 lyxrc: name of the rc entry such as "bind_file". Look in src/LyXRC.h
-       for available entries. The output is the content of this RC
-       entry.
+    for available entries. The output is the content of this RC
+    entry.
 
 package: name of a latex package such as "listings". The output is
-       "yes" or "no".
+    "yes" or "no".
 
 textclass: name of a textclass such as "article". The output is "yes"
-       or "no".
+    or "no".
 
 menu: name of the LFUN such as "paste". The syntax is the same as
-       what is used in the bind and ui files. The output is the
-       menu item that trigger this LFUN. For example, "File > Paste".
-       '>' is actually \lyxarrow (an InsetSpecialChar).
+    what is used in the bind and ui files. The output is the
+    menu item that trigger this LFUN. For example, "File > Paste".
+    '>' is actually \lyxarrow (an InsetSpecialChar).
 
 
 Because this inset is intended to be used only by document maintainers,
-there is no GUI, no menu entry for this inset. A user would have to
-define a shortcut for "info-insert" (e.g. C-S-I), and
+there is no GUI, no menu entry for this inset. A user can define a 
+shortcut for "info-insert" (e.g. C-S-I), and
 
-1. input the type and argument of this inset. E.g. "menu paste".
+1. input the type and argument of this inset, e.g. "menu paste", in 
+   the work area.
 2. select the text and run "info-insert" (e.g. press C-S-I).
 
+An alternative method is to enter command "info-insert type args" in 
+the command buffer (view->Toolbar->Command Buffer).
+
 */
 
 namespace lyx {