From a65e3f1876b61b66e9ef40d4fa010aa4cc4c4274 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 2 Mar 2020 19:32:00 -0800 Subject: [PATCH] Check for cancellation more often in highlighting --- src/highlight.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/highlight.cpp b/src/highlight.cpp index 25335ea75..fd9e2aa2b 100644 --- a/src/highlight.cpp +++ b/src/highlight.cpp @@ -1152,6 +1152,7 @@ highlighter_t::color_array_t highlighter_t::highlight() { // Walk the node tree. for (const parse_node_t &node : parse_tree) { + if (ctx.check_cancel()) return std::move(color_array); switch (node.type) { // Color direct string descendants, e.g. 'for' and 'in'. case symbol_while_header: @@ -1297,6 +1298,8 @@ highlighter_t::color_array_t highlighter_t::highlight() { // Must be an argument with source. if (node.type != symbol_argument || !node.has_source()) continue; + if (ctx.check_cancel()) return std::move(color_array); + // Underline every valid path. if (node_is_potential_path(buff, node, ctx.vars, working_directory)) { // It is, underline it.