Type 'appeltaart' (or something else)
> a remains in the text
(Ctrl+Del to erase the word after the cursor, works fine)
It seems it was working before thanks to a bug.
Here is why:
- function called by Ctrl backspace is SwWrtShell::DelPrvWord in
- it calls SwCrsrShell::ExtendSelection from sw/source/core/crsr/crsrsh.cxx
528 if( ++n )
529 ExtendSelection( false, -n );
Goal and params of this function:
/** extend current SSelection by n characters
@param bEnd Start counting from the end? From start otherwise.
@param nCount Number of characters.
but in 4.2, this function is defined like this:
sal_Bool SwCrsrShell::ExtendSelection( sal_Bool bEnd, xub_StrLen nCount )
whereas in master sources:
2296 bool SwCrsrShell::ExtendSelection( bool bEnd, sal_Int32 nCount )
but xub_StrLen was unsigned so -1 for example was converted in 65535
I'm not sure but it seems ExtendSelection expects the second parameter to be not negative since we have this:
2306 if( bEnd )
2308 if ((nPos + nCount) <= pTxtNd->GetTxt().getLength())
2309 nPos = nPos + nCount;
2311 return false; // not possible
2313 else if( nPos >= nCount )
2314 nPos = nPos - nCount;
So it seems DelPrvWord should be changed.
I must keep on investigation cause "// skip over all spaces" means here" is not very clear. Which spaces? Those before or those after the word to delete?
If we just want to stick to 4.2 behavior, it seems only the spaces at the end of the word must be removed.
eg: if spaces are represented with - and cursor with <>
Here is the behaviour of Ctrl Delete in 4.2 in these different cases:
I'll submit for review a patch doing the same thing.
Thanks for looking at this!
(In reply to comment #2)
> If we just want to stick to 4.2 behavior, it seems only the spaces at the
> end of the word must be removed.
Seems that this change was unintended too? If so, something to ask on UX?
Indeed! I've just tested with LO 220.127.116.11 Debian package and I've got this:
Cor: I found this patch http://cgit.freedesktop.org/libreoffice/core/commit/?id=083114bb132b879cfb899361ece375c8580ae505
Stefan/Michael: what's the expected behavior here?
1) To remove all the spaces before the word just deleted
2) To remove all the spaces but 1 before the word just deleted
3) To remove no spaces before the word just deleted
- https://gerrit.libreoffice.org/#/c/9245/ does 3)
- LO 18.104.22.168 does 1)
- LO 4.2 sources updated some days ago does 3)
(master sources is currently broken since it lets the first character of the delete word)
Delete text to beginning of word
In a list: delete an empty paragraph in front of the current paragraph"
So should be 3)?
(In reply to comment #6)
> So should be 3)?
Sounds clear and convincing. Thanks.
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":
Resolves: fdo#78150 Ctrl+Backspace does not erase first character
The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.
Oups, had forgot it. Thank you Michael for having noticed and for your review.