Minor bugfixes

This commit is contained in:
Jakub Melka
2020-01-04 18:24:38 +01:00
parent bf4ede1574
commit 4cfd05995e
2 changed files with 5 additions and 6 deletions

View File

@ -839,7 +839,8 @@ QString PDFTextFlow::getContext(size_t index, size_t length) const
{ {
Q_ASSERT(length > 0); Q_ASSERT(length > 0);
while (index > 0 && m_characterPointers[index - 1].hasSameLine(m_characterPointers[index])) const PDFCharacterPointer& frontComparatorItem = m_characterPointers[index];
while (index > 0 && (m_characterPointers[index - 1].hasSameLine(frontComparatorItem) || !m_characterPointers[index - 1].isValid()))
{ {
--index; --index;
++length; ++length;
@ -847,13 +848,14 @@ QString PDFTextFlow::getContext(size_t index, size_t length) const
size_t currentEnd = index + length - 1; size_t currentEnd = index + length - 1;
size_t last = m_characterPointers.size() - 1; size_t last = m_characterPointers.size() - 1;
while (currentEnd < last && m_characterPointers[currentEnd].hasSameLine(m_characterPointers[currentEnd + 1])) const PDFCharacterPointer& backComparatorItem = m_characterPointers[currentEnd];
while (currentEnd < last && (m_characterPointers[currentEnd + 1].hasSameLine(backComparatorItem) || !m_characterPointers[currentEnd + 1].isValid()))
{ {
++currentEnd; ++currentEnd;
++length; ++length;
} }
return m_text.mid(int(index), int(length)); return m_text.mid(int(index), int(length)).trimmed();
} }
bool PDFCharacterPointer::hasSameBlock(const PDFCharacterPointer& other) const bool PDFCharacterPointer::hasSameBlock(const PDFCharacterPointer& other) const

View File

@ -135,9 +135,6 @@
<property name="selectionBehavior"> <property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum> <enum>QAbstractItemView::SelectRows</enum>
</property> </property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="columnCount"> <property name="columnCount">
<number>3</number> <number>3</number>
</property> </property>