Add optional parameter 'local' to outline-in/out

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.
This commit is contained in:
Jean-Marc Lasgouttes 2023-06-28 16:05:21 +02:00
parent a3db9a667f
commit 7cc431bd55
3 changed files with 20 additions and 13 deletions

View File

@ -173,7 +173,7 @@
* 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
@ -195,6 +195,9 @@
* 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"

View 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
*/

View 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;