Re: [LyX/master] Display bookmarks in the workarea.

2021-01-08 Thread Jean-Marc Lasgouttes

Le 08/01/2021 à 18:07, Kornel Benko a écrit :

But I see the point. OTOH, if you have a good idea of a unicode
character that helps understand that this is a bookmark, this might be
useful.



U+1f516 ?


No emoji, unfortunately. I also tried an anchor symbol.

JMarc
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Display bookmarks in the workarea.

2021-01-08 Thread Kornel Benko
Am Fri, 8 Jan 2021 18:07:15 +0100
schrieb Kornel Benko :

> Am Fri, 8 Jan 2021 15:57:38 +0100
> schrieb Jean-Marc Lasgouttes :
> 
> > Le 08/01/2021 à 14:16, Pavel Sanda a écrit :  
> > > On Wed, Jan 06, 2021 at 08:32:50PM +0100, Jean-Marc Lasgouttes wrote:
> > >> Please try it out even if you are not big users of bookmarks. I do not 
> > >> use
> > >> them myself, so I do not know what a good UI is.
> > > 
> > > I think it should have tootltip saying it's bookmark, otherwise it migh
> > > be confusing for someone randomly encoutering this element.
> > 
> > We do not have support for that currently. Tootips are for insets.
> > 
> > But I see the point. OTOH, if you have a good idea of a unicode 
> > character that helps understand that this is a bookmark, this might be 
> > useful.
> > 
> > JMarc  
> 
> U+1f516 ?
> 
>   Kornel

Interestingly 'vi' can display the char, while lyx does not.

Not many fonts have it:
Font : Emoji One Regular [ADBO]
Font : Hana Min A Regular [PfEd]
Font : Noto Color Emoji Regular [GOOG]
Font : Noto Emoji Regular [GOOG]
Font : Symbola Regular [Free]
Font : fontello Medium [PfEd]

and only "Symbola Regular" and "Hana Min A Regular" contain also ascii

Kornel


pgpg3Z2xFPvc2.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Display bookmarks in the workarea.

2021-01-08 Thread Kornel Benko
Am Fri, 8 Jan 2021 15:57:38 +0100
schrieb Jean-Marc Lasgouttes :

> Le 08/01/2021 à 14:16, Pavel Sanda a écrit :
> > On Wed, Jan 06, 2021 at 08:32:50PM +0100, Jean-Marc Lasgouttes wrote:  
> >> Please try it out even if you are not big users of bookmarks. I do not use
> >> them myself, so I do not know what a good UI is.  
> > 
> > I think it should have tootltip saying it's bookmark, otherwise it migh
> > be confusing for someone randomly encoutering this element.  
> 
> We do not have support for that currently. Tootips are for insets.
> 
> But I see the point. OTOH, if you have a good idea of a unicode 
> character that helps understand that this is a bookmark, this might be 
> useful.
> 
> JMarc

U+1f516 ?

Kornel


pgpmfaDa8KiPD.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Display bookmarks in the workarea.

2021-01-08 Thread Jean-Marc Lasgouttes

Le 08/01/2021 à 14:16, Pavel Sanda a écrit :

On Wed, Jan 06, 2021 at 08:32:50PM +0100, Jean-Marc Lasgouttes wrote:

Please try it out even if you are not big users of bookmarks. I do not use
them myself, so I do not know what a good UI is.


I think it should have tootltip saying it's bookmark, otherwise it migh
be confusing for someone randomly encoutering this element.


We do not have support for that currently. Tootips are for insets.

But I see the point. OTOH, if you have a good idea of a unicode 
character that helps understand that this is a bookmark, this might be 
useful.


JMarc
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Display bookmarks in the workarea.

2021-01-08 Thread Pavel Sanda
On Wed, Jan 06, 2021 at 08:32:50PM +0100, Jean-Marc Lasgouttes wrote:
> Please try it out even if you are not big users of bookmarks. I do not use
> them myself, so I do not know what a good UI is.

I think it should have tootltip saying it's bookmark, otherwise it migh
be confusing for someone randomly encoutering this element.

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Display bookmarks in the workarea.

2021-01-06 Thread Jean-Marc Lasgouttes

Le 06/01/2021 à 22:05, Richard Kimberly Heck a écrit :

I find the markers in the middle of lines a bit distracting. Would it be
possible to put them in the margins? I think that would be good enough.
You don't need to know exactly where the bookmark is.


At least in the text I can make room for them. I am not sure I have 
enough margin available, but I can think about it.


Note that I can always revert the whole thing, it it not a very big 
deal. But I'd rather have other thought before trying the margin way, 
since it has to be done at a different level. (I have to think about it 
a bit).


JMarc
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Display bookmarks in the workarea.

2021-01-06 Thread Richard Kimberly Heck
On 1/6/21 2:44 PM, Richard Kimberly Heck wrote:
> On 1/6/21 2:32 PM, Jean-Marc Lasgouttes wrote:
>> Le 06/01/2021 à 20:21, Jean-Marc Lasgouttes a écrit :
>>> commit 99e636ae7b83dacb5acc96ae3b60a96c28339c0e
>>> Author: Jean-Marc Lasgouttes 
>>> Date:   Wed Jan 6 19:21:26 2021 +0100
>>>
>>>  Display bookmarks in the workarea.
>>>   The bookmarks are added as virtual elements in display
>>> Rows. Bookmarks
>>>  are shown with circled numbers. A new color "bookmarks" has been
>>>  added. Currently bookmark 0 (the return position) is not displayed
>>>  because it is very disturbing in practice.
>> Please try it out even if you are not big users of bookmarks. I do not
>> use them myself, so I do not know what a good UI is.

I find the markers in the middle of lines a bit distracting. Would it be
possible to put them in the margins? I think that would be good enough.
You don't need to know exactly where the bookmark is.

Riki


-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Display bookmarks in the workarea.

2021-01-06 Thread Richard Kimberly Heck
On 1/6/21 2:32 PM, Jean-Marc Lasgouttes wrote:
> Le 06/01/2021 à 20:21, Jean-Marc Lasgouttes a écrit :
>> commit 99e636ae7b83dacb5acc96ae3b60a96c28339c0e
>> Author: Jean-Marc Lasgouttes 
>> Date:   Wed Jan 6 19:21:26 2021 +0100
>>
>>  Display bookmarks in the workarea.
>>   The bookmarks are added as virtual elements in display
>> Rows. Bookmarks
>>  are shown with circled numbers. A new color "bookmarks" has been
>>  added. Currently bookmark 0 (the return position) is not displayed
>>  because it is very disturbing in practice.
>
> Please try it out even if you are not big users of bookmarks. I do not
> use them myself, so I do not know what a good UI is.
>
> I also tried to display the return position with a nice anchor ⚓, but
> it turns out that it is updated far too often to make this useful. I
> am try it again later, but I do not have that many ideas :) Is someone
> a user of this "go back" feature? How would you like to display the
> position in the workarea?

I use that sometimes, but I don't think a display is all that helpful
and so not all that urgent. I think the normal process would be to 'go
back' quite soon, when it will be off-screen anyway. I.e., the one time
I do use it is with the reference dialog: Go see the label, then go
right back.

Riki


-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Display bookmarks in the workarea.

2021-01-06 Thread Jean-Marc Lasgouttes

Le 06/01/2021 à 20:21, Jean-Marc Lasgouttes a écrit :

commit 99e636ae7b83dacb5acc96ae3b60a96c28339c0e
Author: Jean-Marc Lasgouttes 
Date:   Wed Jan 6 19:21:26 2021 +0100

 Display bookmarks in the workarea.
 
 The bookmarks are added as virtual elements in display Rows. Bookmarks

 are shown with circled numbers. A new color "bookmarks" has been
 added. Currently bookmark 0 (the return position) is not displayed
 because it is very disturbing in practice.


Please try it out even if you are not big users of bookmarks. I do not 
use them myself, so I do not know what a good UI is.


I also tried to display the return position with a nice anchor ⚓, but it 
turns out that it is updated far too often to make this useful. I am try 
it again later, but I do not have that many ideas :) Is someone a user 
of this "go back" feature? How would you like to display the position in 
the workarea?


JMarc


 To make this work, a new method BookmarksSection::bookmarksInPar
 retuns the list of bookmarks in a paragraph along with their position.
 
 Force redraw when using bookmark-save and bookmark-clear.
 
 Fixes bug #2496.

---
  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, 49 insertions(+), 5 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 3e807ff..afd9ada 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1449,6 +1449,7 @@ void BufferView::dispatch(FuncRequest const & cmd, 
DispatchResult & dr)
break;
  
  	case LFUN_BOOKMARK_SAVE:

+   dr.screenUpdate(Update::Force);
saveBookmark(convert(to_utf8(cmd.argument(;
break;
  
diff --git a/src/Color.cpp b/src/Color.cpp

index 627b62b..6248e67 100644
--- a/src/Color.cpp
+++ b/src/Color.cpp
@@ -331,8 +331,9 @@ 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_inherit, N_("inherit"), "inherit", black, Linen, "inherit" },
{ 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_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 9badae9..c7253ff 100644
--- a/src/ColorCode.h
+++ b/src/ColorCode.h
@@ -228,6 +228,8 @@ 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 f8d6116..16b6df7 100644
--- a/src/Session.cpp
+++ b/src/Session.cpp
@@ -339,6 +339,20 @@ 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 09e9d7d..857e056 100644
--- a/src/Session.h
+++ b/src/Session.h
@@ -262,6 +262,12 @@ public:
*/
BookmarkList & load() { return bookmarks; }
  
+	///

+   typedef std::vector> 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 0f2ef90..0f1814c 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -30,6 +30,7 @@
  #include "MetricsInfo.h"
  #include "ParagraphParameters.h"
  #include "RowPainter.h"
+#include 

Re: [LyX/master] Display bookmarks in the workarea. (#2496)

2021-01-06 Thread Richard Kimberly Heck

Always great to see super-old bugs fixed!

On 1/6/21 2:21 PM, Jean-Marc Lasgouttes wrote:
> commit 99e636ae7b83dacb5acc96ae3b60a96c28339c0e
> Author: Jean-Marc Lasgouttes 
> Date:   Wed Jan 6 19:21:26 2021 +0100
>
> Display bookmarks in the workarea.
> 
> The bookmarks are added as virtual elements in display Rows. Bookmarks
> are shown with circled numbers. A new color "bookmarks" has been
> added. Currently bookmark 0 (the return position) is not displayed
> because it is very disturbing in practice.
> 
> To make this work, a new method BookmarksSection::bookmarksInPar
> retuns the list of bookmarks in a paragraph along with their position.
> 
> Force redraw when using bookmark-save and bookmark-clear.
> 
> Fixes bug #2496.
> ---
>  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, 49 insertions(+), 5 deletions(-)
>
> diff --git a/src/BufferView.cpp b/src/BufferView.cpp
> index 3e807ff..afd9ada 100644
> --- a/src/BufferView.cpp
> +++ b/src/BufferView.cpp
> @@ -1449,6 +1449,7 @@ void BufferView::dispatch(FuncRequest const & cmd, 
> DispatchResult & dr)
>   break;
>  
>   case LFUN_BOOKMARK_SAVE:
> + dr.screenUpdate(Update::Force);
>   saveBookmark(convert(to_utf8(cmd.argument(;
>   break;
>  
> diff --git a/src/Color.cpp b/src/Color.cpp
> index 627b62b..6248e67 100644
> --- a/src/Color.cpp
> +++ b/src/Color.cpp
> @@ -331,8 +331,9 @@ 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_inherit, N_("inherit"), "inherit", black, Linen, "inherit" },
>   { 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_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 9badae9..c7253ff 100644
> --- a/src/ColorCode.h
> +++ b/src/ColorCode.h
> @@ -228,6 +228,8 @@ 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 f8d6116..16b6df7 100644
> --- a/src/Session.cpp
> +++ b/src/Session.cpp
> @@ -339,6 +339,20 @@ 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 09e9d7d..857e056 100644
> --- a/src/Session.h
> +++ b/src/Session.h
> @@ -262,6 +262,12 @@ public:
>   */
>   BookmarkList & load() { return bookmarks; }
>  
> + ///
> + typedef std::vector> 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 0f2ef90..0f1814c 100644
> --- a/src/TextMetrics.cpp
> +++ b/src/TextMetrics.cpp
> @@ -30,6 +30,7 @@
>  #include "MetricsInfo.h"
>  #include "ParagraphParameters.h"
>  #include "RowPainter.h"
> +#include "Session.h"
>  #include "Text.h"
>  #include "TextClass.h"
>  #include "VSpace.h"
> @@ -877,6 +878,10 @@ bool TextMetrics::breakRow(Row & row, int const 
> right_margin) const
>  {
>   LATTEST(row.empty());
>   Paragraph const & par =