Check for cancellation more often in highlighting

This commit is contained in:
ridiculousfish 2020-03-02 19:32:00 -08:00
parent 8355285736
commit a65e3f1876

View file

@ -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.