From f9fae1a34fb7bc691997f9062e030bfc6d244f54 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 4 Aug 2015 18:41:56 +0100 Subject: [PATCH] clang.kak: handle fatal errors in diagnostics --- rc/clang.kak | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rc/clang.kak b/rc/clang.kak index bbb7c840..60d8e919 100644 --- a/rc/clang.kak +++ b/rc/clang.kak @@ -69,12 +69,12 @@ def -shell-params clang-parse %{ fi flags=$(cat ${dir}/stderr | sed -rne " - /^:[0-9]+:([0-9]+:)? error/ { s/^:([0-9]+):.*/\1,red,█/; p } + /^:[0-9]+:([0-9]+:)? (fatal )?error/ { s/^:([0-9]+):.*/\1,red,█/; p } /^:[0-9]+:([0-9]+:)? warning/ { s/^:([0-9]+):.*/\1,yellow,█/; p } " | paste -s -d ':') errors=$(cat ${dir}/stderr | sed -rne " - /^:[0-9]+:([0-9]+:)? (error|warning)/ { s/^:([0-9]+):([0-9]+:)? (.*)/\1,\3/; s/'/\\\\'/g; p } + /^:[0-9]+:([0-9]+:)? ((fatal )?error|warning)/ { s/^:([0-9]+):([0-9]+:)? (.*)/\1,\3/; s/'/\\\\'/g; p } " | sort -n) sed -e "s||${kak_bufname}|g" < ${dir}/stderr > ${dir}/fifo @@ -127,8 +127,10 @@ def clang-diagnostics-next %{ %sh{ first_line=-1 while read line_content; do candidate=${line_content%%,*} - first_line=$(( first_line == -1 ? candidate : first_line )) - line=$((candidate > kak_cursor_line && (candidate < line || line == -1) ? candidate : line )) + if [ -n "$candidate" ]; then + first_line=$(( first_line == -1 ? candidate : first_line )) + line=$((candidate > kak_cursor_line && (candidate < line || line == -1) ? candidate : line )) + fi done line=$((line == -1 ? first_line : line)) if [ ${line} -ne -1 ]; then