diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-03-08 22:31:00 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2023-03-09 00:27:25 -0500 |
commit | a705c1f07de2b8ec3ba4fe46377242f151b996c1 (patch) | |
tree | fcd415ca7390aa47b4c7af56948506fc15571fdf /src/callbacks.rs | |
parent | 939fd8bed87dd67de9d0e00ba151ef637ef1c16a (diff) | |
download | vt100-rust-a705c1f07de2b8ec3ba4fe46377242f151b996c1.tar.gz vt100-rust-a705c1f07de2b8ec3ba4fe46377242f151b996c1.zip |
use callbacks for events rather than tracking counters
Diffstat (limited to 'src/callbacks.rs')
-rw-r--r-- | src/callbacks.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/callbacks.rs b/src/callbacks.rs new file mode 100644 index 0000000..256eb58 --- /dev/null +++ b/src/callbacks.rs @@ -0,0 +1,13 @@ +/// This trait is used with `Parser::process_cb` to handle extra escape +/// sequences that don't have an impact on the terminal screen directly. +pub trait Callbacks { + /// This callback is called when the terminal requests an audible bell + /// (typically with `^G`). + fn audible_bell(&mut self, _: &mut crate::Screen) {} + /// This callback is called when the terminal requests an visual bell + /// (typically with `\eg`). + fn visual_bell(&mut self, _: &mut crate::Screen) {} + /// This callback is called when the terminal receives invalid input + /// (such as an invalid UTF-8 character or an used control character). + fn error(&mut self, _: &mut crate::Screen) {} +} |