From: Jean-Marc Lasgouttes Date: Fri, 14 Nov 2014 09:10:29 +0000 (+0100) Subject: Fix some glitches in inset-select-all X-Git-Tag: 2.2.0alpha1~1546 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3cbdfa17629e4a1f78901c88231faf7e3d6470e3;p=features.git Fix some glitches in inset-select-all Fix a crash reported in #7727. This happened because cur.pos() was reset before cur.pit(). In this case, cur.lastpos() will usually be wrong. Fix bad behaviour when selecting at top level with several paragraphs. Update documentation. --- diff --git a/lib/doc/LFUNs.lyx b/lib/doc/LFUNs.lyx index 0d9bb938dd..e36e00bad7 100644 --- a/lib/doc/LFUNs.lyx +++ b/lib/doc/LFUNs.lyx @@ -98,7 +98,7 @@ The LyX Team \end_layout \begin_layout Date -2014-10-23 +2014-11-14 \end_layout \begin_layout Section* @@ -2171,13 +2171,16 @@ Sample inset-modify note Note Comment inset-select-all \end_layout \begin_layout Description -Action Selects all contents of an inset. +Action Select all contents of an inset. +\end_layout +\begin_layout Description +Notion There are 3 successive levels: select current cell, select all cells of inset, select the inset from outside (in the enclosing inset). \end_layout \begin_layout Description Syntax inset-select-all \end_layout \begin_layout Description -Origin vfr, 22 Aug 2009 +Origin vfr, 22 Aug 2009; lasgouttes 1 Nov 2014 \end_layout \begin_layout Subsection* @@ -3047,7 +3050,7 @@ Origin Abdel, Dec 27 2007 section-select \end_layout \begin_layout Description -Action Selects the whole section. +Action Select the whole section. \end_layout \begin_layout Description Notion The cursor should be in a section heading before calling this lfun. diff --git a/src/BufferView.cpp b/src/BufferView.cpp index f4048161f4..e9824097d4 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1812,24 +1812,25 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr) cur.setSelection(true); cur.posForward(); } else if (cur.selBegin().idx() != cur.selEnd().idx() - || (cur.selBegin().at_cell_begin() + || (cur.depth() > 1 + && cur.selBegin().at_cell_begin() && cur.selEnd().at_cell_end())) { // At least one complete cell is selected. // Select all cells - cur.pos() = 0; cur.idx() = 0; + cur.pos() = 0; cur.resetAnchor(); cur.setSelection(true); cur.idx() = cur.lastidx(); cur.pos() = cur.lastpos(); } else { // select current cell - cur.pos() = 0; cur.pit() = 0; + cur.pos() = 0; cur.resetAnchor(); cur.setSelection(true); - cur.pos() = cur.lastpos(); cur.pit() = cur.lastpit(); + cur.pos() = cur.lastpos(); } dr.screenUpdate(Update::Force); break; diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 0efbb3c8e1..01ddb19e45 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -1150,16 +1150,19 @@ void LyXAction::init() /*! * \var lyx::FuncCode lyx::LFUN_INSET_SELECT_ALL - * \li Action: Selects all contents of an inset. + * \li Action: Select all contents of an inset. + * \li Notion: There are 3 successive levels: select current cell, + * select all cells of inset, select the inset from outside + * (in the enclosing inset). * \li Syntax: inset-select-all - * \li Origin: vfr, 22 Aug 2009 + * \li Origin: vfr, 22 Aug 2009; lasgouttes 1 Nov 2014 * \endvar */ { LFUN_INSET_SELECT_ALL, "inset-select-all", ReadOnly, Edit }, /*! * \var lyx::FuncCode lyx::LFUN_SECTION_SELECT - * \li Action: Selects the whole section. + * \li Action: Select the whole section. * \li Notion: The cursor should be in a section heading before calling this lfun. * \li Syntax: section-select