summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor
diff options
context:
space:
mode:
authorRoopesh Chander <roop@forwardbias.in>2009-10-04 00:42:02 +0530
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-02-08 16:59:10 +0100
commit764245eed27dd3b9c558580a4b33f4d2a8f430ee (patch)
tree8dba21ca769cd4f009c2a7b8c42cc53bc24b46a7 /src/plugins/texteditor
parent6fced0e5b02473d916f053184f1279c12d2034b7 (diff)
downloadqt-creator-764245eed27dd3b9c558580a4b33f4d2a8f430ee.tar.gz
don't go searching backwards for more than a hundred lines of code
Merge-request: 1766 Reviewed-by: Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r--src/plugins/texteditor/tabsettings.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/texteditor/tabsettings.cpp b/src/plugins/texteditor/tabsettings.cpp
index 890df01de4..10fe3bb49e 100644
--- a/src/plugins/texteditor/tabsettings.cpp
+++ b/src/plugins/texteditor/tabsettings.cpp
@@ -231,7 +231,8 @@ bool TabSettings::guessSpacesForTabs(const QTextBlock& _block) const {
if (m_autoSpacesForTabs && _block.isValid()) {
QTextBlock block = _block;
const QTextDocument* doc = block.document();
- while (block.isValid() && block != doc->begin()) {
+ int maxLookBack = 100;
+ while (block.isValid() && block != doc->begin() && maxLookBack-- > 0) {
block = block.previous();
if (block.text().isEmpty())
continue;