[LyX/master] Revert "Display bookmarks in the workarea."

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Feb 26 18:11:06 UTC 2021


commit e4ab91d802084d42a1544bf04c34754e5f9284a5
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Fri Feb 26 18:07:39 2021 +0100

    Revert "Display bookmarks in the workarea."
    
    This will be replaced by a different version.
    
    This reverts commit 99e636ae7b83dacb5acc96ae3b60a96c28339c0e.
---
 src/BufferView.cpp                  |    1 -
 src/Color.cpp                       |    3 +--
 src/ColorCode.h                     |    2 --
 src/Session.cpp                     |   14 --------------
 src/Session.h                       |    6 ------
 src/TextMetrics.cpp                 |   27 ++++-----------------------
 src/frontends/qt/GuiApplication.cpp |    1 -
 7 files changed, 5 insertions(+), 49 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 0025277..373baa4 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1472,7 +1472,6 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 		break;
 
 	case LFUN_BOOKMARK_SAVE:
-		dr.screenUpdate(Update::Force);
 		saveBookmark(convert<unsigned int>(to_utf8(cmd.argument())));
 		break;
 
diff --git a/src/Color.cpp b/src/Color.cpp
index cf297e9..53fd0ee 100644
--- a/src/Color.cpp
+++ b/src/Color.cpp
@@ -341,9 +341,8 @@ ColorSet::ColorSet()
 	{ Color_buttonhoverbg, N_("button background under focus"), "buttonhoverbg", "#C7C7CA", "#C7C7CA", "buttonhoverbg" },
 	{ Color_paragraphmarker, N_("paragraph marker"), "paragraphmarker", grey80, grey40, "paragraphmarker"},
 	{ Color_previewframe, N_("preview frame"), "previewframe", black, Linen, "previewframe"},
-	{ Color_regexpframe, N_("regexp frame"), "regexpframe", Green, green, "regexpframe" },
-	{ Color_bookmark, N_("bookmark"), "bookmark", RoyalBlue, RoyalBlue, "bookmark" },
 	{ Color_inherit, N_("inherit"), "inherit", black, Linen, "inherit" },
+	{ Color_regexpframe, N_("regexp frame"), "regexpframe", Green, green, "regexpframe" },
 	{ Color_ignore, N_("ignore"), "ignore", black, Linen, "ignore" },
 	{ Color_ignore, nullptr, nullptr, nullptr, nullptr, nullptr }
 	};
diff --git a/src/ColorCode.h b/src/ColorCode.h
index c7253ff..9badae9 100644
--- a/src/ColorCode.h
+++ b/src/ColorCode.h
@@ -228,8 +228,6 @@ enum ColorCode {
 	Color_paragraphmarker,
 	/// Preview frame color
 	Color_previewframe,
-	/// Bookmark indicator color
-	Color_bookmark,
 
 	// Logical attributes
 
diff --git a/src/Session.cpp b/src/Session.cpp
index 16b6df7..f8d6116 100644
--- a/src/Session.cpp
+++ b/src/Session.cpp
@@ -339,20 +339,6 @@ BookmarksSection::Bookmark const & BookmarksSection::bookmark(unsigned int i) co
 }
 
 
-BookmarksSection::BookmarkPosList
-BookmarksSection::bookmarksInPar(FileName const & fn, int const par_id) const
-{
-	// FIXME: we do not consider the case of bottom_pit.
-	// This is probably not a problem.
-	BookmarksSection::BookmarkPosList bip;
-	for (size_t i = 1; i < bookmarks.size(); ++i)
-		if (bookmarks[i].filename == fn && bookmarks[i].top_id == par_id)
-			bip.push_back({i, bookmarks[i].top_pos});
-
-	return bip;
-}
-
-
 LastCommandsSection::LastCommandsSection(unsigned int num) :
 	default_num_last_commands(30),
 	absolute_max_last_commands(100)
diff --git a/src/Session.h b/src/Session.h
index 857e056..09e9d7d 100644
--- a/src/Session.h
+++ b/src/Session.h
@@ -262,12 +262,6 @@ public:
 	*/
 	BookmarkList & load() { return bookmarks; }
 
-	///
-	typedef std::vector<std::pair<unsigned int, pos_type>> BookmarkPosList;
-
-	/// return a list of bookmarks and position for this paragraph
-	BookmarkPosList bookmarksInPar(support::FileName const & fn, int par_id) const;
-
 private:
 
 	/// allow 9 regular bookmarks, bookmark 0 is temporary
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index c312478..6616956 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -30,7 +30,6 @@
 #include "MetricsInfo.h"
 #include "ParagraphParameters.h"
 #include "RowPainter.h"
-#include "Session.h"
 #include "Text.h"
 #include "TextClass.h"
 #include "VSpace.h"
@@ -880,10 +879,6 @@ bool TextMetrics::breakRow(Row & row, int const right_margin) const
 {
 	LATTEST(row.empty());
 	Paragraph const & par = text_->getPar(row.pit());
-	Buffer const & buf = text_->inset().buffer();
-	BookmarksSection::BookmarkPosList bpl =
-		theSession().bookmarks().bookmarksInPar(buf.fileName(), par.id());
-
 	pos_type const end = par.size();
 	pos_type const pos = row.pos();
 	pos_type const body_pos = par.beginOfBody();
@@ -910,23 +905,7 @@ bool TextMetrics::breakRow(Row & row, int const right_margin) const
 	// or the end of the par, then build a representation of the row.
 	pos_type i = pos;
 	FontIterator fi = FontIterator(*this, par, row.pit(), pos);
-	// The real stopping condition is a few lines below.
-	while (true) {
-		// Firstly, check whether there is a bookmark here.
-		for (auto const & bp_p : bpl)
-			if (bp_p.second == i) {
-				Font f = *fi;
-				f.fontInfo().setColor(Color_bookmark);
-				// ❶ U+2776 DINGBAT NEGATIVE CIRCLED DIGIT ONE
-				char_type const ch = 0x2775 + bp_p.first;
-				row.addVirtual(i, docstring(1, ch), f, Change());
-			}
-
-		// The stopping condition is here so that the display of a
-		// bookmark can take place at paragraph start too.
-		if (i >= end || (i != pos && row.width() > width))
-			break;
-
+	while (i < end && (i == pos || row.width() <= width)) {
 		char_type c = par.getChar(i);
 		// The most special cases are handled first.
 		if (par.isInset(i)) {
@@ -1020,7 +999,9 @@ bool TextMetrics::breakRow(Row & row, int const right_margin) const
 		// in the paragraph.
 		Font f(text_->layoutFont(row.pit()));
 		f.fontInfo().setColor(Color_paragraphmarker);
-		f.setLanguage(par.getParLanguage(buf.params()));
+		BufferParams const & bparams
+			= text_->inset().buffer().params();
+		f.setLanguage(par.getParLanguage(bparams));
 		// ¶ U+00B6 PILCROW SIGN
 		row.addVirtual(end, docstring(1, char_type(0x00B6)), f, change);
 	}
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 2296a52..c504ade 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -2192,7 +2192,6 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 
 	case LFUN_BOOKMARK_CLEAR:
 		theSession().bookmarks().clear();
-		dr.screenUpdate(Update::Force);
 		break;
 
 	case LFUN_DEBUG_LEVEL_SET:


More information about the lyx-cvs mailing list