After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 663019 - bookmark name cannot include a '&'
bookmark name cannot include a '&'
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
: 756429 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-10-30 05:18 UTC by Danielle Madeley
Modified: 2015-10-16 13:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
shell: use "text" cell renderer for bookmarks sidebar (1.98 KB, patch)
2015-09-08 13:46 UTC, Felipe Borges
reviewed Details | Review
shell: Escape bookmark title (989 bytes, patch)
2015-10-14 10:11 UTC, José Aliste
accepted-commit_now Details | Review

Description Danielle Madeley 2011-10-30 05:18:00 UTC
Putting a '&' in a bookmark name causes it to pick up the name of the bookmark before it.

Expected behaviour:
 - Bookmark name gets set as typed
Comment 1 Adam Dingle 2014-08-09 12:23:25 UTC
I've noticed this too.
Comment 2 Carl Schaefer 2015-04-16 17:29:39 UTC
with evince 3.16 including an ampersand in the bookmark label produces this error:

(gv:3092): Gtk-WARNING **: Failed to set text from markup due to error parsing markup: Error on line 1: Entity did not end with a semicolon; most likely you used an ampersand character without intending to start an entity - escape ampersand as &

and the bookmark is not set.  Using "&" instead of "&" in the bookmark label works.
Comment 3 GP 2015-05-16 15:17:14 UTC
I have the same problem in evince 3.14.2.

Here is an example:

Open the following file in evince: https://www.gnome.org//wp-content/uploads/2014/09/GNOME-Annual-Report-2013.pdf

In the sidebar, go to the Bookmarks section.

On page 1, click Add to add a new bookmark. By default it will be named "Page 1".

Rename the bookmark to "&". After pressing Enter, notice that the name returns to "Page 1".

"Add" a bookmark on page 2. Notice that while the new bookmark is named "Page 2", the old one gets renamed "Page 2" too.

"Add" a bookmark on page 3. Notice that the real "Page 2" keeps its name, but the first one is renamed "Page 3".

With the cursor, hover the first bookmark. Notice that it confuses its identity and switches between "Page 2" and "Page 3".

If you rename "Page 3" to "&", it will simply obtain the name of the previous bookmark, which in this case is "Page 2".

That is all the behavior that I noticed when using "&" in bookmarks.
Comment 4 Felipe Borges 2015-09-08 13:46:13 UTC
It seems that when placing the "&" character as a bookmark title in the "markup" property of the GtkCellRendererText, it gets recognized as a malformed special entity such as ", &, <, and >.

I don't think we want any complex styling/formatting as bookmark titles. A simple solution is to place the bookmark title on the regular "text" property of the cell renderer, as proposed in the patch below.
Comment 5 Felipe Borges 2015-09-08 13:46:31 UTC
Created attachment 310903 [details] [review]
shell: use "text" cell renderer for bookmarks sidebar

We don't need the advantages of using the "markup" property for
the bookmarks sidebar. Besides, using "markup" limits the scope
of characters the user can have in a bookmark title. Characters
such "&" get recognized as malformed special entities such as
", &, <, and >.
Comment 6 Germán Poo-Caamaño 2015-09-08 15:55:14 UTC
Review of attachment 310903 [details] [review]:

Looking the history of shell/ev-sidebar-bookmarks.c it seems the page number used to be entered as a markup (<i>%d</i>), which does not happen any more since a while (2010).

The patch makes sense to me and it could be in the next stable release.

Carlos? José? Christian?
Comment 7 Germán Poo-Caamaño 2015-10-12 16:06:10 UTC
*** Bug 756429 has been marked as a duplicate of this bug. ***
Comment 8 José Aliste 2015-10-14 10:11:46 UTC
Created attachment 313252 [details] [review]
shell: Escape bookmark title

Since we are using a GMarkup rendered for the title,
we need to escape text so characters like & will be
correctly rendered by the TextView.
Comment 9 Germán Poo-Caamaño 2015-10-15 15:40:21 UTC
Review of attachment 313252 [details] [review]:

It looks ok to me.