diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-05-15 18:05:24 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-05-15 18:05:24 +0000 |
commit | c95bd4de800dfc643f0dab0122757f9ca9723fe9 (patch) | |
tree | 8c4190f67f8894a3214e380a9be47352bdcb0fd9 /lib/Frontend/TextDiagnosticPrinter.cpp | |
parent | e2c31ff0bc622e6fd7d47d7e08b53840f3be6c89 (diff) |
When word-wrapping, be more defensive about a ridiculously small number of columns. Fixes <rdar://problem/6892178>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/TextDiagnosticPrinter.cpp')
-rw-r--r-- | lib/Frontend/TextDiagnosticPrinter.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index f936807b6c..09c29109f1 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -160,10 +160,12 @@ static void SelectInterestingSourceRegion(std::string &SourceLine, // If the end of the interesting region comes before we run out of // space in the terminal, start at the beginning of the line. - if (CaretEnd < Columns - 3) + if (Columns > 3 && CaretEnd < Columns - 3) CaretStart = 0; - unsigned TargetColumns = Columns - 8; // Give us extra room for the ellipses. + unsigned TargetColumns = Columns; + if (TargetColumns > 8) + TargetColumns -= 8; // Give us extra room for the ellipses. unsigned SourceLength = SourceLine.size(); while ((CaretEnd - CaretStart) < TargetColumns) { bool ExpandedRegion = false; |