]> git.lyx.org Git - features.git/commitdiff
Add optional parameter 'local' to outline-in/out
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 28 Jun 2023 14:05:21 +0000 (16:05 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 6 Jul 2023 15:47:08 +0000 (17:47 +0200)
When this parameter is given, only the current paragraph is affected
by the section promoting/demoting.

Note that the new argument is not used yet.

Update release notes and LFUNS documentation.

Part of ticket #12417.

lib/RELEASE-NOTES
src/LyXAction.cpp
src/Text.cpp

index dda358c54eb33812e586d4c66be5fe5915452041..9e9611b30d032181d067ebb66e5986eb4a5fe4c8 100644 (file)
 
 * index-tag-all adds a copy of the index entry under cursor to after all occurrences of the
   word that precedes the index inset.
-  
+
 * inset-insert-copy inserts the inset's content (in ToC pane) at the position of the cursor.
 
 * inset-split is a new convenience function that splits an inset into two at the given
 
 * info-insert buffer vcs-*: renamed to info-insert vcs *
 
+* outline-in/out can now take argument "local", that restricts their
+  action to the current paragraph.
+
 * set-graphics-group was renamed to graphics-set-group.
 
 * tabular-feature: added toggle parameters "toggle-all-lines", "toggle-border-lines"
index 5688c0962aa15be15dbe579130df78b140653ae2..9ebf307d6e25051ea6b2b4c121856de2ee52d6a4 100644 (file)
@@ -3237,7 +3237,8 @@ void LyXAction::init()
  * \li Action: Moves the current group in the downward direction in the
                hierarchy of the document structure.
  * \li Notion: Part -> Chapter -> Section -> etc.
- * \li Syntax: outline-in
+ * \li Syntax: outline-in [local]
+ * \li Params: local: if given, only the current paragraph will be affected.
  * \li Origin: Vermeer, 23 Mar 2006
  * \endvar
  */
@@ -3248,7 +3249,8 @@ void LyXAction::init()
  * \li Action: Moves the current group in the upward direction in the
                hierarchy of the document structure.
  * \li Notion: Part <- Chapter <- Section <- etc.
- * \li Syntax: outline-out
+ * \li Syntax: outline-out [local]
+ * \li Params: local: if given, only the current paragraph will be affected.
  * \li Origin: Vermeer, 23 Mar 2006
  * \endvar
  */
index 3dae5c78ffd344f937784b72f41f2bcd7a74bfd1..a61e32574a70ccc52de7b96170bb847e3a20ccf3 100644 (file)
@@ -3746,7 +3746,7 @@ void insertSeparator(Cursor const & cur, depth_type const depth)
 }
 
 
-void outline(OutlineOp mode, Cursor & cur)
+void outline(OutlineOp mode, Cursor & cur, bool local)
 {
        Buffer & buf = *cur.buffer();
        Text & text = *cur.text();
@@ -3767,11 +3767,13 @@ void outline(OutlineOp mode, Cursor & cur)
        if (finish != end)
                ++finish;
 
-       // Seek the one (on same level) below
-       for (; finish != end; ++finish) {
-               toclevel = text.getTocLevel(distance(bgn, finish));
-               if (toclevel != Layout::NOT_IN_TOC && toclevel <= thistoclevel)
-                       break;
+       if (!local || (mode != OutlineIn && mode != OutlineOut)) {
+               // Seek the one (on same level) below
+               for (; finish != end; ++finish) {
+                       toclevel = text.getTocLevel(distance(bgn, finish));
+                       if (toclevel != Layout::NOT_IN_TOC && toclevel <= thistoclevel)
+                               break;
+               }
        }
 
        switch (mode) {
@@ -6248,7 +6250,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_OUTLINE_UP: {
                pos_type const opos = cur.pos();
-               outline(OutlineUp, cur);
+               outline(OutlineUp, cur, false);
                setCursor(cur, cur.pit(), opos);
                cur.forceBufferUpdate();
                needsUpdate = true;
@@ -6257,7 +6259,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_OUTLINE_DOWN: {
                pos_type const opos = cur.pos();
-               outline(OutlineDown, cur);
+               outline(OutlineDown, cur, false);
                setCursor(cur, cur.pit(), opos);
                cur.forceBufferUpdate();
                needsUpdate = true;
@@ -6265,13 +6267,13 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_OUTLINE_IN:
-               outline(OutlineIn, cur);
+               outline(OutlineIn, cur, cmd.getArg(0) == "local");
                cur.forceBufferUpdate();
                needsUpdate = true;
                break;
 
        case LFUN_OUTLINE_OUT:
-               outline(OutlineOut, cur);
+               outline(OutlineOut, cur, cmd.getArg(0) == "local");
                cur.forceBufferUpdate();
                needsUpdate = true;
                break;