@@ -27,6 +27,7 @@ use edit::framebuffer::{self, IndexedColor};
2727use edit:: helpers:: { CoordType , KIBI , MEBI , MetricFormatter , Rect , Size } ;
2828use edit:: input:: { self , kbmod, vk} ;
2929use edit:: oklab:: StraightRgba ;
30+ use edit:: sys:: Syscall ;
3031use edit:: tui:: * ;
3132use edit:: vt:: { self , Token } ;
3233use edit:: { apperr, arena_format, base64, path, sys, unicode} ;
@@ -51,15 +52,15 @@ fn main() -> process::ExitCode {
5152 match run ( ) {
5253 Ok ( ( ) ) => process:: ExitCode :: SUCCESS ,
5354 Err ( err) => {
54- sys:: write_stdout ( & format ! ( "{}\n " , FormatApperr :: from( err) ) ) ;
55+ sys:: syscall :: write_stdout ( & format ! ( "{}\n " , FormatApperr :: from( err) ) ) ;
5556 process:: ExitCode :: FAILURE
5657 }
5758 }
5859}
5960
6061fn run ( ) -> apperr:: Result < ( ) > {
6162 // Init `sys` first, as everything else may depend on its functionality (IO, function pointers, etc.).
62- let _sys_deinit = sys:: init ( ) ;
63+ let _sys_deinit = sys:: syscall :: init ( ) ;
6364 // Next init `arena`, so that `scratch_arena` works. `loc` depends on it.
6465 arena:: init ( SCRATCH_ARENA_CAPACITY ) ?;
6566 // Init the `loc` module, so that error messages are localized.
@@ -75,7 +76,7 @@ fn run() -> apperr::Result<()> {
7576 // `handle_args` may want to print a help message (must not fail),
7677 // and reads files (may hang; should be cancelable with Ctrl+C).
7778 // As such, we call this after `handle_args`.
78- sys:: switch_modes ( ) ?;
79+ sys:: syscall :: switch_modes ( ) ?;
7980
8081 let mut vt_parser = vt:: Parser :: new ( ) ;
8182 let mut input_parser = input:: Parser :: new ( ) ;
@@ -103,7 +104,7 @@ fn run() -> apperr::Result<()> {
103104 tui. set_modal_default_bg ( floater_bg) ;
104105 tui. set_modal_default_fg ( floater_fg) ;
105106
106- sys:: inject_window_size_into_stdin ( ) ;
107+ sys:: syscall :: inject_window_size_into_stdin ( ) ;
107108
108109 #[ cfg( feature = "debug-latency" ) ]
109110 let mut last_latency_width = 0 ;
@@ -118,7 +119,7 @@ fn run() -> apperr::Result<()> {
118119 {
119120 let scratch = scratch_arena ( None ) ;
120121 let read_timeout = vt_parser. read_timeout ( ) . min ( tui. read_timeout ( ) ) ;
121- let Some ( input) = sys:: read_stdin ( & scratch, read_timeout) else {
122+ let Some ( input) = sys:: syscall :: read_stdin ( & scratch, read_timeout) else {
122123 break ;
123124 } ;
124125
@@ -214,7 +215,7 @@ fn run() -> apperr::Result<()> {
214215 last_latency_width = cols;
215216 }
216217
217- sys:: write_stdout ( & output) ;
218+ sys:: syscall :: write_stdout ( & output) ;
218219 }
219220 }
220221
@@ -263,7 +264,7 @@ fn handle_args(state: &mut State) -> apperr::Result<bool> {
263264 cwd = parent. to_path_buf ( ) ;
264265 }
265266
266- if let Some ( mut file) = sys:: open_stdin_if_redirected ( ) {
267+ if let Some ( mut file) = sys:: syscall :: open_stdin_if_redirected ( ) {
267268 let doc = state. documents . add_untitled ( ) ?;
268269 let mut tb = doc. buffer . borrow_mut ( ) ;
269270 tb. read_file ( & mut file, None ) ?;
@@ -278,7 +279,7 @@ fn handle_args(state: &mut State) -> apperr::Result<bool> {
278279}
279280
280281fn print_help ( ) {
281- sys:: write_stdout ( concat ! (
282+ sys:: syscall :: write_stdout ( concat ! (
282283 "Usage: edit [OPTIONS] [FILE[:LINE[:COLUMN]]]\n " ,
283284 "Options:\n " ,
284285 " -h, --help Print this help message\n " ,
@@ -290,7 +291,7 @@ fn print_help() {
290291}
291292
292293fn print_version ( ) {
293- sys:: write_stdout ( concat ! ( "edit version " , env!( "CARGO_PKG_VERSION" ) , "\n " ) ) ;
294+ sys:: syscall :: write_stdout ( concat ! ( "edit version " , env!( "CARGO_PKG_VERSION" ) , "\n " ) ) ;
294295}
295296
296297fn draw ( ctx : & mut Context , state : & mut State ) {
@@ -527,12 +528,12 @@ impl Drop for RestoreModes {
527528 // Same as in the beginning but in the reverse order.
528529 // It also includes DECSCUSR 0 to reset the cursor style and DECTCEM to show the cursor.
529530 // We specifically don't reset mode 1036, because most applications expect it to be set nowadays.
530- sys:: write_stdout ( "\x1b [0 q\x1b [?25h\x1b ]0;\x07 \x1b [?1002;1006;2004l\x1b [?1049l" ) ;
531+ sys:: syscall :: write_stdout ( "\x1b [0 q\x1b [?25h\x1b ]0;\x07 \x1b [?1002;1006;2004l\x1b [?1049l" ) ;
531532 }
532533}
533534
534535fn setup_terminal ( tui : & mut Tui , state : & mut State , vt_parser : & mut vt:: Parser ) -> RestoreModes {
535- sys:: write_stdout ( concat ! (
536+ sys:: syscall :: write_stdout ( concat ! (
536537 // 1049: Alternative Screen Buffer
537538 // I put the ASB switch in the beginning, just in case the terminal performs
538539 // some additional state tracking beyond the modes we enable/disable.
@@ -570,7 +571,7 @@ fn setup_terminal(tui: &mut Tui, state: &mut State, vt_parser: &mut vt::Parser)
570571 // We explicitly set a high read timeout, because we're not
571572 // waiting for user keyboard input. If we encounter a lone ESC,
572573 // it's unlikely to be from a ESC keypress, but rather from a VT sequence.
573- let Some ( input) = sys:: read_stdin ( & scratch, Duration :: from_secs ( 3 ) ) else {
574+ let Some ( input) = sys:: syscall :: read_stdin ( & scratch, Duration :: from_secs ( 3 ) ) else {
574575 break ;
575576 } ;
576577
0 commit comments