diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-02 06:04:21 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-02 06:04:21 +0900 |
| commit | 4a220b09967f84f830db029501dbef6efc4ee9f9 (patch) | |
| tree | 4d25f93d5f832dd7cc8474513f8f216a1353feb5 /crates/shirabe-external-packages/src/symfony | |
| parent | 4fa973840f0a0e2cbb16f5e3341c0625793af2ed (diff) | |
| download | php-shirabe-4a220b09967f84f830db029501dbef6efc4ee9f9.tar.gz php-shirabe-4a220b09967f84f830db029501dbef6efc4ee9f9.tar.zst php-shirabe-4a220b09967f84f830db029501dbef6efc4ee9f9.zip | |
refactor(symfony-console): drop unused Cursor methods
Remove the eight Cursor methods that have no callers, and the sscanf
shim whose only caller was Cursor::get_current_position.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/cursor.rs | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/cursor.rs b/crates/shirabe-external-packages/src/symfony/console/cursor.rs index 3ed9e3c2..7b93f281 100644 --- a/crates/shirabe-external-packages/src/symfony/console/cursor.rs +++ b/crates/shirabe-external-packages/src/symfony/console/cursor.rs @@ -29,26 +29,6 @@ impl Cursor { self } - pub fn move_down(&self, lines: i64) -> &Self { - self.output.borrow().write( - &[format!("\x1b[{}B", lines)], - false, - output_interface::OUTPUT_NORMAL, - ); - - self - } - - pub fn move_right(&self, columns: i64) -> &Self { - self.output.borrow().write( - &[format!("\x1b[{}C", columns)], - false, - output_interface::OUTPUT_NORMAL, - ); - - self - } - pub fn move_left(&self, columns: i64) -> &Self { self.output.borrow().write( &[format!("\x1b[{}D", columns)], @@ -69,16 +49,6 @@ impl Cursor { self } - pub fn move_to_position(&self, column: i64, row: i64) -> &Self { - self.output.borrow().write( - &[format!("\x1b[{};{}H", row + 1, column)], - false, - output_interface::OUTPUT_NORMAL, - ); - - self - } - pub fn save_position(&self) -> &Self { self.output.borrow().write( &["\x1b7".to_string()], @@ -99,26 +69,6 @@ impl Cursor { self } - pub fn hide(&self) -> &Self { - self.output.borrow().write( - &["\x1b[?25l".to_string()], - false, - output_interface::OUTPUT_NORMAL, - ); - - self - } - - pub fn show(&self) -> &Self { - self.output.borrow().write( - &["\x1b[?25h\x1b[?0c".to_string()], - false, - output_interface::OUTPUT_NORMAL, - ); - - self - } - /// Clears all the output from the current line. pub fn clear_line(&self) -> &Self { self.output.borrow().write( @@ -140,76 +90,4 @@ impl Cursor { self } - - /// Clears all the output from the cursors' current position to the end of the screen. - pub fn clear_output(&self) -> &Self { - self.output.borrow().write( - &["\x1b[0J".to_string()], - false, - output_interface::OUTPUT_NORMAL, - ); - - self - } - - /// Clears the entire screen. - pub fn clear_screen(&self) -> &Self { - self.output.borrow().write( - &["\x1b[2J".to_string()], - false, - output_interface::OUTPUT_NORMAL, - ); - - self - } - - /// Returns the current cursor position as x,y coordinates. - pub fn get_current_position(&self) -> Vec<i64> { - static IS_TTY_SUPPORTED: std::sync::OnceLock<bool> = std::sync::OnceLock::new(); - - let is_tty_supported = if shirabe_php_shim::function_exists("proc_open") { - *IS_TTY_SUPPORTED.get_or_init(|| { - let mut pipes = indexmap::IndexMap::new(); - shirabe_php_shim::proc_open( - "echo 1 >/dev/null", - &[ - shirabe_php_shim::Descriptor::File("/dev/tty".to_string(), "r".to_string()), - shirabe_php_shim::Descriptor::File("/dev/tty".to_string(), "w".to_string()), - shirabe_php_shim::Descriptor::File("/dev/tty".to_string(), "w".to_string()), - ], - &mut pipes, - None, - None, - None, - ) - .is_ok() - }) - } else { - false - }; - - if !is_tty_supported { - return vec![1, 1]; - } - - let stty_mode = shirabe_php_shim::shell_exec("stty -g"); - shirabe_php_shim::shell_exec("stty -icanon -echo"); - - shirabe_php_shim::fwrite(&self.input, "\x1b[6n", None); - - let code = shirabe_php_shim::trim( - shirabe_php_shim::fread(&self.input, 1024) - .as_deref() - .unwrap_or(""), - None, - ); - - shirabe_php_shim::shell_exec(&format!("stty {}", stty_mode.unwrap_or_default())); - - let mut row: i64 = 0; - let mut col: i64 = 0; - shirabe_php_shim::sscanf(&code, "\x1b[%d;%dR", &mut row, &mut col); - - vec![col, row] - } } |
