Bug 63022 - EDITING: Text drag and drop doesn't work correctly (summary: comment 5)
Summary: EDITING: Text drag and drop doesn't work correctly (summary: comment 5)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: BSA target:5.2.0 target:5.1.2
Keywords: haveBacktrace
: 82010 83698 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-02 11:24 UTC by cwoodf02
Modified: 2016-10-25 19:08 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Linux 4.5 master backtrace (5.65 KB, text/plain)
2015-02-13 01:49 UTC, Matthew Francis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cwoodf02 2013-04-02 11:24:39 UTC
Problem description: EDITING: In a body of text, select a portion of text that contains an end-of-line, and then drag and drop the selection anywhere within the following paragraph.  This results in duplication of text.
The selection may consist of just the end-of-line of the preceding paragraph.  Drop it anyuwhere within the next paragraph, including at the end, and text is duplicated.

Steps to reproduce:
1. Create nine paragraphs of text (a minimum of five lines is required for testing, but more allows for the testing of a selection consisting of multiple paragraphs), i.e.:
Paragraph1.
Paragraph2.
Paragraph3.
Paragraph4.
Paragraph5.
Paragraph6.
Paragraph7.
Paragraph8.
Paragraph9.

2. Select from the start of paragraph 4 to the start of paragraph 7 so that the end-of-line character of paragraph 6 is last in the selection.

3. Drag the selection and drop at the end of paragraph 7.

Current behavior: Paragraphs 4 and 7 are duplicated:
Paragraph1.
Paragraph2.
Paragraph3.
Paragraph7.Paragraph4.
Paragraph5.
Paragraph6.
Paragraph7.Paragraph4

Paragraph8.
Paragraph9.

Expected behavior: Paragraph 4 should only once appear appended to the end of paragraph 7:
Paragraph1.
Paragraph2.
Paragraph3.
Paragraph7.Paragraph4.
Paragraph5.
Paragraph6.

Paragraph8.
Paragraph9.

The selection may also include a portion of the following paragraph.  In the above example, some of paragraph 7 could be included in the selection to be dropped at the end of paragraph 7.
Operating System: Windows 7
Version: 3.6.5.2 release
Comment 1 cwoodf02 2013-04-26 05:57:50 UTC
First observed in version 3.6.5.2
Still present in version 3.6.6.2
Comment 2 A (Andy) 2013-12-27 15:34:26 UTC
reproducible with LO 4.1.4.2 (Win7 Home, 64bit)

If I select in addition a few characters of the "Paragraph7." I get the following strange result:
Paragraph1.
Paragraph2.
Paragraph3.
graph7.Paragraph4.
Paragraph5.
Paragraph6.
Paragraph7.Paragraph4.
!!br0ken!!
Paragraph8.
Paragraph9.
Comment 3 Matthew Francis 2015-02-13 00:34:15 UTC
*** Bug 83698 has been marked as a duplicate of this bug. ***
Comment 4 Matthew Francis 2015-02-13 00:34:43 UTC
*** Bug 82010 has been marked as a duplicate of this bug. ***
Comment 5 Matthew Francis 2015-02-13 01:41:33 UTC
Simpler reproduction instructions as suggested by bug 83698 comment 0:

1. In a new Writer document, type "A<return>bc"
2. Select "A<return>b"
3. Drag the text after "c" using the mouse

Expected result:
- "cA
b"

Actual result:

(until recently): "cA
bcA
!!br0ken!!"

(on current dbgutil 4.5 master): Death from
soffice.bin: /home/asbel/Development/LibreOffice/core/sal/rtl/strtmpl.cxx:1394: void rtl_uString_newFromSubString(rtl_uString**, const rtl_uString*, sal_Int32, sal_Int32): Assertion `false' failed.
Comment 6 Matthew Francis 2015-02-13 01:49:42 UTC
Created attachment 113354 [details]
Linux 4.5 master backtrace
Comment 7 Matthew Francis 2015-02-13 01:55:39 UTC
Reproducing this is a little unreliable, but as near as I can tell the "!!br0ken!!" message started with the below commit. However, performing a drag and drop following the instructions in comment 5 doesn't give the correct result all the way back to 3.3, so the actual underlying bug is inherited.

Adding Cc: to mstahl@redhat.com; Any chance you could take a look at this? This commit seems to have mutated an existing bug into a somewhat worse form.


commit 8d25fde680beb9dafb7c9c861b5c00d1ae4f4985
Author: Michael Stahl <mstahl@redhat.com>
Date:   Sun Feb 17 00:14:26 2013 +0100

    sw; convert SwTxtNode::m_Text to OUString
    
    Do not convert any of the 16bit index variables at this time: the
    enforced limit of TXTNODE_MAX should ensure that they are sufficient,
    and there are thousands of these variables all around sw.
    (also, STRING_LEN/STRING_NOTFOUND is used as a "not found" value all
    over the place)
    
    Change-Id: Id26a145701de731470b0bcb95359ed62d4d6d579
Comment 8 Michael Stahl (allotropia) 2016-02-19 16:50:12 UTC
fixed on master
Comment 9 Commit Notification 2016-02-19 16:52:15 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fabc45a6a902c8988eff087831f8b2f84ea8ae6c

sw: tdf#63022 fix drag-and-drop of text in same paragraph

It will be available in 5.2.0.

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:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2016-02-19 20:19:07 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9f0e9c7c52fe2685838cfd9f71a44105a3688d1d&h=libreoffice-5-1

sw: tdf#63022 fix drag-and-drop of text in same paragraph

It will be available in 5.1.2.

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:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.