]> git.lyx.org Git - lyx.git/commitdiff
Allow DocIterator::paragraphGotoArgument() to return id() without pos()
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 28 Jul 2024 13:53:05 +0000 (15:53 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 28 Jul 2024 13:53:05 +0000 (15:53 +0200)
We need this for the forthcoming reference-to-paragraph function

src/DocIterator.cpp
src/DocIterator.h

index ace4498a56e91d6f4e8af525f77c567ec74544b0..b8f43a19bbd8619a7e2783d2842435e5dbf8414d 100644 (file)
@@ -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<docstring>(s.paragraph().id()) + ' ' +
-               convert<docstring>(s.pos());
+       return nopos ? convert<docstring>(s.paragraph().id())
+                    : convert<docstring>(s.paragraph().id())
+                      + ' ' + convert<docstring>(s.pos());
 }
 
 
index 9475fcfb78e44c18d795816f6f438bbcd9017fb0..7c6f017b5fb63daa4928af4fea2c1c39d82e2f58 100644 (file)
@@ -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