qt5base-lts/src/gui/text
Eskil Abrahamsen Blomfeldt 24914b1acb Qt Quick: Fix bug for selections with line wraps and breaks
This fixes yet another bug where the selection spans both line
wraps and explicit line breaks. Offsetting the log clusters by
the text position in 342c909b34
was not entirely correct, because in some cases the script
item will refer to a specific part of the string, as indicated
by si.position, while iterator.itemStart is in the context
of the full string.

In this case, the log cluster array pointer we use refers to the
script item's part of the array, i.e. it is already offset by
si.position. Therefore, we must offset the logClusters pointer by the
text position *relative* to the current script item. Previously
we would actually offset by si.position twice in cases where
si.position != 0.

We want the text range to refer to the full string, though,
so it can be compared to other text ranges later. However,
in some cases when we are requesting only part of a script item,
then iterator.itemStart does not correspond to relativeFrom,
so in order for the text range search to work, we must pass in
the text positions we are using [relativeFrom, relativeTo],
though offset by si.position so that it refers to the full
string and not just the part addressed by the script item.

Task-number: QTBUG-51759
Change-Id: Ib69856d6d3bc1dd501db94c9d295623f436d122c
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-04-08 09:44:06 +00:00
..
qabstracttextdocumentlayout_p.h QAbstractTextDocumentLayoutPrivate: declare dtor out-of-line and export class 2015-06-01 05:23:38 +00:00
qabstracttextdocumentlayout.cpp De-duplicate vtables, part II: exported public classes 2015-06-03 12:02:59 +00:00
qabstracttextdocumentlayout.h QtGui: Use Q_NULLPTR instead of 0 in all public headers 2015-07-19 10:32:55 +00:00
qcssparser_p.h Ensure that CSS rules are inherited from the parent tags 2015-03-25 11:55:47 +00:00
qcssparser.cpp gui: Add several QList::reserve() calls. 2015-06-22 14:03:39 +00:00
qcssscanner.cpp Update copyright headers 2015-02-11 06:49:51 +00:00
qdistancefield_p.h Allow QDistanceField to be directly constructed from a QPainterPath. 2015-02-25 14:35:46 +00:00
qdistancefield.cpp Fix possible out-of-bounds access when making distance fields 2016-03-31 12:53:26 +00:00
qfont_p.h Decrease the cache if necessary when adding a new font 2015-12-16 13:13:02 +00:00
qfont.cpp Correct qt_defaultDpi X/Y with just a QCoreApplication 2016-03-16 10:37:39 +00:00
qfont.h Add noexcept to move constructors and assignment operators 2015-05-04 11:27:48 +00:00
qfontdatabase.cpp Reduce allocations by using reserve() 2016-02-07 16:50:26 +00:00
qfontdatabase.h Simplify QFontDatabase::findFont() 2015-05-13 01:08:33 +00:00
qfontengine_ft_p.h QFontEngine: Add handle() function 2016-03-29 17:37:35 +00:00
qfontengine_ft.cpp QFontEngineFT: Apply hinting for non-scaled rotated glyphs 2016-03-30 10:33:12 +00:00
qfontengine_p.h QFontEngine: Add handle() function 2016-03-29 17:37:35 +00:00
qfontengine_qpf2_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
qfontengine_qpf2.cpp Merge remote-tracking branch 'origin/5.4' into 5.5 2015-07-17 17:53:19 +02:00
qfontengine.cpp QFontEngine: Add handle() function 2016-03-29 17:37:35 +00:00
qfontengineglyphcache_p.h Q*GlyphCache: de-inline dtor and export vtable 2015-05-26 17:51:47 +00:00
qfontengineglyphcache.cpp Q*GlyphCache: de-inline dtor and export vtable 2015-05-26 17:51:47 +00:00
qfontinfo.h Update copyright headers 2015-02-11 06:49:51 +00:00
qfontmetrics.cpp Doc: Fixed Qt::TextWordBreak to Qt::TextWordWrap 2016-02-15 14:22:29 +00:00
qfontmetrics.h QtGui: Use Q_NULLPTR instead of 0 in all public headers 2015-07-19 10:32:55 +00:00
qfontsubset_agl.cpp Update copyright headers 2015-02-11 06:49:51 +00:00
qfontsubset_p.h QFontSubset: mark local types movable and hold in QVector, not QList 2015-06-20 04:38:40 +00:00
qfontsubset.cpp Reduce allocations by using reserve() 2016-02-07 16:50:26 +00:00
qfragmentmap_p.h Check for integer overflows in places where qAllocMore is used 2015-06-19 15:18:15 +00:00
qfragmentmap.cpp Update copyright headers 2015-02-11 06:49:51 +00:00
qglyphrun_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
qglyphrun.cpp doc: Remove uses of \mainclass 2015-06-05 09:37:55 +00:00
qglyphrun.h QtGui: make all Q_DECLARE_SHARED types nothrow move-assignable 2015-06-30 16:34:26 +00:00
qharfbuzzng_p.h Disable ligatures using existing mechanism in HB, not workaround 2016-02-24 09:01:29 +00:00
qharfbuzzng.cpp Disable ligatures using existing mechanism in HB, not workaround 2016-02-24 09:01:29 +00:00
qplatformfontdatabase.cpp Merge remote-tracking branch 'origin/5.5' into dev 2015-08-06 10:54:01 +02:00
qplatformfontdatabase.h Remove <qhash.h> where it's not used 2015-04-20 07:41:34 +00:00
qrawfont_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
qrawfont.cpp QRawFont: fix UB in supportedWritingSystems() 2016-03-23 10:42:45 +00:00
qrawfont.h QtGui: make all Q_DECLARE_SHARED types nothrow move-assignable 2015-06-30 16:34:26 +00:00
qstatictext_p.h QStaticTextUserData: declare dtor out-of-line and export class 2015-06-03 12:02:49 +00:00
qstatictext.cpp Enable non-integer device pixel ratio 2015-07-30 04:04:01 +00:00
qstatictext.h QtGui: make all Q_DECLARE_SHARED types nothrow move-assignable 2015-06-30 16:34:26 +00:00
qsyntaxhighlighter.cpp Fix users of QTextLayout::additionalFormats to use the new API 2015-05-30 10:56:24 +00:00
qsyntaxhighlighter.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtextcursor_p.h Revert some changes to QTextCursor constructors 2016-01-28 18:42:14 +00:00
qtextcursor.cpp Revert some changes to QTextCursor constructors 2016-01-28 18:42:14 +00:00
qtextcursor.h Revert some changes to QTextCursor constructors 2016-01-28 18:42:14 +00:00
qtextdocument_p.cpp Revert some changes to QTextCursor constructors 2016-01-28 18:42:14 +00:00
qtextdocument_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtextdocument.cpp Hide better the private API QTextCursor constructors 2016-01-22 03:36:16 +00:00
qtextdocument.h Fix nullptr literal 0s which would look odd as nullptr 2015-07-19 10:33:12 +00:00
qtextdocumentfragment_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtextdocumentfragment.cpp Update copyright headers 2015-02-11 06:49:51 +00:00
qtextdocumentfragment.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtextdocumentlayout_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtextdocumentlayout.cpp QtGui: Pass types with copy-ctor or dtor by const-ref 2015-07-19 10:46:53 +00:00
qtextdocumentwriter.cpp Update copyright headers 2015-02-11 06:49:51 +00:00
qtextdocumentwriter.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtextengine_p.h Disable unneeded ligatures when letter spacing is set 2016-02-19 10:47:54 +00:00
qtextengine.cpp Increase chances of finding the ellipsis glyph in elided text 2016-03-07 14:05:04 +00:00
qtextformat_p.h Remove <qhash.h> where it's not used 2015-04-20 07:41:34 +00:00
qtextformat.cpp Merge remote-tracking branch 'origin/5.5' into dev 2015-07-01 11:05:26 +02:00
qtextformat.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtexthtmlparser_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtexthtmlparser.cpp Provide QCss with the correct font for <pre> blocks 2016-02-09 21:24:46 +00:00
qtextimagehandler_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtextimagehandler.cpp Make qt_findAtNxFile return the source device pixel ratio 2015-11-13 15:05:12 +00:00
qtextlayout.cpp Qt Quick: Fix bug for selections with line wraps and breaks 2016-04-08 09:44:06 +00:00
qtextlayout.h QtGui: Use Q_NULLPTR instead of 0 in all public headers 2015-07-19 10:32:55 +00:00
qtextlist.cpp Update copyright headers 2015-02-11 06:49:51 +00:00
qtextlist.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtextobject_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtextobject.cpp Hide better the private API QTextCursor constructors 2016-01-22 03:36:16 +00:00
qtextobject.h QtGui: Use Q_NULLPTR instead of 0 in all public headers 2015-07-19 10:32:55 +00:00
qtextodfwriter_p.h QtGui: Pass types with copy-ctor or dtor by const-ref 2015-07-19 10:46:53 +00:00
qtextodfwriter.cpp QTextOdfWriter: Added support for hyperlinks. 2015-11-30 02:24:32 +00:00
qtextoption.cpp gui: Add several QList::reserve() calls. 2015-06-22 14:03:39 +00:00
qtextoption.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtexttable_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtexttable.cpp Hide better the private API QTextCursor constructors 2016-01-22 03:36:16 +00:00
qtexttable.h QtGui: Use Q_NULLPTR instead of 0 in all public headers 2015-07-19 10:32:55 +00:00
qzip.cpp Fix broken permission to mode mapping 2015-12-19 15:03:55 +00:00
qzipreader_p.h QZip*: don't hold QZipReader::FileInfo in QList 2015-07-19 10:35:41 +00:00
qzipwriter_p.h Update copyright headers 2015-02-11 06:49:51 +00:00
text.pri src/gui/text/text.pri: add missing header qabstracttextdocumentlayout_p.h 2015-06-01 05:22:05 +00:00