From e3b36208eddc87025afb005f828316029bcf8f4f Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 28 Jul 2024 15:53:05 +0200 Subject: [PATCH] Allow DocIterator::paragraphGotoArgument() to return id() without pos() We need this for the forthcoming reference-to-paragraph function --- src/DocIterator.cpp | 7 ++++--- src/DocIterator.h | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index ace4498a56..b8f43a19bb 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -225,11 +225,12 @@ CursorSlice const & DocIterator::innerTextSlice() const } -docstring DocIterator::paragraphGotoArgument() const +docstring DocIterator::paragraphGotoArgument(bool const nopos) const { CursorSlice const & s = innerTextSlice(); - return convert(s.paragraph().id()) + ' ' + - convert(s.pos()); + return nopos ? convert(s.paragraph().id()) + : convert(s.paragraph().id()) + + ' ' + convert(s.pos()); } diff --git a/src/DocIterator.h b/src/DocIterator.h index 9475fcfb78..7c6f017b5f 100644 --- a/src/DocIterator.h +++ b/src/DocIterator.h @@ -167,8 +167,9 @@ public: Paragraph & innerParagraph() const; /// return the inner text slice. CursorSlice const & innerTextSlice() const; - // convert a DocIterator into an argument to LFUN_PARAGRAPH_GOTO - docstring paragraphGotoArgument() const; + /// convert a DocIterator into an argument to LFUN_PARAGRAPH_GOTO + /// \p nopos determines whether the cursor position is returned + docstring paragraphGotoArgument(bool const nopos = false) const; /// returns a DocIterator for the containing text inset DocIterator getInnerText() const; /// the first and last positions of a word at top cursor slice -- 2.39.5