]> git.lyx.org Git - features.git/commitdiff
Fix some glitches in inset-select-all
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 14 Nov 2014 09:10:29 +0000 (10:10 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 14 Nov 2014 09:18:34 +0000 (10:18 +0100)
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.

lib/doc/LFUNs.lyx
src/BufferView.cpp
src/LyXAction.cpp

index 0d9bb938ddab95e58e015c884fe3573c96ef1758..e36e00bad77c89bac94392b6106404361af2ebf4 100644 (file)
@@ -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.
index f4048161f486f057dfef0a83e26e2939cf5d6065..e9824097d429d6b6c746b5df24fb3cfdd659c56f 100644 (file)
@@ -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;
index 0efbb3c8e1eb9c5380aaa793dd9eb983cf51c65f..01ddb19e45fc49e785c464679a188de80fb3e389 100644 (file)
@@ -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