[LyX/2.4.x] rename Paragraph::getLabel()

Juergen Spitzmueller spitz at lyx.org
Sun Sep 22 10:06:54 UTC 2024


commit 454800a09602032519691641d5ddc383d00b196f
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Mon Jul 29 09:08:13 2024 +0200

    rename Paragraph::getLabel()
    
    getLabel() usually refers to a paragraph label (e.g. \item) in this
    context, not \label as in the case here.
    
    (cherry picked from commit 7d46ddaa95f9f9243cffdd895184867d49cfa127)
---
 src/BufferView.cpp             | 2 +-
 src/Paragraph.cpp              | 2 +-
 src/Paragraph.h                | 5 +++--
 src/frontends/qt/TocWidget.cpp | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index a39144fbaf..8d208e4f33 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1656,7 +1656,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 		for (Buffer * b = &buffer_; i == 0 || b != &buffer_;
 			b = theBufferList().next(b)) {
 			DocIterator const dit = b->getParFromID(id);
-			string const label = dit.innerParagraph().getLabel();
+			string const label = dit.innerParagraph().getLabelForXRef();
 			if (!label.empty()) {
 				// if the paragraph has a label, we refer to this
 				string const arg = (type.empty()) ? label : label + " " + type;
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 1d1997e7ec..4fda5d9915 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3337,7 +3337,7 @@ string Paragraph::getID(Buffer const &, OutputParams const &)
 }
 
 
-string Paragraph::getLabel() const
+string Paragraph::getLabelForXRef() const
 {
 	for (pos_type i = 0; i < size(); ++i) {
 		if (Inset const * inset = getInset(i)) {
diff --git a/src/Paragraph.h b/src/Paragraph.h
index ee27e170ec..a7904dee3c 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -201,8 +201,9 @@ public:
 	/// Get the id of the paragraph, useful for DocBook
 	std::string getID(Buffer const & buf, OutputParams const & runparams) const;
 
-	/// Get the (first) string of a \label in this paragraph, or empty string
-	std::string getLabel() const;
+	/// Return the string of a´the (first) \label (cross-referencing target)
+	/// in this paragraph, or an empty string
+	std::string getLabelForXRef() const;
 
 	/// Output the first word of a paragraph, return the position where it left.
 	pos_type firstWordDocBook(XMLStream & xs, OutputParams const & runparams) const;
diff --git a/src/frontends/qt/TocWidget.cpp b/src/frontends/qt/TocWidget.cpp
index 5d69618a64..c4a16d9ff8 100644
--- a/src/frontends/qt/TocWidget.cpp
+++ b/src/frontends/qt/TocWidget.cpp
@@ -269,7 +269,7 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd,
 		// go to the item
 		sendDispatch(item.action());
 		// check if it has a label
-		docstring label = from_utf8(cur.innerParagraph().getLabel());
+		docstring label = from_utf8(cur.innerParagraph().getLabelForXRef());
 		if (label.empty()) {
 			// if not:
 			// insert a new label


More information about the lyx-cvs mailing list