From 17616100df604a60c65f1acff69991cbad52caa7 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sat, 9 Jun 2018 21:59:43 +0200 Subject: [PATCH] Added alternate screen support for unix systems --- .idea/workspace.xml | 1119 ++++++++++++++----------- Cargo.toml | 6 +- examples/bin.rs | 6 +- examples/cursor/mod.rs | 23 +- examples/terminal/alternate_screen.rs | 200 +++-- examples/terminal/mod.rs | 2 +- examples/terminal/terminal.rs | 53 +- src/cursor/ansi_cursor.rs | 80 +- src/cursor/cursor.rs | 57 +- src/cursor/mod.rs | 25 +- src/cursor/winapi_cursor.rs | 18 +- src/kernel/mod.rs | 3 +- src/kernel/unix_kernel/terminal.rs | 13 +- src/kernel/windows_kernel/handle.rs | 78 ++ src/lib.rs | 5 +- src/manager/ansi_manager.rs | 63 ++ src/manager/manager.rs | 45 + src/manager/mod.rs | 21 + src/manager/terminal.rs | 86 ++ src/manager/win_manager.rs | 4 + src/shared/functions.rs | 13 +- src/shared/traits.rs | 8 +- src/state/commands/mod.rs | 11 +- src/state/commands/shared_commands.rs | 24 +- src/state/commands/unix_command.rs | 10 +- src/state/commands/win_commands.rs | 8 +- src/state/context.rs | 30 +- src/style/color/ansi_color.rs | 29 +- src/style/color/color.rs | 80 +- src/style/color/mod.rs | 11 +- src/style/mod.rs | 2 +- src/style/styles/objectstyle.rs | 7 +- src/style/styles/styledobject.rs | 13 +- src/terminal/ansi_terminal.rs | 77 +- src/terminal/mod.rs | 28 +- src/terminal/raw.rs | 164 ++-- src/terminal/screen.rs | 105 +-- src/terminal/terminal.rs | 30 +- 38 files changed, 1557 insertions(+), 1000 deletions(-) create mode 100644 src/kernel/windows_kernel/handle.rs create mode 100644 src/manager/ansi_manager.rs create mode 100644 src/manager/manager.rs create mode 100644 src/manager/mod.rs create mode 100644 src/manager/terminal.rs create mode 100644 src/manager/win_manager.rs diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0c3021d..28791c7 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,43 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -121,19 +80,6 @@ - clear_en - singleton - IState - Context - self.changed_states - undo - ICommand - empty - execute - register - ScreenContext - tomain - State write set make @@ -143,7 +89,6 @@ wincon Empty winapi - HANDLE Construct EnableRawModeCommandretu return @@ -151,9 +96,28 @@ clear context self. + output + std + stdout + 'terminal + &Terminal + &self.term + HANDLE + command + Context + End + terminal + termina + screen + colored_terminal crossterm_cursor + 'context + context + &self.context + &Context + Terminal D:\Windows\GIT\crossterm\src @@ -163,60 +127,65 @@ + + + @@ -230,10 +199,10 @@ - @@ -252,10 +221,22 @@ - + + + + + + + + + + + + + @@ -268,6 +249,18 @@ + + + + + + + + + + + + @@ -285,6 +278,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -328,9 +346,8 @@