View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0012490 | Scribus | Story Editor / Text Frames | public | 2014-07-07 09:26 | 2015-11-19 01:38 |
Reporter | JLuc | Assigned To | cbradney | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Product Version | 1.5.0svn | ||||
Target Version | 1.5.1 | Fixed in Version | 1.5.1svn | ||
Summary | 0012490: [Patch] Spell checking first word | ||||
Description | When first word of a frame is wrongly spelled, spell checker doesnt display it, but displays 2nd word and following part of the line and the 2nd line aswell. | ||||
Tags | HOST-Oman | ||||
Patch | Yes | ||||
|
I can reproduce on OSX 10.8.5 1.5svn r19322 |
|
|
|
issue#12490.patch (835 bytes)
Index: text/storytext.cpp =================================================================== --- text/storytext.cpp (revision 20509) +++ text/storytext.cpp (working copy) @@ -774,7 +774,7 @@ QString StoryText::sentence(int pos, int &posn) { int sentencePos=qMax(0, prevSentence(pos)); - sentencePos=qMax(sentencePos, nextWord(sentencePos)); + sentencePos=qMax(sentencePos, nextWord(sentencePos-1)); posn=sentencePos; int nextSentencePos=qMin(length(), nextSentence(pos+1)); return text(sentencePos, nextSentencePos-sentencePos); @@ -1462,7 +1462,7 @@ int StoryText::prevSentence(int pos) { pos = qMax(0, pos-1); - while (pos > 0 && sentenceBoundaries.indexOf(text(pos)) < 0) + while (pos >= 0 && sentenceBoundaries.indexOf(text(pos)) < 0) --pos; return sentenceBoundaries.indexOf(text(pos)) < 0 ? pos + 1 : pos; } |
|
It seems the problem happen because StoryText::sentence(int pos, int &posn) return the first sentence without the first word and that happen when StoryText::prevSentence(int pos) return wrong position of previous sentence for the first sentence in the text and which make the first word skipped.Uploaded patch fix these two functions and it work correctly.Please test it. |
|
if sentencePos can be 0 (or otherwise overflow the argument expected by nextWord()) i' m not sure that the patch can be accepted without fearing that other obscure bugs arise... |
|
What is the logic then one would need to fix this bug then ? |
|
Depending on what occurs in the second sentence which displayed correctly; prevSentence() return the position of the last character in the previous sentence and nextWord() return position of the first character of the new sentence. The same must occurs for the first sentence, So if sentencePos is 0 then the nextWord(-1) return the position of first character in first sentence which is 0. I have tested the patch for different conditions and it runs well. |
|
MrB wrote:so the problem with [this bug] is that i know i have had the first word checked and corrected ok.. so we need to be sure it is ok but i did notice this sometimes when i converted us to hunspell i'm not sure what happens with the patch when pos = 0 i'm not sure for [this bug]... the code changes are in the text code.. and will affect a lot more than just the spelling. we'll need to test a few more things |
|
Rewrote quite a bit and this should be fixed |
|
This looks like it's fixed on OSX 10.10.5 1.5.1svn r20558 by Craig. Thanks for IbtisamN for the proposed patch and getting this bug on the radar :) Please confirm fixes for other OSs |
|
Closing |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-07-07 09:26 | JLuc | New Issue | |
2014-07-07 12:07 | Kunda | Note Added: 0032534 | |
2014-07-07 12:07 | Kunda | Status | new => confirmed |
2014-07-07 12:07 | Kunda | Target Version | => 1.5.1 |
2014-07-07 12:08 | Kunda | File Added: spellchecker-first-word-missing.png | |
2015-09-17 20:08 | Kunda | Category | Story Editor / Text Frames => Story Ed/Txt Frames |
2015-09-17 20:12 | Kunda | Category | Story Ed/Txt Frames => Story Editor / Text Frames |
2015-11-04 11:52 | IbtisamN | File Added: issue#12490.patch | |
2015-11-04 12:17 | IbtisamN | Note Added: 0037216 | |
2015-11-04 12:18 | IbtisamN | Tag Attached: HOST-Oman | |
2015-11-05 10:45 | ale | Note Added: 0037253 | |
2015-11-05 12:23 | Kunda | Sticky Issue | No => Yes |
2015-11-10 15:53 | Kunda | Note Added: 0037386 | |
2015-11-11 04:21 | IbtisamN | Note Added: 0037410 | |
2015-11-11 15:25 | Kunda | Patch | => Yes |
2015-11-11 15:25 | Kunda | Summary | Spell checking first word => [Patch] Spell checking first word |
2015-11-12 23:42 | Kunda | Note Added: 0037454 | |
2015-11-12 23:43 | Kunda | Note Edited: 0037454 | |
2015-11-16 22:58 | cbradney | Note Added: 0037521 | |
2015-11-16 22:58 | cbradney | Status | confirmed => resolved |
2015-11-16 22:58 | cbradney | Fixed in Version | => 1.5.1svn |
2015-11-16 22:58 | cbradney | Resolution | open => fixed |
2015-11-16 22:58 | cbradney | Assigned To | => cbradney |
2015-11-18 11:57 | Kunda | Note Added: 0037534 | |
2015-11-18 17:55 | jghali | Sticky Issue | Yes => No |
2015-11-19 01:38 | Kunda | Note Added: 0037542 | |
2015-11-19 01:38 | Kunda | Status | resolved => closed |