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 611678 - Printing: the red squiggly line under misspelled words is also printed
Printing: the red squiggly line under misspelled words is also printed
Status: RESOLVED OBSOLETE
Product: gedit
Classification: Applications
Component: printing
3.17.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2010-03-03 09:17 UTC by Angel Abad
Modified: 2020-11-24 09:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Printing with error line under misspelled words (5.47 KB, patch)
2014-12-20 19:37 UTC, Stalin Pereira
needs-work Details | Review
Printing with error line under misspelled words (2.48 KB, patch)
2014-12-22 13:19 UTC, Stalin Pereira
none Details | Review
Printing with error line under misspelled words (2.87 KB, patch)
2014-12-22 16:35 UTC, Stalin Pereira
none Details | Review
Printing with error line under misspelled words (3.09 KB, patch)
2014-12-23 08:05 UTC, Stalin Pereira
needs-work Details | Review

Description Angel Abad 2010-03-03 09:17:31 UTC
In Ubuntu TheMiddleMan reported:

When Autocheck Spelling in the tools menu is selected and the document is printed, the red squiggly line under the misspelled words is also printed.

1. This happens in Ubuntu 8.10 and 9.04

2. gedit version 2.24.2

3. I expected the squiggly underlines to not be on the printed page

4. There are red squiggly lines on the printed page, I have to disable the autocheck spelling to make them go away

also it shows when you print to file (pdf) so if you want to test it you can save paper

- http://launchpadlibrarian.net/25828041/Screenshot.png

Launchpad ref: https://bugs.edge.launchpad.net/ubuntu/+source/gedit/+bug/364438

Thanks
Comment 1 Stalin Pereira 2014-12-20 19:37:41 UTC
Created attachment 293133 [details] [review]
Printing with error line under misspelled words

Added document signals "printing" and "printed"
Spell plugin auto_spell feature is deactivated during printing and
print preview process and reactivated after printing or print preview process
Comment 2 Garrett Regier 2014-12-20 19:48:15 UTC
Review of attachment 293133 [details] [review]:

::: gedit/gedit-document.c
@@ +503,3 @@
+	 * @document: the #GeditDocument.
+	 *
+	 * The "printing" signal is emitted while printing a file.

The "printing" signal is emitted when printing a file.

@@ +508,3 @@
+	 * when a file is opened as print preview.
+	 *
+	 *

Since 3.16

@@ +518,3 @@
+			      G_TYPE_NONE, 0);
+
+	 *

Extra newline

@@ +528,3 @@
+	 * when a file is closed after print preview.
+	 *
+			      G_OBJECT_CLASS_TYPE (object_class),

Since 3.16

::: gedit/gedit-document.h
@@ +76,3 @@
+	void (* printing)		(GeditDocument *document);
+
+	void (* printed)  		(GeditDocument *document);

This will break plugins, don't know if it really matters at this point.

::: plugins/spell/gedit-spell-plugin.c
@@ +1086,3 @@
+
+	view = GEDIT_VIEW (g_object_get_data (G_OBJECT (doc), GEDIT_AUTOMATIC_SPELL_VIEW));
+}

Shouldn't this be reset to it's prior value?
Comment 3 Sébastien Wilmet 2014-12-20 22:28:57 UTC
And what if the spell plugin is enabled during printing? It's better to have a property is-printing, so when the spell plugin starts it can check the property, and then listen to the notify signal.
Comment 4 Sébastien Wilmet 2014-12-20 22:31:35 UTC
Actually, no need to add a property, there is already GeditTab:state.
Comment 5 Stalin Pereira 2014-12-21 04:44:55 UTC
i am only disabling the autospell feature which highlights the misspelled words,
when i try to print a large file to pdf with around 90 pages, the highlighting of misspelled words will be off during rendering for that document.
During the rendering/printing process i can work on other tabs with highlighting on without any problems , after the rendering is complete the highlighting is turned back on
Comment 6 Stalin Pereira 2014-12-22 13:19:04 UTC
Created attachment 293179 [details] [review]
Printing with error line under misspelled words

Using notify::state signal to get GeditTabState
Spell plugin auto_spell feature is deactivated during printing or
print preview process and reactivated after printing or print preview process
Comment 7 Stalin Pereira 2014-12-22 16:35:25 UTC
Created attachment 293194 [details] [review]
Printing with error line under misspelled words

Checks whether the previous state was printing before reverting to the previous state.
Comment 8 Stalin Pereira 2014-12-23 08:05:28 UTC
Created attachment 293226 [details] [review]
Printing with error line under misspelled words
Comment 9 sébastien lafargue 2014-12-26 13:21:51 UTC
Review of attachment 293226 [details] [review]:

/home/slaf/spell.patch:54: trailing whitespace.
	previous_autospell_state = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tab), 
/home/slaf/spell.patch:64: trailing whitespace.
				g_action_change_state (auto_spell_action, 
/home/slaf/spell.patch:72: trailing whitespace.
		g_object_set_data (G_OBJECT (tab), "auto-spell-state", 
/home/slaf/spell.patch:73: trailing whitespace.
		                   GINT_TO_POINTER (autospell ? HIGHLIGHT_ENABLED : 
warning: 4 lignes ont ajouté des erreurs d'espace.

::: plugins/spell/gedit-spell-plugin.c
@@ -1072,0 +1073,33 @@
+on_tab_state_change (GeditTab         *tab,
+                     GParamSpec       *pspec,
+                     GeditSpellPlugin *plugin)
... 30 more ...

the state of auto_spell_action reflect the state for the active tab and is updated in update_ui.

What we need is set insensible the menu entry ( auto-spell check ) when printing or previewing and set it back to sensible when in GEDIT_TAB_STATE_NORMAL

@@ +1106,3 @@
+			}
+		}
+	}

simplify to :

if (state == GEDIT_TAB_STATE_NORMAL &&
    previous_autospell_state == HIGHLIGHT_ENABLED)

@@ -1072,0 +1073,42 @@
+on_tab_state_change (GeditTab         *tab,
+                     GParamSpec       *pspec,
+                     GeditSpellPlugin *plugin)
... 39 more ...

HIGHLIGHT_ENABLED and HIGHLIGHT_DISABLED should be aligned

@@ -1095,2 +1148,2 @@
 }
 

you must disconnect your signal in gedit_spell_plugin_deactivate for every tab where you connect it and in fact, you also must connect for every tab opened
( for the case where i activate the plugin with already opened tabs )
Comment 10 Sébastien Wilmet 2015-07-20 12:34:16 UTC
Still a problem with gedit 3.17.
Comment 11 Sébastien Wilmet 2020-11-24 09:58:11 UTC
Mass-closing of all gedit bugzilla tickets.

Special "code" to find again all those gedit bugzilla tickets that were open before the mass-closing:

2bfe1b0590a78457e1f1a6a90fb975f5878cb60064ccfe1d7db76ca0da52f0f3

By searching the above sha256sum in bugzilla, the gedit contributors can find again the tickets. We may be interested to do so when we work on a specific area of the code, to at least know the known problems and possible enhancements.

We do this mass-closing because bugzilla.gnome.org is being replaced by gitlab.gnome.org.