1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Port of the `emsg()` / `did_emsg` error path from `src/nvim/message.c`.
//!
//! `message.c` is not vendored under `vendor/` (only the eval tree is), so these
//! are the extern dependencies the eval ports call, ported against their home
//! file (PORT.md Rule 9 — extern deps get local impls citing the home file).
//! The eval functions signal failure by calling `emsg()`, which sets the global
//! `did_emsg` and writes to the message area; callers checkpoint `did_emsg`
//! before an operation and compare afterward.
use ;
thread_local!
/// Begin capturing `emsg` text (suppressing stderr output), as `assert_fails()`
/// does while running the command under test.
/// Stop capturing and return the messages collected since `capture_errors_begin`.
/// Port of `emsg(const char *s)` from `Src/nvim/message.c`.
///
/// Record an error message and set `did_emsg`. C writes to the message area;
/// the faithful sink here is stderr (Vim prints errors to the user) — unless a
/// capture is active (`assert_fails`), in which case the text is collected and
/// not printed, like Vim's `emsg_silent` path.
/// Port of `semsg(const char *fmt, ...)` from `Src/nvim/message.c`.
///
/// The variadic C form is reduced to a pre-formatted message (callers format
/// with Rust's `format!` at the call site, then pass the result).