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 650829 - Spell Checker does not select/highlight the first spelling error
Spell Checker does not select/highlight the first spelling error
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
3.14.x
Other Linux
: Normal minor
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2011-05-23 00:22 UTC by Charles C.Blair
Modified: 2019-03-23 20:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot of catching the first spelling error in gedit 3.7.3 (72.41 KB, image/png)
2013-01-27 22:07 UTC, Jim Campbell
  Details
catching the first spelling error in 3.6.2 (74.17 KB, image/png)
2013-01-27 22:08 UTC, Jim Campbell
  Details
First screenshot showing the bug (102.55 KB, image/png)
2014-12-15 00:52 UTC, Charles C.Blair
  Details
Second screen showing subsequent spelling errors correctly hilighted (103.74 KB, image/png)
2014-12-15 00:54 UTC, Charles C.Blair
  Details
Spell check first mispelled word selection (2.47 KB, patch)
2014-12-19 02:36 UTC, Stalin Pereira
needs-work Details | Review
Spell plugin - first mispelled word selection (2.87 KB, patch)
2014-12-19 11:21 UTC, Stalin Pereira
none Details | Review
gedit spell plugin: select first mispelled word (3.80 KB, patch)
2014-12-19 13:59 UTC, sébastien lafargue
committed Details | Review

Description Charles C.Blair 2011-05-23 00:22:20 UTC
1. the specific steps or actions you took that caused you to encounter the problem,

i activated the Gedit spelling checker by clicking Tools/Check Spelling

2. the behavior you expected, and

i expected the spelling errors detected by Check Spelling to be highlighted one at a time

3. the behavior you actually encountered (in as much detail as possible).

The first error detected by Check Spelling was not highlighted in the document. All subsequent errors were correctly highlighted.

Chazbo

Note:  This bug was initially filed in Ubuntu Launchpad as bug # 645695
Comment 1 Vadim Rutkovsky 2012-03-05 11:58:27 UTC
Reproduced in gedit 3.3.5 - see https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/645695/comments/11
Comment 2 Jim Campbell 2013-01-27 22:07:32 UTC
Created attachment 234565 [details]
screenshot of catching the first spelling error in gedit 3.7.3
Comment 3 Jim Campbell 2013-01-27 22:08:09 UTC
Created attachment 234566 [details]
catching the first spelling error in 3.6.2
Comment 4 Jim Campbell 2013-01-27 22:09:01 UTC
I do not experience this issue in gedit 3.6.2 or 3.7.3 (built via jhbuild).
Comment 5 Sébastien Wilmet 2014-12-12 10:30:38 UTC
Works for me too. Feel free to reopen the bug if you still encounter the bug.
Comment 6 Charles C.Blair 2014-12-15 00:52:11 UTC
Created attachment 292724 [details]
First screenshot showing the bug

First attachment relating to 12/14/2014 comment by ccb


This shows the first spelling error, where the misspelled word is Not highlighted
(the line on which the misspelled word resides is selected).
Comment 7 Charles C.Blair 2014-12-15 00:54:20 UTC
Created attachment 292725 [details]
Second screen showing subsequent spelling errors correctly hilighted

Second Screenshot related to comment on 12/14/2014
Comment 8 Charles C.Blair 2014-12-15 00:58:44 UTC
This bug is still present in Gedit 3.10.4, running under Ubuntu 14.04
Comment 9 Sébastien Wilmet 2014-12-15 10:34:10 UTC
Now I better understand with the screenshots, and I can reproduce the bug with the latest gedit.

(In reply to comment #6)
> This shows the first spelling error, where the misspelled word is Not
> highlighted

To "highlight" a misspelled word, the plugin actually _selects_ the word.

> (the line on which the misspelled word resides is selected).

The bug also occurs when there is no selection before launching the spell checker dialog window. What you meant is probably that the misspelled word is on the current line (where the cursor is), and the current line is _highlighted_ (not selected).
Comment 10 Stalin Pereira 2014-12-19 02:36:22 UTC
Created attachment 293014 [details] [review]
Spell check first mispelled word selection

First mispelled word was not selected because the focus was stolen by the "Check spelling" dialog.

Changed get_next_misspelled_word signature to get the word start and end
Selected the word after showing the dialog
Comment 11 sébastien lafargue 2014-12-19 09:34:23 UTC
Review of attachment 293014 [details] [review]:

::: plugins/spell/gedit-spell-plugin.c
@@ +518,3 @@
 		range->mw_end = end;
+		*w_start = start;
+		*w_end = end;

you also must set *w_start and *w_end to -1 in the else part of the test

@@ +544,3 @@
 {
 	gchar *word = NULL;
+	gint   start, end;

i prefer to be more explicit and use start_offset and end_offset

@@ +769,3 @@
 	GtkWidget *dlg;
 	GtkTextIter start, end;
+	gint w_start, w_end;

and to be consistent so start_offset and end_offset too here

@@ +846,3 @@
 	gtk_widget_show (dlg);
+
+	GtkTextIter s, e;

use start_iter and end_iter

@@ +853,3 @@
+	gtk_text_buffer_select_range (GTK_TEXT_BUFFER (doc), &s, &e);
+
+	gedit_view_scroll_to_cursor (view);

but you must remove these two lines from the get_next_misspelled_word function to not select words twice
Comment 12 Stalin Pereira 2014-12-19 11:21:11 UTC
Created attachment 293040 [details] [review]
Spell plugin - first mispelled word selection

First mispelled word was not selected because the focus was stolen by the "Check spelling" dialog.

Changed get_next_misspelled_word signature to get the word start and end
Selected the word after showing the dialog
Comment 13 sébastien lafargue 2014-12-19 13:59:19 UTC
Created attachment 293054 [details] [review]
 gedit spell plugin: select first mispelled word

commited as ffbaed1