Marking inverted branch insets

Yuriy Skalko yuriy.skalko at gmail.com
Thu Oct 21 10:19:43 UTC 2021


> Good question. Indeed I have used nested branches until now. But I find
> the nesting annoying, and I always have to pause to think what should I
> nest in what? But thinking about it more, perhaps your proposed feature
> would work for what I want. I don't have much time to think about this
> more now, but I do like that we're having this discussion. Perhaps we
> should write down a few use cases that would motivte which features we
> consider.
> 
> Scott

My use case: product documentation with differences for its many 
modifications and versions.


> I also think this could be useful. Probably not for 2.4, though. (I'll be emailing about that soon.) But improving the visuals for inversion, etc, can be done right away.
> 

Done in the attached patch. Now just with adding "~" to inverted insets, 
I think it is more visible than "!".


> A related thing some people have wanted is for LyX to output a LaTeX conditional depending upon branches. So e.g. we'd have:
> 
> 
> \newif\LyXBranchName
> \LyXBranchNametrue
> 
> if the branch is active, and the obvious alternative otherwise. In that case, we could also offer the option of outputting all branches to LaTeX, but conditionalizing them this way.
> 
> 
> Riki

Yes, this way LaTeX export result will be closer to LyX source.


Yuriy
-------------- next part --------------
From 1718590f4cc7066ba882a4cffbfc8b5f19cb6dd0 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 21 Oct 2021 12:56:05 +0300
Subject: [PATCH] Mark inverted branch insets

---
 src/insets/InsetBranch.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp
index 2920204fe2..69af670d39 100644
--- a/src/insets/InsetBranch.cpp
+++ b/src/insets/InsetBranch.cpp
@@ -110,8 +110,10 @@ docstring const InsetBranch::buttonLabel(BufferView const &) const
 	if (inchild && master_selected != child_selected)
 		symb += (child_selected ? tick : cross);
 
+    docstring inv_symb = from_ascii(params_.inverted ? "~" : "");
+
 	if (decoration() == InsetDecoration::MINIMALISTIC)
-		return symb + params_.branch;
+		return symb + inv_symb + params_.branch;
 
 	docstring s;
 	if (inmaster && inchild)
@@ -122,7 +124,7 @@ docstring const InsetBranch::buttonLabel(BufferView const &) const
 		s = _("Branch (master): ");
 	else // !inmaster && !inchild
 		s = _("Branch (undefined): ");
-	s += params_.branch;
+	s += inv_symb + params_.branch;
 
 	return symb + s;
 }
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list