]> git.lyx.org Git - features.git/commitdiff
Fix bug #5991: Select function in environments.
authorVincent van Ravesteijn <vfr@lyx.org>
Sat, 22 Aug 2009 14:44:08 +0000 (14:44 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sat, 22 Aug 2009 14:44:08 +0000 (14:44 +0000)
C-M-a now selects the contents of an inset, if the whole inset is already selected, it will jump out the inset and selects everything in that inset.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31200 a592a061-630c-0410-9148-cb99ea01b6c8

lib/bind/cua.bind
lib/bind/mac.bind
src/FuncCode.h
src/LyXAction.cpp
src/Text3.cpp

index 9e826cc2990683dcb59bc03f2095e6eda4f888eb..f7a7b19ee56f887eb197319ba4749c62bf410450 100644 (file)
@@ -84,6 +84,7 @@
 \bind "C-S-Z"                  "redo"
 
 \bind "C-a"                    "command-sequence buffer-begin ; buffer-end-select"   # select all
+\bind "C-M-a"                  "inset-select-all"
 
 \bind "C-S-E"                  "changes-track"  # it's what MS Word uses
 \bind "~S-M-quotedbl"          "quote-insert single"
index cedfeb5bf4a6d9a3e1720361dafaf2cf0a1ab15b..c1631f58c950d06aeae49e6e7bfb1d1bd35e4da9 100644 (file)
@@ -74,6 +74,7 @@
 \bind "C-S-Z"                  "redo"
 
 \bind "C-a"                            "command-sequence buffer-begin ; buffer-end-select"   # select all
+\bind "C-M-a"                  "inset-select-all"
 
 \bind "C-S-E"                  "changes-track"  # it's what MS Word uses
 \bind "~S-M-quotedbl"  "quote-insert single"
index b6c984c9a8a3e9aeb918f97bac1dd49b84734492..2a1b7677d06a586abd0449c62afa7f47e2a8ac0c 100644 (file)
@@ -422,7 +422,7 @@ enum FuncCode
        // 325
        LFUN_INSET_BEGIN_SELECT,        // JMarc, 20090316
        LFUN_INSET_END_SELECT,          // JMarc, 20090316
-       LFUN_SCREEN_SHOW_CURSOR,        // vfr, 20090325
+       LFUN_INSET_SELECT_ALL,                  // vfr, 20090822
        LFUN_BUFFER_ZOOM_IN,            // vfr, 20090330
        LFUN_BUFFER_ZOOM_OUT,           // vfr, 20090330
        // 330
@@ -441,6 +441,7 @@ enum FuncCode
        LFUN_BRANCHES_RENAME,           // spitz 20090709
        LFUN_BUFFER_CLOSE_ALL,          // vfr 20090806
        LFUN_GRAPHICS_RELOAD,           // vfr 20090810
+       LFUN_SCREEN_SHOW_CURSOR,        // vfr, 20090325
 
        LFUN_LASTACTION                 // end of the table
 };
index b0a3a03571898fd3f8c2fb40b053ba030140b634..6df834e9251d4f0ed6de7168094405ae588c0958 100644 (file)
@@ -1073,6 +1073,15 @@ void LyXAction::init()
  */
                { LFUN_INSET_END_SELECT, "inset-end-select", ReadOnly, Edit },
 
+/*!
+ * \var lyx::FuncCode lyx::LFUN_INSET_SELECT_ALL
+ * \li Action: Selects all contents of an inset.
+ * \li Syntax: inset-select-all
+ * \li Origin: vfr, 22 Aug 2009
+ * \endvar
+ */
+               { LFUN_INSET_SELECT_ALL, "inset-select-all", ReadOnly, Edit },
+
 /*!
  * \var lyx::FuncCode lyx::LFUN_LINE_BEGIN
  * \li Action: Move the cursor to the begining of the (screen) line.
index 28be96930e238f9fb29bdc9c0c8235bea9c7fe83..be9a189029a679b6d41991561737133746c38a1a 100644 (file)
@@ -641,6 +641,18 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                cur.updateFlags(Update::FitCursor);
                break;
 
+       case LFUN_INSET_SELECT_ALL:
+               if (cur.depth() == 1 || !cur.selection() || !cur.selBegin().at_begin()
+                         || !cur.selEnd().at_end()) {
+                       needsUpdate |= cur.selHandle(false);
+                       needsUpdate |= cursorTop(cur);
+                       needsUpdate |= cur.selHandle(true);
+                       needsUpdate |= cursorBottom(cur);
+               } else 
+                       cur.undispatched();
+               cur.updateFlags(Update::FitCursor);
+               break;
+
        case LFUN_CHAR_FORWARD:
        case LFUN_CHAR_FORWARD_SELECT:
                //LYXERR0(" LFUN_CHAR_FORWARD[SEL]:\n" << cur);
@@ -2673,6 +2685,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_INSET_END:
        case LFUN_INSET_BEGIN_SELECT:
        case LFUN_INSET_END_SELECT:
+       case LFUN_INSET_SELECT_ALL:
        case LFUN_UNICODE_INSERT:
                // these are handled in our dispatch()
                enable = true;