]> granicus.if.org Git - icinga2/commitdiff
Fix ShowCodeFragment column numbers.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 31 Mar 2014 10:44:18 +0000 (12:44 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 31 Mar 2014 10:44:18 +0000 (12:44 +0200)
Refs #5893

lib/config/config_lexer.ll
lib/config/debuginfo.cpp

index e1038a7726e18d58a5ad4b43d67c9bbff1205eba..298a02f08e33fbc91280f7aad876996b9ca24c90 100644 (file)
@@ -34,8 +34,6 @@ using namespace icinga;
 do {                                                   \
        yylloc->Path = yyextra->GetPath();              \
        yylloc->FirstLine = yylineno;                   \
-       if (yycolumn < 1)                               \
-               yycolumn = 1;                           \
        yylloc->FirstColumn = yycolumn;                 \
        yylloc->LastLine = yylineno;                    \
        yylloc->LastColumn = yycolumn + yyleng - 1;     \
index 9992a86ad0bcea05ac955d655753ab2eb47461bd..51775a00bc673e090e6c968131ccacbbf3ec6122 100644 (file)
@@ -94,6 +94,11 @@ void icinga::ShowCodeFragment(std::ostream& out, const DebugInfo& di, bool verbo
                        if (lineno == di.LastLine)
                                end = di.LastColumn;
 
+                       if (start < 0) {
+                               end -= start;
+                               start = 0;
+                       }
+
                        out << String(pathInfo.GetLength(), ' ');
                        out << String(start, ' ');
                        out << String(end - start, '^');