Bug 149533 - Spell checking: superfluous message when cursor is at end of document
Summary: Spell checking: superfluous message when cursor is at end of document
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.7.2 release
Hardware: All All
: low enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Spell-Checking
  Show dependency treegraph
 
Reported: 2022-06-12 14:22 UTC by Gerhard Weydt
Modified: 2025-07-15 20:56 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
test document to show the problem (9.61 KB, application/vnd.oasis.opendocument.text)
2022-06-12 14:22 UTC, Gerhard Weydt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard Weydt 2022-06-12 14:22:08 UTC
Created attachment 180688 [details]
test document to show the problem

When the cursor is at the end of a writer document (it seems there must be at least two paragraphs) and you press F7 or start the spellchecking via menu, you get the message "Continue checking at beginning of document?".
This is unnecessary, as the user expilicitly started the spell checking, and the entire document is checked regardless of the cursor position in any cas except the end of document.
To test, download the test document, put the cursor at the second line and press F7.
Comment 1 Daniel Lenhardt 2022-06-12 15:12:43 UTC
I can confirm that this acurres.
It would be more elegant, if the question would not apear when you start the checking at the end of the document.
Comment 2 karolus 2022-06-12 15:58:47 UTC
I can confirm with 6.1.2 on debian 10.

but about smart guessing… what does $User probably expect at the very End of LARGE writer-docs (eg 500 Pages +) ??
Comment 3 libby 2022-06-12 16:49:11 UTC Comment hidden (off-topic)
Comment 4 libby 2022-06-12 16:57:32 UTC Comment hidden (off-topic)
Comment 5 libby 2022-06-12 16:59:02 UTC Comment hidden (off-topic)
Comment 6 Gerhard Weydt 2022-06-13 10:23:34 UTC
It seems that Calc works differently, scanning for spelling errors starts with the cell the cursor is in. So the message named above may be appropriate for Calc.
Comment 7 Justin L 2025-07-03 15:28:46 UTC
The spell checker starts at the cursor position.
If there are no errors between the cursor position and the end of the document, then the first thing the user sees after opening the spell checker is this "superfluous message".

In terms of work-flow, it might be fairly common to start a spell check at the end of a document - after all the content has been created.
Comment 8 Justin L 2025-07-15 14:32:50 UTC
I would tend to mark this as a WONTFIX.
1.) What defines the "end of the document?" If there are 3 empty paragraph markers at the end of the document - is the second last one not "the end of the document"? 

2.) I can imagine that there are very good reasons in general for only spell-checking to the end of the document, and not automatically wrapping around to "end at the spellcheck's starting point". In other words, having the dialog at all is important for various work flows, and shouldn't be eliminated altogether.

3.) Making exceptions to the simple case of reached-the-end-of-the-document will simply be very error prone. Already we have edge cases of end-of-the-document -> footnotes -> draw objects -> comments etc.

In other words, what seems simple to a human (I'm at the end of the document) is not at all simple to LibreOffice. The risk/benefit of code complexity here is not worth it IMHO.
Comment 9 Gerhard Weydt 2025-07-15 15:20:16 UTC
(In reply to Justin L from comment #8)
> I would tend to mark this as a WONTFIX.
> 1.) What defines the "end of the document?" If there are 3 empty paragraph
> markers at the end of the document - is the second last one not "the end of
> the document"? 
> 
> 2.) I can imagine that there are very good reasons in general for only
> spell-checking to the end of the document, and not automatically wrapping
> around to "end at the spellcheck's starting point". In other words, having
> the dialog at all is important for various work flows, and shouldn't be
> eliminated altogether.
> 
> 3.) Making exceptions to the simple case of reached-the-end-of-the-document
> will simply be very error prone. Already we have edge cases of
> end-of-the-document -> footnotes -> draw objects -> comments etc.
> 
> In other words, what seems simple to a human (I'm at the end of the
> document) is not at all simple to LibreOffice. The risk/benefit of code
> complexity here is not worth it IMHO.

You seem to misunderstand the situation. It seems that the case of the postion of the cursor at the end of the document is treated differently:
* In the test document: put the cursor in the second line and start spellchecking -> message as descibed
* ut the cursor one poitionto the left,  i.e at end of first line (after the errors!) -> the entire document is checked, starting at the beginning
So treating the first case (corsor at end-of-document) like the rest would _reduce_ the complexity of the code!
It might be otherwise if the checking started at the cursor position, but this is not the case, the entire document is checked.
Comment 10 Justin L 2025-07-15 16:54:06 UTC
(In reply to Gerhard Weydt from comment #9) 
> You seem to misunderstand the situation.
Considering that there are only two paragraphs in this document (and the second one is empty), it hardly is a realistic document to use to identify exactly how spell checking works internally.

Spell checking works on entire paragraphs. So cursor positioning at the beginning or end of a paragraph is irrelevant for this discussion.

This is easy to prove, even using your example document. Just add a misspelled word at the end of the document and then put the cursor at "the end of the document" (which is at the end of that word) and start a spell check. It will first find that wrong word, and then ask to restart at the beginning of the document.
Comment 11 Gerhard Weydt 2025-07-15 20:56:30 UTC
Startinng not at the cursor position, but at the beginning of the paragraph is a behaviour I would never have thought of. But as it is so, I withdraw my bug report.