aboutsummaryrefslogtreecommitdiff
path: root/src/error.cpp
diff options
context:
space:
mode:
authorLaytan <laytanlaats@hotmail.com>2024-05-09 19:21:39 +0200
committerLaytan <laytanlaats@hotmail.com>2024-05-09 19:21:39 +0200
commit98827c867dd88b1a72d74f0a6d703f7a25d81d91 (patch)
tree0cbc7e5a1e5fc47f8e028be0dc2a780c7122795e /src/error.cpp
parent8a1e7bb6fba1fb2c195d7fa6c153d278858cdf61 (diff)
fix duplicate suggestions and add missing newline
Diffstat (limited to 'src/error.cpp')
-rw-r--r--src/error.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/error.cpp b/src/error.cpp
index 1877a672b..688d1b34a 100644
--- a/src/error.cpp
+++ b/src/error.cpp
@@ -719,9 +719,13 @@ gb_internal void print_all_errors(void) {
}
}
- if (it.str.len-it.pos > 0) {
- array_add_elems(&prev_ev->msg, it.str.text+it.pos, it.str.len-it.pos);
+ // Merge additional text (suggestions for example) into the previous error.
+ String current = {prev_ev->msg.data, prev_ev->msg.count};
+ String addition = {it.str.text+it.pos, it.str.len-it.pos};
+ if (addition.len > 0 && !string_contains_string(current, addition)) {
+ array_add_elems(&prev_ev->msg, addition.text, addition.len);
}
+
array_free(&ev.msg);
array_ordered_remove(&global_error_collector.error_values, i);
} else {