Changeset View
Changeset View
Standalone View
Standalone View
src/search/katesearchbar.cpp
Show First 20 Lines • Show All 804 Lines • ▼ Show 20 Line(s) | 797 | { | |||
---|---|---|---|---|---|
805 | 805 | | |||
806 | KTextEditor::MovingRange *workingRange = m_view->doc()->newMovingRange(inputRange); | 806 | KTextEditor::MovingRange *workingRange = m_view->doc()->newMovingRange(inputRange); | ||
807 | QList<Range> highlightRanges; | 807 | QList<Range> highlightRanges; | ||
808 | int matchCounter = 0; | 808 | int matchCounter = 0; | ||
809 | 809 | | |||
810 | bool block = m_view->selection() && m_view->blockSelection(); | 810 | bool block = m_view->selection() && m_view->blockSelection(); | ||
811 | int line = inputRange.start().line(); | 811 | int line = inputRange.start().line(); | ||
812 | do { | 812 | do { | ||
813 | if (block) { | 813 | if (block) { | ||
anthonyfieroni: You can preserve say 1024 i think. | |||||
If it's not an issue at all, I prefer to have limits that are realistic. If it scales well for, say 4096, then 4096 is the better choice. dhaumann: If it's not an issue at all, I prefer to have limits that are realistic. If it scales well for… | |||||
Actually, on a decent machine, 64k things work. cullmann: Actually, on a decent machine, 64k things work.
The issue with corner cases like this test is… | |||||
814 | delete workingRange; | ||||
814 | workingRange = m_view->doc()->newMovingRange(m_view->doc()->rangeOnLine(inputRange, line)); | 815 | workingRange = m_view->doc()->newMovingRange(m_view->doc()->rangeOnLine(inputRange, line)); | ||
815 | } | 816 | } | ||
816 | 817 | | |||
817 | for (;;) { | 818 | for (;;) { | ||
818 | KateMatch match(m_view->doc(), enabledOptions); | 819 | KateMatch match(m_view->doc(), enabledOptions); | ||
819 | match.searchText(*workingRange, searchPattern()); | 820 | match.searchText(*workingRange, searchPattern()); | ||
820 | if (!match.isValid()) { | 821 | if (!match.isValid()) { | ||
821 | break; | 822 | break; | ||
Show All 11 Lines | 827 | if (replacement != nullptr) { | |||
833 | 834 | | |||
834 | // Highlight and continue after adjusted match | 835 | // Highlight and continue after adjusted match | ||
835 | //highlightReplacement(*afterReplace); | 836 | //highlightReplacement(*afterReplace); | ||
836 | highlightRanges << afterReplace; | 837 | highlightRanges << afterReplace; | ||
837 | } else { | 838 | } else { | ||
838 | // Highlight and continue after original match | 839 | // Highlight and continue after original match | ||
839 | //highlightMatch(match); | 840 | //highlightMatch(match); | ||
840 | highlightRanges << match.range(); | 841 | highlightRanges << match.range(); | ||
841 | matchCounter++; | 842 | matchCounter++; | ||
Why you clear highlights, you can break and continue with stored ones no? anthonyfieroni: Why you clear highlights, you can break and continue with stored ones no? | |||||
842 | } | 843 | } | ||
843 | 844 | | |||
844 | // Continue after match | 845 | // Continue after match | ||
845 | if (highlightRanges.last().end() >= workingRange->end()) { | 846 | if (highlightRanges.last().end() >= workingRange->end()) { | ||
846 | break; | 847 | break; | ||
847 | } | 848 | } | ||
848 | KTextEditor::DocumentCursor workingStart(m_view->doc(), highlightRanges.last().end()); | 849 | KTextEditor::DocumentCursor workingStart(m_view->doc(), highlightRanges.last().end()); | ||
849 | if (originalMatchEmpty) { | 850 | if (originalMatchEmpty) { | ||
▲ Show 20 Lines • Show All 804 Lines • Show Last 20 Lines |
You can preserve say 1024 i think.