From a18553e403dbe4afb4b12a6f7ac3192ca2004aa2 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 12 Oct 2009 08:21:32 +0000 Subject: [PATCH] branch: Fix bug #5991: Select function in environments. 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/branches/BRANCH_1_6_X@31598 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/bind/cua.bind | 1 + lib/bind/mac.bind | 1 + src/FuncCode.h | 3 ++- src/LyXAction.cpp | 9 +++++++++ src/Text3.cpp | 13 +++++++++++++ status.16x | 3 +++ 6 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/bind/cua.bind b/lib/bind/cua.bind index 1d3fa11049..1210cebf90 100644 --- a/lib/bind/cua.bind +++ b/lib/bind/cua.bind @@ -81,6 +81,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" diff --git a/lib/bind/mac.bind b/lib/bind/mac.bind index 30667322fd..76249d88dc 100644 --- a/lib/bind/mac.bind +++ b/lib/bind/mac.bind @@ -69,6 +69,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" diff --git a/src/FuncCode.h b/src/FuncCode.h index bc7812b59d..f0c534fd70 100644 --- a/src/FuncCode.h +++ b/src/FuncCode.h @@ -415,7 +415,7 @@ enum FuncCode LFUN_VC_COMMAND, // 320 LFUN_MATH_FONT_STYLE, - LFUN_SCREEN_SHOW_CURSOR, // vfr, 20090325 + LFUN_INSET_SELECT_ALL, // vfr, 20090822 LFUN_BUFFER_ZOOM_IN, // vfr, 20090330 LFUN_BUFFER_ZOOM_OUT, // vfr, 20090330 LFUN_INSET_BEGIN, // JMarc, 20090316 @@ -426,6 +426,7 @@ enum FuncCode LFUN_VC_LOCKING_TOGGLE, LFUN_MATH_BIGDELIM, LFUN_GRAPHICS_RELOAD, // vfr 20090810 + LFUN_SCREEN_SHOW_CURSOR, // vfr, 20090325 LFUN_LASTACTION // end of the table }; diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index b99e509b22..9bb515a7ec 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -1038,6 +1038,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. diff --git a/src/Text3.cpp b/src/Text3.cpp index cc879cf833..689f30da33 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -561,6 +561,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); @@ -2445,6 +2457,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; diff --git a/status.16x b/status.16x index 0f9444cf62..fc90328e80 100644 --- a/status.16x +++ b/status.16x @@ -54,6 +54,9 @@ What's new - Close button on tabs is configurable now (bug 5977). +- New LFUN inset-select-all allows to select the whole contents of + an inset (bug 5991). + * DOCUMENTATION AND LOCALIZATION