Added alternatescreen functionalilty, and added options to terminate the current process. also added write option to the terminal module
This commit is contained in:
parent
621d698ac6
commit
4a943c124e
@ -2,10 +2,41 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="310aeab2-4737-4e8e-b7eb-0aac10d104a3" name="Default" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/map.rs" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/mod.rs" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/variables.rs" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/mod.rs" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/shared/environment.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs" beforeDir="false" afterPath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/cursor/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/cursor/mod.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/alternate_screen.rs" beforeDir="false" afterPath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/alternate_screen.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/mod.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/cursor/cursor.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/cursor/cursor.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/cursor/winapi_cursor.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/cursor/winapi_cursor.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/terminal.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/terminal.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/lib.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/lib.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/manager/manager.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/manager/manager.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/manager/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/manager/mod.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/manager/win_manager.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/manager/win_manager.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/shared/functions.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/shared/functions.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/shared/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/shared/mod.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/shared/raw.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/shared/raw.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/shared/screen.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/shared/screen.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/state/commands/shared_commands.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/state/commands/shared_commands.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/state/commands/win_commands.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/state/commands/win_commands.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/state/context.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/state/context.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/state/state_manager.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/state/state_manager.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/style/color/color.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/style/color/color.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/style/color/winapi_color.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/style/color/winapi_color.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/style/styles/objectstyle.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/style/styles/objectstyle.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/terminal/ansi_terminal.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/terminal/ansi_terminal.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/terminal/terminal.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/terminal/terminal.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/terminal/winapi_terminal.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/terminal/winapi_terminal.rs" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
@ -16,15 +47,38 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="win_manager.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/win_manager.rs">
|
||||
<file leaf-file-name="cursor.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/cursor/cursor.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="672">
|
||||
<caret line="63" column="21" selection-start-line="63" selection-start-column="11" selection-end-line="63" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="e#1321#1322#0" expanded="true" />
|
||||
<element signature="e#1377#1378#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="408">
|
||||
<caret line="313" column="11" selection-start-line="313" selection-start-column="11" selection-end-line="313" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="bin.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="459">
|
||||
<caret line="27" column="61" selection-start-line="27" selection-start-column="61" selection-end-line="27" selection-end-column="61" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="winapi_cursor.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/cursor/winapi_cursor.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="498">
|
||||
<caret line="66" column="25" selection-start-line="66" selection-start-column="25" selection-end-line="66" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="alternate_screen.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/alternate_screen.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="204">
|
||||
<caret line="18" column="13" selection-start-line="18" selection-start-column="13" selection-end-line="18" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -32,8 +86,17 @@
|
||||
<file leaf-file-name="screen.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/screen.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="604">
|
||||
<caret line="93" selection-start-line="93" selection-end-line="93" />
|
||||
<state relative-caret-position="340">
|
||||
<caret line="26" column="11" selection-start-line="26" selection-start-column="11" selection-end-line="26" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="terminal.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/terminal/terminal.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="742">
|
||||
<caret line="197" column="11" selection-start-line="197" selection-start-column="11" selection-end-line="197" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -41,8 +104,8 @@
|
||||
<file leaf-file-name="kernel.rs" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="612">
|
||||
<caret line="36" column="32" lean-forward="true" selection-start-line="36" selection-start-column="32" selection-end-line="36" selection-end-column="32" />
|
||||
<state relative-caret-position="540">
|
||||
<caret line="203" column="5" selection-start-line="203" selection-start-column="5" selection-end-line="203" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -52,56 +115,20 @@
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="styledobject.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/style/styles/styledobject.rs">
|
||||
<file leaf-file-name="winapi_color.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/style/color/winapi_color.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="641">
|
||||
<caret line="149" column="17" selection-start-line="149" selection-start-column="17" selection-end-line="149" selection-end-column="17" />
|
||||
<state relative-caret-position="158">
|
||||
<caret line="64" column="69" selection-start-line="64" selection-start-column="69" selection-end-line="64" selection-end-column="69" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="cursor.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs">
|
||||
<file leaf-file-name="ansi_terminal.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/terminal/ansi_terminal.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="2" column="18" selection-start-line="2" selection-start-column="18" selection-end-line="2" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="alternate_screen.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/alternate_screen.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="638">
|
||||
<caret line="74" column="52" selection-start-line="74" selection-start-column="52" selection-end-line="74" selection-end-column="52" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="unix_command.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/unix_command.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="600">
|
||||
<caret line="40" column="9" selection-start-line="40" selection-start-column="9" selection-end-line="40" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="win_commands.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/win_commands.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="424">
|
||||
<caret line="193" column="10" selection-start-line="187" selection-start-column="7" selection-end-line="193" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="bin.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="629">
|
||||
<caret line="37" column="1" selection-start-line="37" selection-start-column="1" selection-end-line="37" selection-end-column="1" />
|
||||
<state relative-caret-position="391">
|
||||
<caret line="45" column="66" selection-start-line="45" selection-start-column="66" selection-end-line="45" selection-end-column="66" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -117,11 +144,6 @@
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>cursor(</find>
|
||||
<find>IStateCommand</find>
|
||||
<find>execute</find>
|
||||
<find>functions</find>
|
||||
<find>set</find>
|
||||
<find>cursor_vis</find>
|
||||
<find>write</find>
|
||||
<find>ToAlternateScreenBufferCommand</find>
|
||||
@ -141,12 +163,17 @@
|
||||
<find>fmt</find>
|
||||
<find>STD_OUTPUT_HANDLE</find>
|
||||
<find>data</find>
|
||||
<find>context</find>
|
||||
<find>WinApiScreenManager</find>
|
||||
<find>color(</find>
|
||||
<find>d</find>
|
||||
<find>srct_read_rect</find>
|
||||
<find>get_output_handle();</find>
|
||||
<find>color</find>
|
||||
<find>super::</find>
|
||||
<find>get_current_ha</find>
|
||||
<find>csbi</find>
|
||||
<find>context</find>
|
||||
<find>terminal_size</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>crossterm_cursor</replace>
|
||||
@ -170,56 +197,56 @@
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/terminal/screen.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/src/terminal/raw.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/styles/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/color/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/handle.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/traits.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/color/ansi_color.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/color/winapi_color.rs" />
|
||||
<option value="$PROJECT_DIR$/src/lib.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/color/color.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/raw.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/command_manager.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/raw_mode.rs" />
|
||||
<option value="$PROJECT_DIR$/src/manager/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/commands/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/context.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/styles/objectstyle.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/state_manager.rs" />
|
||||
<option value="$PROJECT_DIR$/src/manager/ansi_manager.rs" />
|
||||
<option value="$PROJECT_DIR$/src/cursor/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/cursor/winapi_cursor.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/commands/shared_commands.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/commands/unix_command.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/functions.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/src/cursor/ansi_cursor.rs" />
|
||||
<option value="$PROJECT_DIR$/src/cursor/cursor.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/unix_kernel/terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/src/terminal/terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/src/terminal/ansi_terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/src/terminal/winapi_terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/src/terminal/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/alternate_screen.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/cursor/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/manager/manager.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/screen.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/styles/styledobject.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/raw.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/cursor/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/games/README.md" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/commands/shared_commands.rs" />
|
||||
<option value="$PROJECT_DIR$/src/manager/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/state_manager.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/context.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/games/FirstDepthSearch/main.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/Cargo.toml" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/src/main.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/screen.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/commands/win_commands.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/envoirment.rs" />
|
||||
<option value="$PROJECT_DIR$/src/lib.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/styles/objectstyle.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/environment.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/variables.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/map.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/manager/manager.rs" />
|
||||
<option value="$PROJECT_DIR$/src/terminal/terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/src/cursor/cursor.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs" />
|
||||
<option value="$PROJECT_DIR$/src/cursor/winapi_cursor.rs" />
|
||||
<option value="$PROJECT_DIR$/src/manager/win_manager.rs" />
|
||||
<option value="$PROJECT_DIR$/src/terminal/winapi_terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/color/color.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/commands/win_commands.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/functions.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/color/winapi_color.rs" />
|
||||
<option value="$PROJECT_DIR$/src/terminal/ansi_terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/alternate_screen.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" />
|
||||
</list>
|
||||
</option>
|
||||
@ -234,8 +261,8 @@
|
||||
<packageJsonPaths />
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="-8" />
|
||||
<option name="y" value="-8" />
|
||||
<option name="x" value="-529" />
|
||||
<option name="y" value="-20" />
|
||||
<option name="width" value="2576" />
|
||||
<option name="height" value="1056" />
|
||||
</component>
|
||||
@ -278,6 +305,13 @@
|
||||
<item name="examples" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="Crossterm 0.2.2 - New Version (Not finished)" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="crossterm" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="crossterm" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="examples" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="Crossterm 0.2.2 - New Version (Not finished)" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="color" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="crossterm" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="crossterm" type="462c0819:PsiDirectoryNode" />
|
||||
@ -285,6 +319,21 @@
|
||||
<item name="Crossterm 0.2.2 - New Version (Not finished)" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="cursor" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="crossterm" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="crossterm" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="examples" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="Crossterm 0.2.2 - New Version (Not finished)" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="program_examples" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="crossterm" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="crossterm" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="examples" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="Crossterm 0.2.2 - New Version (Not finished)" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="program_examples" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="first_depth_search" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="crossterm" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="crossterm" type="462c0819:PsiDirectoryNode" />
|
||||
@ -354,6 +403,13 @@
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="style" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="crossterm" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="crossterm" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="style" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="color" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="crossterm" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="crossterm" type="462c0819:PsiDirectoryNode" />
|
||||
@ -371,26 +427,26 @@
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="AndroidView" />
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="SearchEverywhereHistoryKey" value="	FILE	file://D:/Windows/GIT/crossterm/src/crossterm_state/commands/win_commands.rs" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../async_test" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="org.rust.cargo.project.model.PROJECT_DISCOVERY" value="true" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.sourceCode.Rust" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\Timon\Documents\Programming\rust\crossterm\examples\Crossterm 0.2.2 - New Version (Not finished)\program_examples\first_depth_search" />
|
||||
<recent name="$PROJECT_DIR$/examples" />
|
||||
<recent name="$PROJECT_DIR$/src/state" />
|
||||
<recent name="$PROJECT_DIR$/src/shared" />
|
||||
<recent name="$PROJECT_DIR$/src/manager" />
|
||||
<recent name="D:\Windows\GIT\crossterm\src\crossterm_terminal" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
@ -560,12 +616,18 @@
|
||||
<workItem from="1529689699529" duration="6745000" />
|
||||
<workItem from="1529741655974" duration="14906000" />
|
||||
<workItem from="1530030893916" duration="6941000" />
|
||||
<workItem from="1530039628703" duration="4296000" />
|
||||
<workItem from="1530039628703" duration="4384000" />
|
||||
<workItem from="1530118776793" duration="7324000" />
|
||||
<workItem from="1530203797893" duration="10260000" />
|
||||
<workItem from="1530289442537" duration="10502000" />
|
||||
<workItem from="1530344478032" duration="18289000" />
|
||||
<workItem from="1530446561530" duration="7222000" />
|
||||
<workItem from="1530473645162" duration="3874000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="624139000" />
|
||||
<option name="totallyTimeSpent" value="681698000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="2576" height="1056" extended-state="6" />
|
||||
@ -587,7 +649,7 @@
|
||||
<window_info id="Designer" order="3" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.1625" />
|
||||
<window_info anchor="right" id="Database" order="6" />
|
||||
<window_info anchor="bottom" id="Find" order="1" sideWeight="0.496875" weight="0.20828906" />
|
||||
<window_info anchor="bottom" id="Find" order="1" sideWeight="0.496875" visible="true" weight="0.1487779" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info id="UI Designer" order="4" />
|
||||
@ -637,291 +699,289 @@
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.5/src/um/wincon.rs" />
|
||||
<entry file="file://$USER_HOME$/.rustup/toolchains/nightly-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/libcore/result.rs" />
|
||||
<entry file="file://$USER_HOME$/.rustup/toolchains/nightly-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/libstd/ffi/c_str.rs" />
|
||||
<entry file="file://$PROJECT_DIR$/src/lib.rs">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="306">
|
||||
<caret line="18" column="35" selection-start-line="18" selection-start-column="35" selection-end-line="18" selection-end-column="35" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/raw_mode.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="466">
|
||||
<caret line="48" column="41" selection-start-line="48" selection-start-column="41" selection-end-line="48" selection-end-column="41" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$USER_HOME$/.rustup/toolchains/nightly-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/liballoc/boxed.rs" />
|
||||
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.5/src/um/winnt.rs" />
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="493">
|
||||
<caret line="29" column="108" selection-start-line="29" selection-start-column="108" selection-end-line="29" selection-end-column="108" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/style/styles/objectstyle.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="85">
|
||||
<caret line="5" column="22" selection-start-line="5" selection-start-column="22" selection-end-line="5" selection-end-column="22" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="68">
|
||||
<caret line="4" column="15" lean-forward="true" selection-start-line="4" selection-start-column="15" selection-end-line="4" selection-end-column="15" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/Cargo.toml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="435">
|
||||
<caret line="29" selection-start-line="29" selection-end-line="29" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/context.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="119">
|
||||
<caret line="7" column="18" selection-start-line="7" selection-start-column="11" selection-end-line="7" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="442">
|
||||
<caret line="28" column="7" selection-start-line="28" selection-start-column="7" selection-end-line="28" selection-end-column="7" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$USER_HOME$/.rustup/toolchains/nightly-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/libcore/time.rs" />
|
||||
<entry file="file://$PROJECT_DIR$/src/cursor/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="774">
|
||||
<caret line="54" column="33" selection-start-line="54" selection-start-column="33" selection-end-line="54" selection-end-column="33" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="2" column="17" selection-start-line="2" selection-start-column="17" selection-end-line="2" selection-end-column="17" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/cursor/winapi_cursor.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="740">
|
||||
<caret line="64" selection-start-line="64" selection-end-line="64" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/traits.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
<caret selection-end-line="4" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/macros.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/command_manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="360">
|
||||
<caret line="24" selection-start-line="24" selection-end-line="24" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/ansi_manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="9" column="28" selection-start-line="9" selection-start-column="11" selection-end-line="9" selection-end-column="28" />
|
||||
<state relative-caret-position="17">
|
||||
<caret line="1" column="114" selection-start-line="1" selection-start-column="114" selection-end-line="1" selection-end-column="114" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="9" column="29" selection-start-line="9" selection-start-column="29" selection-end-line="9" selection-end-column="29" />
|
||||
<state relative-caret-position="408">
|
||||
<caret line="24" column="47" selection-start-line="24" selection-start-column="47" selection-end-line="24" selection-end-column="47" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/raw.rs">
|
||||
<entry file="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/libcore/ops/drop.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="795">
|
||||
<caret line="53" column="61" selection-start-line="53" selection-start-column="61" selection-end-line="53" selection-end-column="61" />
|
||||
<state relative-caret-position="204">
|
||||
<caret line="94" column="10" selection-start-line="94" selection-start-column="10" selection-end-line="94" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/state_manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="735">
|
||||
<caret line="52" column="28" selection-start-line="52" selection-start-column="11" selection-end-line="52" selection-end-column="28" />
|
||||
<state relative-caret-position="442">
|
||||
<caret line="26" column="26" selection-start-line="26" selection-start-column="11" selection-end-line="26" selection-end-column="26" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/shared_commands.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="510">
|
||||
<caret line="40" column="1" selection-start-line="40" selection-start-column="1" selection-end-line="40" selection-end-column="1" />
|
||||
<state relative-caret-position="476">
|
||||
<caret line="34" column="48" selection-start-line="34" selection-start-column="48" selection-end-line="34" selection-end-column="48" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/style/color/color.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="788">
|
||||
<caret line="129" column="7" selection-start-line="129" selection-start-column="7" selection-end-line="129" selection-end-column="7" />
|
||||
<folding>
|
||||
<element signature="e#3841#3842#0" expanded="true" />
|
||||
<element signature="e#3886#3887#0" expanded="true" />
|
||||
</folding>
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/games/FirstDepthSearch/main.rs" />
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/Cargo.toml" />
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor />
|
||||
<second_editor />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs">
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="635">
|
||||
<caret line="144" column="1" selection-start-line="144" selection-start-column="1" selection-end-line="144" selection-end-column="1" />
|
||||
<state relative-caret-position="119">
|
||||
<caret line="7" column="16" selection-start-line="7" selection-start-column="16" selection-end-line="7" selection-end-column="16" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/style/color/ansi_color.rs">
|
||||
<entry file="file://$PROJECT_DIR$/src/cursor/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="450">
|
||||
<caret line="32" column="102" selection-start-line="32" selection-start-column="11" selection-end-line="32" selection-end-column="102" />
|
||||
<state relative-caret-position="544">
|
||||
<caret line="32" column="10" selection-start-line="32" selection-start-column="10" selection-end-line="32" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/mod.rs">
|
||||
<entry file="file://$PROJECT_DIR$/src/lib.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="12" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" />
|
||||
<state relative-caret-position="272">
|
||||
<caret line="16" column="37" selection-start-line="16" selection-start-column="37" selection-end-line="16" selection-end-column="37" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/functions.rs">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/main.rs" />
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="886">
|
||||
<caret line="62" column="31" selection-start-line="62" selection-start-column="31" selection-end-line="62" selection-end-column="31" />
|
||||
<folding>
|
||||
<element signature="e#500#501#0" expanded="true" />
|
||||
<element signature="e#522#523#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="612">
|
||||
<caret line="38" column="1" selection-start-line="38" selection-start-column="1" selection-end-line="38" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/cursor/ansi_cursor.rs">
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/ansi_manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="871">
|
||||
<caret line="102" column="48" selection-start-line="102" selection-start-column="48" selection-end-line="102" selection-end-column="48" />
|
||||
<state relative-caret-position="272">
|
||||
<caret line="16" column="1" selection-start-line="16" selection-start-column="1" selection-end-line="16" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/cursor/cursor.rs">
|
||||
<entry file="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/libcore/default.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="316">
|
||||
<caret line="361" column="5" selection-start-line="361" selection-start-column="5" selection-end-line="361" selection-end-column="5" />
|
||||
<state relative-caret-position="305">
|
||||
<caret line="93" column="10" selection-start-line="93" selection-start-column="10" selection-end-line="93" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/unix_kernel/terminal.rs">
|
||||
<entry file="file://$PROJECT_DIR$/src/style/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="541">
|
||||
<caret line="129" column="45" selection-start-line="129" selection-start-column="45" selection-end-line="129" selection-end-column="45" />
|
||||
<folding>
|
||||
<element signature="e#3437#3438#0" expanded="true" />
|
||||
<element signature="e#3468#3469#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="195">
|
||||
<caret line="28" column="9" selection-start-line="28" selection-start-column="9" selection-end-line="28" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/terminal.rs">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="12" column="1" selection-start-line="12" selection-start-column="1" selection-end-line="12" selection-end-column="1" />
|
||||
<folding>
|
||||
<element signature="e#276#277#0" expanded="true" />
|
||||
<element signature="e#307#308#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="221">
|
||||
<caret line="13" column="23" selection-start-line="13" selection-start-column="23" selection-end-line="13" selection-end-column="23" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/terminal/terminal.rs">
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/environment.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="353">
|
||||
<caret line="187" column="5" selection-start-line="187" selection-start-column="5" selection-end-line="187" selection-end-column="5" />
|
||||
<state relative-caret-position="187">
|
||||
<caret line="11" column="11" selection-start-line="11" selection-start-column="11" selection-end-line="11" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/terminal/ansi_terminal.rs">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/variables.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1105">
|
||||
<caret line="67" column="5" selection-start-line="67" selection-start-column="5" selection-end-line="67" selection-end-column="5" />
|
||||
<state relative-caret-position="740">
|
||||
<caret line="59" column="5" lean-forward="true" selection-start-line="59" selection-start-column="5" selection-end-line="59" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/terminal/winapi_terminal.rs">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/map.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2465">
|
||||
<caret line="148" column="28" selection-start-line="148" selection-start-column="28" selection-end-line="148" selection-end-column="28" />
|
||||
<state relative-caret-position="281">
|
||||
<caret line="18" column="5" selection-start-line="18" selection-start-column="5" selection-end-line="18" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/terminal/mod.rs">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="697">
|
||||
<caret line="41" column="43" selection-start-line="41" selection-start-column="43" selection-end-line="41" selection-end-column="43" />
|
||||
<state relative-caret-position="17">
|
||||
<caret line="1" selection-start-line="1" selection-end-line="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.5/src/um/wincon.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="4233">
|
||||
<caret line="249" column="11" selection-start-line="249" selection-start-column="11" selection-end-line="249" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.5/src/lib.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="578">
|
||||
<caret line="34" column="13" selection-start-line="34" selection-start-column="13" selection-end-line="34" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.5/src/um/winnt.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="527">
|
||||
<caret line="31" column="18" selection-start-line="31" selection-start-column="18" selection-end-line="31" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.5/src/um/consoleapi.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1207">
|
||||
<caret line="71" column="26" selection-start-line="71" selection-start-column="26" selection-end-line="71" selection-end-column="26" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/terminal.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1326">
|
||||
<caret line="78" column="32" selection-start-line="78" selection-start-column="32" selection-end-line="78" selection-end-column="32" />
|
||||
<state relative-caret-position="-255" />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="187">
|
||||
<caret line="11" column="31" selection-start-line="11" selection-start-column="31" selection-end-line="11" selection-end-column="31" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/cursor/mod.rs">
|
||||
<entry file="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/liballoc/rc.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2397">
|
||||
<caret line="141" selection-start-line="141" selection-end-line="141" />
|
||||
<state relative-caret-position="275">
|
||||
<caret line="450" column="24" selection-start-line="450" selection-start-column="24" selection-end-line="450" selection-end-column="24" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/manager.rs">
|
||||
<entry file="file://$PROJECT_DIR$/src/state/context.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="434">
|
||||
<caret line="30" column="64" selection-start-line="30" selection-start-column="64" selection-end-line="30" selection-end-column="64" />
|
||||
<state relative-caret-position="170">
|
||||
<caret line="10" column="8" selection-start-line="10" selection-start-column="8" selection-end-line="10" selection-end-column="8" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/screen.rs">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/raw_mode.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="604">
|
||||
<caret line="93" selection-start-line="93" selection-end-line="93" />
|
||||
<state relative-caret-position="357">
|
||||
<caret line="21" column="24" selection-start-line="21" selection-start-column="24" selection-end-line="21" selection-end-column="24" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs">
|
||||
<entry file="file://$PROJECT_DIR$/src/style/color/color.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="2" column="18" selection-start-line="2" selection-start-column="18" selection-end-line="2" selection-end-column="18" />
|
||||
<state relative-caret-position="-1062">
|
||||
<caret line="21" column="82" selection-start-line="21" selection-start-column="82" selection-end-line="21" selection-end-column="82" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/style/styles/objectstyle.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="578">
|
||||
<caret line="34" column="11" selection-start-line="34" selection-start-column="11" selection-end-line="34" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/style/styles/styledobject.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="641">
|
||||
<caret line="149" column="17" selection-start-line="149" selection-start-column="17" selection-end-line="149" selection-end-column="17" />
|
||||
<state relative-caret-position="-1649">
|
||||
<caret line="14" column="11" selection-start-line="14" selection-start-column="11" selection-end-line="14" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/win_commands.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-1309">
|
||||
<caret line="40" column="54" selection-start-line="40" selection-start-column="54" selection-end-line="40" selection-end-column="54" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/terminal.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="17">
|
||||
<caret line="1" column="7" selection-start-line="1" selection-start-column="7" selection-end-line="1" selection-end-column="7" />
|
||||
<folding>
|
||||
<element signature="e#346#347#0" expanded="true" />
|
||||
<element signature="e#379#380#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/terminal/winapi_terminal.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="424">
|
||||
<caret line="42" column="25" selection-start-line="42" selection-start-column="25" selection-end-line="42" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/unix_kernel/terminal.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="297">
|
||||
<caret line="43" column="7" selection-start-line="43" selection-start-column="7" selection-end-line="43" selection-end-column="7" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/functions.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="228">
|
||||
<caret line="30" column="14" selection-start-line="30" selection-start-column="14" selection-end-line="30" selection-end-column="14" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="544">
|
||||
<caret line="32" column="23" selection-start-line="32" selection-start-column="23" selection-end-line="32" selection-end-column="23" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="408">
|
||||
<caret line="24" column="21" selection-start-line="24" selection-start-column="21" selection-end-line="24" selection-end-column="21" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/win_manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="493">
|
||||
<caret line="32" column="36" selection-start-line="32" selection-start-column="36" selection-end-line="32" selection-end-column="36" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/style/color/winapi_color.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="158">
|
||||
<caret line="64" column="69" selection-start-line="64" selection-start-column="69" selection-end-line="64" selection-end-column="69" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/terminal/ansi_terminal.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="391">
|
||||
<caret line="45" column="66" selection-start-line="45" selection-start-column="66" selection-end-line="45" selection-end-column="66" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -930,47 +990,50 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="629">
|
||||
<caret line="37" column="1" selection-start-line="37" selection-start-column="1" selection-end-line="37" selection-end-column="1" />
|
||||
<state relative-caret-position="459">
|
||||
<caret line="27" column="61" selection-start-line="27" selection-start-column="61" selection-end-line="27" selection-end-column="61" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/shared/screen.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="340">
|
||||
<caret line="26" column="11" selection-start-line="26" selection-start-column="11" selection-end-line="26" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/terminal/terminal.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="742">
|
||||
<caret line="197" column="11" selection-start-line="197" selection-start-column="11" selection-end-line="197" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/alternate_screen.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="638">
|
||||
<caret line="74" column="52" selection-start-line="74" selection-start-column="52" selection-end-line="74" selection-end-column="52" />
|
||||
<state relative-caret-position="204">
|
||||
<caret line="18" column="13" selection-start-line="18" selection-start-column="13" selection-end-line="18" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/unix_command.rs">
|
||||
<entry file="file://$PROJECT_DIR$/src/cursor/cursor.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="600">
|
||||
<caret line="40" column="9" selection-start-line="40" selection-start-column="9" selection-end-line="40" selection-end-column="9" />
|
||||
<state relative-caret-position="408">
|
||||
<caret line="313" column="11" selection-start-line="313" selection-start-column="11" selection-end-line="313" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/win_commands.rs">
|
||||
<entry file="file://$PROJECT_DIR$/src/cursor/winapi_cursor.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="424">
|
||||
<caret line="193" column="10" selection-start-line="187" selection-start-column="7" selection-end-line="193" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/win_manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="672">
|
||||
<caret line="63" column="21" selection-start-line="63" selection-start-column="11" selection-end-line="63" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="e#1321#1322#0" expanded="true" />
|
||||
<element signature="e#1377#1378#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="498">
|
||||
<caret line="66" column="25" selection-start-line="66" selection-start-column="25" selection-end-line="66" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="612">
|
||||
<caret line="36" column="32" lean-forward="true" selection-start-line="36" selection-start-column="32" selection-end-line="36" selection-end-column="32" />
|
||||
<state relative-caret-position="540">
|
||||
<caret line="203" column="5" selection-start-line="203" selection-start-column="5" selection-end-line="203" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -16,23 +16,17 @@ extern crate crossterm;
|
||||
mod terminal;
|
||||
mod cursor;
|
||||
mod color;
|
||||
|
||||
use terminal::alternate_screen;
|
||||
use terminal::raw_mode;
|
||||
use terminal::terminal as term;
|
||||
|
||||
use self::crossterm::Context;
|
||||
use self::crossterm::terminal::ClearType;
|
||||
use crossterm::raw;
|
||||
use crossterm::screen;
|
||||
use crossterm::raw::IntoRawMode;
|
||||
use std::io::Write;
|
||||
use std::{time, thread};
|
||||
|
||||
use std::process::exit;
|
||||
mod program_examples;
|
||||
|
||||
fn main() {
|
||||
let context = Context::new();
|
||||
alternate_screen::print_wait_screen_on_alternate_window();
|
||||
|
||||
use crossterm::Context;
|
||||
|
||||
{
|
||||
let mut context = Context::new();
|
||||
|
||||
terminal::alternate_screen::print_wait_screen_on_alternate_window(context.clone());
|
||||
|
||||
println!("count: {}", std::rc::Rc::strong_count(&context));
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
//!
|
||||
//! Color Examples
|
||||
//! Examples of coloring the terminal.
|
||||
//!
|
||||
|
||||
extern crate crossterm;
|
||||
|
@ -1,5 +1,5 @@
|
||||
//!
|
||||
//! Cursor Examples
|
||||
//! Examples of actions that could be performed with te cursor.
|
||||
//!
|
||||
|
||||
extern crate crossterm;
|
||||
@ -140,7 +140,7 @@ pub fn show_cursor()
|
||||
cursor.show();
|
||||
}
|
||||
|
||||
/// Show cursor display | demonstration.
|
||||
/// Show cursor display, only works on certain terminals.| demonstration
|
||||
pub fn blink_cursor()
|
||||
{
|
||||
let context = Context::new();
|
||||
|
@ -0,0 +1,3 @@
|
||||
This folder will contain some examples of how to use this crate.
|
||||
|
||||
If you have created a game or something feel free to upload it, would be a great help for other people and me.
|
@ -0,0 +1,49 @@
|
||||
use super::variables::{Cell, Position, Size };
|
||||
use crossterm::terminal::terminal;
|
||||
use crossterm::Environment;
|
||||
use crossterm::style::{ObjectStyle, StyledObject};
|
||||
use crossterm::Context;
|
||||
use std::rc::Rc;
|
||||
|
||||
use std::fmt::Display;
|
||||
|
||||
pub struct Map<D: Display>
|
||||
{
|
||||
map: Vec<Vec<Cell<D>>>,
|
||||
wall_style: StyledObject<D>,
|
||||
map_style: StyledObject<D>,
|
||||
}
|
||||
|
||||
impl<D: Display> Map<D>
|
||||
{
|
||||
pub fn new(context: Rc<Context>) -> Map<D>
|
||||
{
|
||||
Map { map: Vec::new(), wall_style: ObjectStyle::apply_ to("■", context.clone() )}
|
||||
}
|
||||
|
||||
pub fn init(&self, environment: &mut Environment, map_size: Size) -> Map<D>
|
||||
{
|
||||
let mut map: Vec<Vec<Cell<D>>> = Vec::new();
|
||||
|
||||
for y in 0..map[0].len()
|
||||
{
|
||||
for x in 0..map[1].len()
|
||||
{
|
||||
if (y == 0 || y == map.len() - 1) || (x == 0 || x == map[0].len())
|
||||
{
|
||||
map[y][x] = Cell::new(Position::new(x,y), wall_style.apply_to(environment.context(), "■"));
|
||||
}
|
||||
else{
|
||||
map[y][x] = Cell::new(Position::new(x,y), map_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map { map }
|
||||
}
|
||||
|
||||
fn render_map()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
mod map;
|
||||
mod variables;
|
||||
|
||||
use crossterm;
|
||||
use crossterm::style::Color;
|
||||
|
||||
use self::variables::Size;
|
||||
|
||||
fn run()
|
||||
{
|
||||
let mut env = crossterm::Environment::new();
|
||||
let map_size = Size::new(20,20);
|
||||
let wall_style = env.paint("■").with(Color::Blue).on(Color::Black);
|
||||
let map_style = env.paint(" ").with(Color::White).on(Color::White);
|
||||
|
||||
map::Map::init(&mut env, map_size, wall_style, map_style);
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
extern crate crossterm;
|
||||
|
||||
use self::crossterm::terminal::{terminal, ClearType};
|
||||
use self::crossterm::Context;
|
||||
use self::crossterm::style::{Color, StyledObject, ObjectStyle };
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum Direction
|
||||
{
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Position
|
||||
{
|
||||
pub x: usize,
|
||||
pub y: usize
|
||||
}
|
||||
|
||||
impl Position
|
||||
{
|
||||
pub fn new(x: usize, y: usize) -> Position
|
||||
{
|
||||
Position { x, y }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Size
|
||||
{
|
||||
pub width: u16,
|
||||
pub height: u16
|
||||
}
|
||||
|
||||
impl Size
|
||||
{
|
||||
pub fn new(width: u16, height: u16) -> Size
|
||||
{
|
||||
Size {width,height}
|
||||
}
|
||||
}
|
||||
|
||||
use std::fmt::Display;
|
||||
|
||||
pub struct Cell<'a, D: Display>
|
||||
{
|
||||
position: Position,
|
||||
style: &'a StyledObject<D>,
|
||||
visited: bool
|
||||
}
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
impl<'a, D: Display> Cell<'a, D>
|
||||
{
|
||||
pub fn new(position: Position, style: &'a StyledObject<D>) -> Cell<D>
|
||||
{
|
||||
Cell { position: position, style: style, visited: false }
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
//pub mod first_depth_search;
|
@ -8,23 +8,19 @@ use crossterm::terminal::{self, ClearType};
|
||||
use std::io::{Write, stdout};
|
||||
use std::{time, thread};
|
||||
use std::rc::Rc;
|
||||
|
||||
fn print_wait_screen(context: Rc<Context>)
|
||||
{
|
||||
terminal::terminal(context.clone()).clear(ClearType::All);
|
||||
let mut terminal = terminal::terminal(context.clone());
|
||||
terminal.clear(ClearType::All);
|
||||
|
||||
let mut cursor = cursor(context.clone());
|
||||
cursor.goto(0,0);
|
||||
cursor.hide();
|
||||
|
||||
{
|
||||
let mut screen_manager = context.screen_manager.lock().unwrap();
|
||||
{
|
||||
write!(screen_manager,
|
||||
"Welcome to the wait screen.\n\
|
||||
Please wait a few seconds until we arrive back at the main screen.\n\
|
||||
Progress: "
|
||||
);
|
||||
}
|
||||
}
|
||||
terminal.write("Welcome to the wait screen.\n\
|
||||
Please wait a few seconds until we arrive back at the main screen.\n\
|
||||
Progress: ");
|
||||
|
||||
// print some progress example.
|
||||
for i in 1..5
|
||||
@ -35,13 +31,12 @@ fn print_wait_screen(context: Rc<Context>)
|
||||
// 1 second delay
|
||||
thread::sleep(time::Duration::from_secs(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// print wait screen on alternate screen, then swich back.
|
||||
pub fn print_wait_screen_on_alternate_window()
|
||||
pub fn print_wait_screen_on_alternate_window(context: Rc<Context>)
|
||||
{
|
||||
let context = Context::new();
|
||||
|
||||
// create scope. If this scope ends the screen will be switched back to mainscreen.
|
||||
// because `AlternateScreen` switches back to main screen when switching back.
|
||||
{
|
||||
@ -51,8 +46,6 @@ pub fn print_wait_screen_on_alternate_window()
|
||||
// Print the wait screen.
|
||||
print_wait_screen(context.clone());
|
||||
}
|
||||
|
||||
println!("Whe are back at the main screen");
|
||||
}
|
||||
|
||||
/// some stress test switch from and to alternate screen.
|
||||
|
@ -1,3 +1,10 @@
|
||||
/// Examples of actions that could be performed on the alternatescreen.
|
||||
/// !! Note that alternate screen only works on Unix and windows 10 systems. I am working on windows 7 support. !!
|
||||
pub mod alternate_screen;
|
||||
|
||||
/// Examples of actions that could be performed on the terminal.
|
||||
pub mod terminal;
|
||||
|
||||
/// Alternate screen is only supported for unix systems. Windows support will come later :).
|
||||
#[cfg(target_os = "unix")]
|
||||
pub mod raw_mode;
|
||||
pub mod terminal;
|
@ -6,6 +6,7 @@
|
||||
use super::*;
|
||||
use Context;
|
||||
use super::super::shared::functions;
|
||||
use std::io::Write;
|
||||
|
||||
use std::fmt::Display;
|
||||
use std::rc::Rc;
|
||||
@ -21,7 +22,7 @@ impl TerminalCursor
|
||||
/// Create new cursor instance whereon cursor related actions can be performed.
|
||||
pub fn new(context: Rc<Context>) -> TerminalCursor {
|
||||
#[cfg(target_os = "windows")]
|
||||
let cursor = functions::get_module::<Box<ITerminalCursor>>(WinApiCursor::new(), AnsiCursor::new(context.clone()));
|
||||
let cursor = functions::get_module::<Box<ITerminalCursor>>(WinApiCursor::new(context.screen_manager.clone()), AnsiCursor::new(context.clone()));
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let cursor = Some(AnsiCursor::new(context.clone()) as Box<ITerminalCursor>);
|
||||
@ -242,7 +243,9 @@ impl TerminalCursor
|
||||
let mut string = String::new();
|
||||
write!(string, "{}", value).unwrap();
|
||||
|
||||
screen_manager.write_ansi(string);
|
||||
screen_manager.write_val(string);
|
||||
|
||||
screen_manager.flush();
|
||||
}
|
||||
}
|
||||
self
|
||||
|
@ -2,25 +2,34 @@
|
||||
//! This module is used for windows terminals that do not support ANSI escape codes.
|
||||
//! Note that the cursor position is 0 based. This means that we start counting at 0 when setting the cursor position ect.
|
||||
use super::ITerminalCursor;
|
||||
use super::super::manager::{IScreenManager, ScreenManager, WinApiScreenManager };
|
||||
|
||||
use kernel::windows_kernel::{kernel, cursor};
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
/// This struct is an windows implementation for cursor related actions.
|
||||
pub struct WinApiCursor;
|
||||
pub struct WinApiCursor
|
||||
{
|
||||
screen_manager: Rc<Mutex<ScreenManager>>
|
||||
}
|
||||
|
||||
impl WinApiCursor {
|
||||
pub fn new() -> Box<WinApiCursor> {
|
||||
Box::from(WinApiCursor { })
|
||||
pub fn new(screen_manager: Rc<Mutex<ScreenManager>>) -> Box<WinApiCursor> {
|
||||
Box::from(WinApiCursor { screen_manager })
|
||||
}
|
||||
}
|
||||
|
||||
impl ITerminalCursor for WinApiCursor {
|
||||
|
||||
impl ITerminalCursor for WinApiCursor
|
||||
{
|
||||
fn goto(&self, x: u16, y: u16) {
|
||||
kernel::set_console_cursor_position(x as i16, y as i16);
|
||||
|
||||
kernel::set_console_cursor_position(x as i16, y as i16, &self.screen_manager);
|
||||
}
|
||||
|
||||
fn pos(&self) -> (u16, u16) {
|
||||
cursor::pos()
|
||||
cursor::pos(&self.screen_manager)
|
||||
}
|
||||
|
||||
fn move_up(&self, count: u16) {
|
||||
@ -45,22 +54,22 @@ impl ITerminalCursor for WinApiCursor {
|
||||
|
||||
fn save_position(&mut self)
|
||||
{
|
||||
cursor::save_cursor_pos();
|
||||
cursor::save_cursor_pos(&self.screen_manager);
|
||||
}
|
||||
|
||||
fn reset_position(&self)
|
||||
{
|
||||
cursor::reset_to_saved_position();
|
||||
cursor::reset_to_saved_position(&self.screen_manager);
|
||||
}
|
||||
|
||||
fn hide(&self)
|
||||
{
|
||||
kernel::cursor_visibility(false);
|
||||
kernel::cursor_visibility(false, &self.screen_manager);
|
||||
}
|
||||
|
||||
fn show(&self)
|
||||
{
|
||||
kernel::cursor_visibility(true);
|
||||
kernel::cursor_visibility(true, &self.screen_manager);
|
||||
}
|
||||
|
||||
fn blink(&self, blink: bool)
|
||||
|
@ -7,6 +7,7 @@ static mut HAS_BEEN_TRYED_TO_ENABLE: bool = false;
|
||||
static mut IS_ANSI_ON_WINDOWS_ENABLED: Option<bool> = None;
|
||||
static mut DOES_WINDOWS_SUPPORT_ANSI: Option<bool> = None;
|
||||
static START: Once = ONCE_INIT;
|
||||
|
||||
/// Try enable `ANSI escape codes` and return the result.
|
||||
pub fn try_enable_ansi_support() -> bool
|
||||
{
|
||||
@ -18,7 +19,6 @@ pub fn try_enable_ansi_support() -> bool
|
||||
set_is_windows_ansi_supportable(success);
|
||||
set_ansi_enabled(success);
|
||||
has_been_tried_to_enable(true);
|
||||
|
||||
});
|
||||
|
||||
windows_supportable()
|
||||
|
@ -1,22 +1,26 @@
|
||||
//! This module handles some logic for cursor interaction in the windows console.
|
||||
|
||||
use super::kernel;
|
||||
use super::super::super::manager::{ScreenManager, WinApiScreenManager};
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
/// This stores the cursor pos, at program level. So it can be recalled later.
|
||||
static mut SAVED_CURSOR_POS:(u16,u16) = (0,0);
|
||||
|
||||
/// Reset to saved cursor position
|
||||
pub fn reset_to_saved_position()
|
||||
pub fn reset_to_saved_position(screen_manager: &Rc<Mutex<ScreenManager>>)
|
||||
{
|
||||
unsafe {
|
||||
kernel::set_console_cursor_position(SAVED_CURSOR_POS.0 as i16, SAVED_CURSOR_POS.1 as i16);
|
||||
kernel::set_console_cursor_position(SAVED_CURSOR_POS.0 as i16, SAVED_CURSOR_POS.1 as i16, screen_manager);
|
||||
}
|
||||
}
|
||||
|
||||
/// Save current cursor position to recall later.
|
||||
pub fn save_cursor_pos()
|
||||
pub fn save_cursor_pos(screen_manager: &Rc<Mutex<ScreenManager>>)
|
||||
{
|
||||
let position = pos();
|
||||
let position = pos(screen_manager);
|
||||
|
||||
unsafe {
|
||||
SAVED_CURSOR_POS = (position.0, position.1);
|
||||
@ -24,8 +28,8 @@ pub fn save_cursor_pos()
|
||||
}
|
||||
|
||||
/// get the current cursor position.
|
||||
pub fn pos() -> (u16,u16)
|
||||
pub fn pos(screen_manager: &Rc<Mutex<ScreenManager>>) -> (u16,u16)
|
||||
{
|
||||
let csbi = kernel::get_console_screen_buffer_info();
|
||||
let csbi = kernel::get_console_screen_buffer_info(screen_manager);
|
||||
( csbi.dwCursorPosition.X as u16, csbi.dwCursorPosition.Y as u16 )
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
use Context;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
||||
use winapi::um::winnt::HANDLE;
|
||||
use winapi::um::winbase::{STD_OUTPUT_HANDLE, STD_INPUT_HANDLE };
|
||||
use winapi::um::handleapi::INVALID_HANDLE_VALUE;
|
||||
@ -11,9 +10,13 @@ use winapi::um::consoleapi::{SetConsoleMode,GetConsoleMode, };
|
||||
use winapi::shared::ntdef::{NULL};
|
||||
use winapi::shared::minwindef::{TRUE, FALSE};
|
||||
use winapi::um::wincon;
|
||||
use winapi::um::consoleapi::WriteConsoleW;
|
||||
use winapi::um::wincon::
|
||||
{
|
||||
ENABLE_PROCESSED_INPUT,
|
||||
WriteConsoleOutputW,
|
||||
WriteConsoleOutputCharacterA,
|
||||
WriteConsoleOutputCharacterW,
|
||||
SetConsoleWindowInfo, SetConsoleCursorPosition, SetConsoleTextAttribute, SetConsoleScreenBufferSize, CreateConsoleScreenBuffer,SetConsoleActiveScreenBuffer, SetConsoleCursorInfo,
|
||||
GetLargestConsoleWindowSize, GetConsoleScreenBufferInfo,
|
||||
FillConsoleOutputCharacterA, FillConsoleOutputAttribute,WriteConsoleOutputAttribute,
|
||||
@ -24,19 +27,13 @@ use super::{Empty};
|
||||
static mut CONSOLE_OUTPUT_HANDLE: Option<HANDLE> = None;
|
||||
static mut CONSOLE_INPUT_HANDLE: Option<HANDLE> = None;
|
||||
|
||||
use super::super::super::manager::{ScreenManager, WinApiScreenManager};
|
||||
use std::sync::Mutex;
|
||||
|
||||
pub fn get_current_handle(context: Rc<Context>) -> Rc<HANDLE>
|
||||
/// Get the global stored handle.
|
||||
pub fn get_current_handle(screen_manager: &mut WinApiScreenManager) -> &HANDLE
|
||||
{
|
||||
let mut screen_manager = context.screen_manager.lock().unwrap();
|
||||
use super::super::super::manager::WinApiScreenManager;
|
||||
let b: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
|
||||
Some(b) => { b },
|
||||
None => panic!("")
|
||||
};
|
||||
|
||||
let handle = b.get_handle();
|
||||
|
||||
return handle.clone()
|
||||
return screen_manager.get_handle();
|
||||
}
|
||||
|
||||
/// Get the std_output_handle of the console
|
||||
@ -85,13 +82,20 @@ fn is_valid_handle(handle: &HANDLE) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
/// Create a new console screen buffer info struct.
|
||||
pub fn get_console_screen_buffer_info(screen_manager: &Rc<Mutex<ScreenManager>>) -> CONSOLE_SCREEN_BUFFER_INFO {
|
||||
|
||||
pub fn get_console_screen_buffer_info() -> CONSOLE_SCREEN_BUFFER_INFO {
|
||||
let output_handle = get_output_handle();
|
||||
let mut screen_manager = screen_manager.lock().unwrap();
|
||||
let winapi_screen_manager: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
|
||||
Some(win_api) => { win_api },
|
||||
None => panic!("")
|
||||
};
|
||||
|
||||
let output_handle = get_current_handle(winapi_screen_manager);
|
||||
let mut csbi = CONSOLE_SCREEN_BUFFER_INFO::empty();
|
||||
let success;
|
||||
|
||||
unsafe { success = GetConsoleScreenBufferInfo(output_handle, &mut csbi) }
|
||||
unsafe { success = GetConsoleScreenBufferInfo(*output_handle, &mut csbi) }
|
||||
|
||||
if success == 0 {
|
||||
panic!("Cannot get console screen buffer info");
|
||||
@ -100,6 +104,22 @@ pub fn get_console_screen_buffer_info() -> CONSOLE_SCREEN_BUFFER_INFO {
|
||||
csbi
|
||||
}
|
||||
|
||||
/// Create a new console screen buffer info struct.
|
||||
pub fn get_console_screen_buffer_info_from_handle(handle: &HANDLE) -> CONSOLE_SCREEN_BUFFER_INFO {
|
||||
|
||||
let mut csbi = CONSOLE_SCREEN_BUFFER_INFO::empty();
|
||||
let success;
|
||||
|
||||
unsafe { success = GetConsoleScreenBufferInfo(*handle, &mut csbi) }
|
||||
|
||||
if success == 0 {
|
||||
panic!("Cannot get console screen buffer info");
|
||||
}
|
||||
|
||||
csbi
|
||||
}
|
||||
|
||||
/// Get the larged console window size posible.
|
||||
pub fn get_largest_console_window_size() -> COORD
|
||||
{
|
||||
let output_handle = get_output_handle();
|
||||
@ -109,11 +129,13 @@ pub fn get_largest_console_window_size() -> COORD
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_original_console_color() -> u16 {
|
||||
let console_buffer_info = get_console_screen_buffer_info();
|
||||
/// Get the original color of the terminal.
|
||||
pub fn get_original_console_color(screen_manager: &Rc<Mutex<ScreenManager>>) -> u16 {
|
||||
let console_buffer_info = get_console_screen_buffer_info(screen_manager);
|
||||
console_buffer_info.wAttributes as u16
|
||||
}
|
||||
|
||||
/// Set the console mode to the given console mode.
|
||||
pub fn set_console_mode(handle: &HANDLE, console_mode: u32) -> bool
|
||||
{
|
||||
unsafe {
|
||||
@ -122,6 +144,7 @@ pub fn set_console_mode(handle: &HANDLE, console_mode: u32) -> bool
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the console mode.
|
||||
pub fn get_console_mode(handle: &HANDLE, current_mode: &mut u32) -> bool
|
||||
{
|
||||
unsafe {
|
||||
@ -130,7 +153,8 @@ pub fn get_console_mode(handle: &HANDLE, current_mode: &mut u32) -> bool
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_console_cursor_position(x: i16, y: i16)
|
||||
/// Set the cursor position to the given x and y. Note that this is 0 based.
|
||||
pub fn set_console_cursor_position(x: i16, y: i16, screen_manager: &Rc<Mutex<ScreenManager>>)
|
||||
{
|
||||
if x < 0 || x >= <i16>::max_value() {
|
||||
panic!("X: {}, Argument Out of Range Exception", x);
|
||||
@ -140,11 +164,18 @@ pub fn set_console_cursor_position(x: i16, y: i16)
|
||||
panic!("Y: {}, Argument Out of Range Exception", y);
|
||||
}
|
||||
|
||||
let output_handle = get_output_handle();
|
||||
let mut screen_manager = screen_manager.lock().unwrap();
|
||||
let winapi_screen_manager: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
|
||||
Some(win_api) => { win_api },
|
||||
None => panic!("")
|
||||
};
|
||||
|
||||
let handle = get_current_handle(winapi_screen_manager);
|
||||
|
||||
let position = COORD { X: x, Y: y };
|
||||
|
||||
unsafe {
|
||||
let success = SetConsoleCursorPosition(output_handle, position);
|
||||
let success = SetConsoleCursorPosition(*handle, position);
|
||||
|
||||
if success == 0 {
|
||||
panic!("Argument out of range.");
|
||||
@ -152,23 +183,31 @@ pub fn set_console_cursor_position(x: i16, y: i16)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cursor_visibility(visable: bool)
|
||||
/// change the cursor visibility.
|
||||
pub fn cursor_visibility(visable: bool, screen_manager: &Rc<Mutex<ScreenManager>>)
|
||||
{
|
||||
let handle = get_output_handle();
|
||||
let mut screen_manager = screen_manager.lock().unwrap();
|
||||
let winapi_screen_manager: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
|
||||
Some(win_api) => { win_api },
|
||||
None => panic!("")
|
||||
};
|
||||
|
||||
let handle = get_current_handle(winapi_screen_manager);
|
||||
|
||||
let cursor_info = CONSOLE_CURSOR_INFO
|
||||
{
|
||||
|
||||
dwSize: 1,
|
||||
dwSize: 100,
|
||||
bVisible: if visable { TRUE } else {FALSE}
|
||||
};
|
||||
|
||||
unsafe
|
||||
{
|
||||
SetConsoleCursorInfo(handle, &cursor_info);
|
||||
SetConsoleCursorInfo(*handle, &cursor_info);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_console_text_attribute(value: u16)
|
||||
/// Change the console text attribute.
|
||||
pub fn set_console_text_attribute(value: u16, screen_manager: &Rc<Mutex<ScreenManager>>)
|
||||
{
|
||||
let output_handle = get_output_handle();
|
||||
|
||||
@ -177,38 +216,58 @@ pub fn set_console_text_attribute(value: u16)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_console_info(absolute: bool, rect: &SMALL_RECT) -> bool
|
||||
/// Change console info.
|
||||
pub fn set_console_info(absolute: bool, rect: &SMALL_RECT, screen_manager: &Rc<Mutex<ScreenManager>>) -> bool
|
||||
{
|
||||
let mut screen_manager = screen_manager.lock().unwrap();
|
||||
let winapi_screen_manager: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
|
||||
Some(win_api) => { win_api },
|
||||
None => panic!("")
|
||||
};
|
||||
|
||||
let output_handle = get_output_handle();
|
||||
let handle = get_current_handle(winapi_screen_manager);
|
||||
|
||||
let absolute = match absolute { true => 1, false => 0, };
|
||||
unsafe
|
||||
{
|
||||
let success = SetConsoleWindowInfo(output_handle,absolute ,rect);
|
||||
let success = SetConsoleWindowInfo(*handle,absolute ,rect);
|
||||
is_true(success)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_console_screen_buffer_size( size: COORD) -> bool
|
||||
/// Set the console screen buffer size
|
||||
pub fn set_console_screen_buffer_size( size: COORD, screen_manager: &Rc<Mutex<ScreenManager>>) -> bool
|
||||
{
|
||||
let output_handle = get_output_handle();
|
||||
let mut screen_manager = screen_manager.lock().unwrap();
|
||||
let winapi_screen_manager: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
|
||||
Some(win_api) => { win_api },
|
||||
None => panic!("")
|
||||
};
|
||||
|
||||
let handle = get_current_handle(winapi_screen_manager);
|
||||
|
||||
unsafe
|
||||
{
|
||||
let success = SetConsoleScreenBufferSize(output_handle, size);
|
||||
is_true(success)
|
||||
}
|
||||
{
|
||||
let success = SetConsoleScreenBufferSize(*handle, size);
|
||||
is_true(success)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fill_console_output_character(cells_written: &mut u32, start_location: COORD, cells_to_write: u32) -> bool
|
||||
/// Fill a certain block with characters.
|
||||
pub fn fill_console_output_character(cells_written: &mut u32, start_location: COORD, cells_to_write: u32, screen_manager: &Rc<Mutex<ScreenManager>>) -> bool
|
||||
{
|
||||
let output_handle = get_output_handle();
|
||||
let mut screen_manager = screen_manager.lock().unwrap();
|
||||
let winapi_screen_manager: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
|
||||
Some(win_api) => { win_api },
|
||||
None => panic!("")
|
||||
};
|
||||
|
||||
let handle = get_current_handle(winapi_screen_manager);
|
||||
|
||||
unsafe {
|
||||
// fill the cells in console with blanks
|
||||
let success = FillConsoleOutputCharacterA (
|
||||
output_handle,
|
||||
*handle,
|
||||
' ' as i8,
|
||||
cells_to_write,
|
||||
start_location,
|
||||
@ -218,17 +277,26 @@ pub fn fill_console_output_character(cells_written: &mut u32, start_location: CO
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fill_console_output_attribute(cells_written: &mut u32, start_location: COORD, cells_to_write: u32) -> bool
|
||||
/// Set console ouput attribute for certain block.
|
||||
pub fn fill_console_output_attribute(cells_written: &mut u32, start_location: COORD, cells_to_write: u32,screen_manager: &Rc<Mutex<ScreenManager>>) -> bool
|
||||
{
|
||||
|
||||
// Get the position of the current console window
|
||||
let csbi = get_console_screen_buffer_info();
|
||||
let output_handle = get_output_handle();
|
||||
let csbi = get_console_screen_buffer_info(screen_manager);
|
||||
|
||||
let mut screen_manager = screen_manager.lock().unwrap();
|
||||
let winapi_screen_manager: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
|
||||
Some(win_api) => { win_api },
|
||||
None => panic!("")
|
||||
};
|
||||
|
||||
let handle = get_current_handle(winapi_screen_manager);
|
||||
|
||||
let success;
|
||||
|
||||
unsafe {
|
||||
success = FillConsoleOutputAttribute (
|
||||
output_handle,
|
||||
*handle,
|
||||
csbi.wAttributes,
|
||||
cells_to_write,
|
||||
start_location,
|
||||
@ -239,6 +307,7 @@ pub fn fill_console_output_attribute(cells_written: &mut u32, start_location: CO
|
||||
is_true(success)
|
||||
}
|
||||
|
||||
/// Create new console screen buffer. This can be used for alternate screen.
|
||||
pub fn create_console_screen_buffer() -> HANDLE
|
||||
{
|
||||
use winapi::shared::ntdef::NULL;
|
||||
@ -269,6 +338,7 @@ pub fn create_console_screen_buffer() -> HANDLE
|
||||
}
|
||||
}
|
||||
|
||||
/// Set the active screen buffer to the given handle. This can be used for alternate screen.
|
||||
pub fn set_active_screen_buffer(new_buffer: HANDLE)
|
||||
{
|
||||
unsafe
|
||||
@ -280,6 +350,7 @@ pub fn set_active_screen_buffer(new_buffer: HANDLE)
|
||||
}
|
||||
}
|
||||
|
||||
/// Read the console outptut.
|
||||
pub fn read_console_output(read_buffer: &HANDLE, copy_buffer: &mut [CHAR_INFO;160], buffer_size: COORD, buffer_coord: COORD, source_buffer: PSMALL_RECT)
|
||||
{
|
||||
use self::wincon::ReadConsoleOutputA;
|
||||
@ -299,6 +370,7 @@ pub fn read_console_output(read_buffer: &HANDLE, copy_buffer: &mut [CHAR_INFO;16
|
||||
}
|
||||
}
|
||||
|
||||
/// Write console output.
|
||||
pub fn write_console_output(write_buffer: &HANDLE, copy_buffer: &mut [CHAR_INFO;160], buffer_size: COORD, buffer_coord: COORD, source_buffer: PSMALL_RECT)
|
||||
{
|
||||
use self::wincon::WriteConsoleOutputA;
|
||||
@ -318,38 +390,34 @@ pub fn write_console_output(write_buffer: &HANDLE, copy_buffer: &mut [CHAR_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
use std::ffi::OsStr;
|
||||
use std::os::windows::ffi::OsStrExt;
|
||||
use std::iter::once;
|
||||
|
||||
fn win32_string( value : &str ) -> Vec<u16> {
|
||||
OsStr::new( value ).encode_wide().chain( once( 0 ) ).collect()
|
||||
}
|
||||
|
||||
//use std::os::raw::c_void;
|
||||
use winapi::ctypes::c_void;
|
||||
use std::mem::transmute;
|
||||
use std::str;
|
||||
|
||||
/// Write utf8 buffer to console.
|
||||
pub fn write_char_buffer(handle: HANDLE, buf: &[u8])
|
||||
{
|
||||
use std::ffi::{ NulError, CString };
|
||||
use std::str;
|
||||
|
||||
// get string from u8[] and parse it to an c_str
|
||||
let mut utf8 = match str::from_utf8(buf)
|
||||
{
|
||||
Ok(string) => string,
|
||||
Err(_) => "",
|
||||
Err(_) => "123",
|
||||
};
|
||||
|
||||
let utf16_bytes: Vec<u16> = utf8.encode_utf16().collect();
|
||||
|
||||
let mut utf16 = match String::from_utf16(&utf16_bytes)
|
||||
{
|
||||
Ok(string) => string,
|
||||
Err(_) => String::new()
|
||||
};
|
||||
|
||||
let str_length = utf16.len() as u32;
|
||||
|
||||
let c_str = match CString::new(utf16)
|
||||
{
|
||||
Ok(c) => c,
|
||||
Err(_) => CString::new("").unwrap()
|
||||
};
|
||||
|
||||
let ptr: *const i8 = c_str.as_ptr() as *const i8;
|
||||
let utf16: Vec<u16> = utf8.encode_utf16().collect();
|
||||
let utf16_ptr: *const c_void = utf16.as_ptr() as *const _ as *const c_void;
|
||||
|
||||
// get buffer info
|
||||
let csbi = get_console_screen_buffer_info();
|
||||
let csbi = get_console_screen_buffer_info_from_handle(&handle);
|
||||
|
||||
// get current position
|
||||
let current_pos = COORD {X: csbi.dwCursorPosition.X, Y: csbi.dwCursorPosition.Y};
|
||||
@ -359,18 +427,8 @@ pub fn write_char_buffer(handle: HANDLE, buf: &[u8])
|
||||
// write to console
|
||||
unsafe
|
||||
{
|
||||
// WriteConsoleOutputCharacterA()
|
||||
// ::winapi::um::consoleapi::WriteConsoleW(handle, utf16.as_ptr(), utf16.len() as u32, &mut cells_written, NULL);
|
||||
WriteConsoleOutputCharacterA(handle, ptr, str_length, current_pos, &mut cells_written);
|
||||
WriteConsoleW(handle, utf16_ptr, utf16.len() as u32, &mut cells_written, NULL);
|
||||
}
|
||||
|
||||
// get buffer info
|
||||
let csbi = get_console_screen_buffer_info();
|
||||
|
||||
// get current position
|
||||
let new_pos = COORD {X: csbi.dwCursorPosition.X, Y: csbi.dwCursorPosition.Y};
|
||||
|
||||
set_console_cursor_position(new_pos.X, new_pos.Y + 1);
|
||||
}
|
||||
|
||||
/// Parse integer to an bool
|
||||
|
@ -1,12 +1,18 @@
|
||||
use ScreenManager;
|
||||
use std::sync::Mutex;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
||||
/// Get the terminal size
|
||||
pub fn terminal_size() -> (u16, u16) {
|
||||
let csbi = super::kernel::get_console_screen_buffer_info();
|
||||
pub fn terminal_size(screen_manager: &Rc<Mutex<ScreenManager>>) -> (u16, u16) {
|
||||
let csbi = super::kernel::get_console_screen_buffer_info(screen_manager);
|
||||
(
|
||||
(csbi.srWindow.Right - csbi.srWindow.Left) as u16,
|
||||
(csbi.srWindow.Bottom - csbi.srWindow.Top) as u16,
|
||||
)
|
||||
}
|
||||
|
||||
/// Exit the current process.
|
||||
pub fn exit()
|
||||
{
|
||||
::std::process::exit(256);
|
||||
|
@ -13,7 +13,8 @@ pub mod style;
|
||||
pub mod terminal;
|
||||
pub mod manager;
|
||||
|
||||
pub use shared::{screen, raw};
|
||||
pub use shared::{screen};
|
||||
pub use shared::environment::Environment;
|
||||
pub use state::context::Context;
|
||||
|
||||
use state::commands::IStateCommand;
|
||||
|
@ -1,5 +1,6 @@
|
||||
//! This module provides an interface for working with the sceen. With that I mean that you can get or wirte to the handle of the current screen. stdout.
|
||||
//! Because crossterm can work with alternate screen, we need a place that holds the handle to the current screen. And this module provides this place.
|
||||
//! This module provides an interface for working with the screen. With that I mean that you can get or wirte to the handle of the current screen. stdout.
|
||||
//! Because crossterm can work with alternate screen, we need a place that holds the handle to the current screen so we can write to that screen.
|
||||
|
||||
use super::*;
|
||||
use super::super::shared::functions;
|
||||
use std::any::Any;
|
||||
@ -20,15 +21,15 @@ impl ScreenManager
|
||||
{
|
||||
/// Create new screen manager instance whereon screen related actions can be performed.
|
||||
pub fn new() -> ScreenManager {
|
||||
// #[cfg(target_os = "windows")]
|
||||
// let screen_manager = functions::get_module::<Box<IScreenManager>>(Box::from(WinApiScreenManager::new()), Box::from(AnsiScreenManager::new())).unwrap();
|
||||
//
|
||||
// #[cfg(not(target_os = "windows"))]
|
||||
// let screen_manager = Box::from(AnsiScreenManager::new()) as Box<IScreenManager>;
|
||||
#[cfg(target_os = "windows")]
|
||||
let screen_manager = functions::get_module::<Box<IScreenManager>>(Box::from(WinApiScreenManager::new()), Box::from(AnsiScreenManager::new())).unwrap();
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let screen_manager = Box::from(AnsiScreenManager::new()) as Box<IScreenManager>;
|
||||
|
||||
ScreenManager
|
||||
{
|
||||
screen_manager: Box::new(WinApiScreenManager::new())
|
||||
screen_manager: screen_manager
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,13 +50,19 @@ impl ScreenManager
|
||||
self.screen_manager.write_ansi_str(string);
|
||||
}
|
||||
|
||||
/// Can be used to get an specific implementation used for the current platform.
|
||||
pub fn as_any(&mut self) -> &mut Any { self.screen_manager.as_any() }
|
||||
|
||||
pub fn write_val(&mut self, value: String)
|
||||
{
|
||||
self.screen_manager.write(value.as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
impl Write for ScreenManager
|
||||
{
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
self.screen_manager.write(buf)
|
||||
self.write(buf)
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
|
@ -17,17 +17,16 @@ use std::any::Any;
|
||||
|
||||
pub trait IScreenManager
|
||||
{
|
||||
/// get the stdout of the screen. This can be used to write to the
|
||||
// fn stdout(&mut self) -> &mut Self::Output;
|
||||
/// Toggle the value if alternatescreen is on.
|
||||
fn toggle_is_alternate_screen(&mut self, is_alternate_screen: bool);
|
||||
/// Write ansi code as String to the current stdout.
|
||||
fn write_ansi(&mut self, string: String);
|
||||
/// Write a &str to the current stdout.
|
||||
fn write_ansi_str(&mut self, string: &str);
|
||||
|
||||
/// Write buffer to console.
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize>;
|
||||
|
||||
/// Flush the current output.
|
||||
fn flush(&mut self) -> io::Result<()>;
|
||||
|
||||
/// Can be used to convert to an specific IScreenManager implementation.
|
||||
fn as_any(&mut self) -> &mut Any;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
use super::IScreenManager;
|
||||
use kernel::windows_kernel::kernel;
|
||||
use winapi::um::winnt::HANDLE;
|
||||
use winapi::um::wincon::ENABLE_PROCESSED_OUTPUT;
|
||||
|
||||
use std::io::{self,Write};
|
||||
use std::any::Any;
|
||||
@ -59,16 +60,19 @@ impl WinApiScreenManager {
|
||||
pub fn set_alternate_handle(&mut self, alternate_handle: HANDLE)
|
||||
{
|
||||
self.alternate_handle = alternate_handle;
|
||||
|
||||
// needs to be turned on so that escape characters like \n and \t will be processed.
|
||||
kernel::set_console_mode(&self.alternate_handle, ENABLE_PROCESSED_OUTPUT as u32);
|
||||
}
|
||||
|
||||
pub fn get_handle(&mut self) -> Rc<HANDLE>
|
||||
pub fn get_handle(&mut self) -> &HANDLE
|
||||
{
|
||||
if self.is_alternate_screen
|
||||
{
|
||||
return Rc::from(self.alternate_handle);
|
||||
}
|
||||
else {
|
||||
return Rc::from(self.output);
|
||||
}
|
||||
{
|
||||
return &self.alternate_handle;
|
||||
}
|
||||
else {
|
||||
return &self.output;
|
||||
}
|
||||
}
|
||||
}
|
66
src/shared/environment.rs
Normal file
66
src/shared/environment.rs
Normal file
@ -0,0 +1,66 @@
|
||||
use Context;
|
||||
use super::super::cursor;
|
||||
use super::super::terminal::terminal;
|
||||
use super::super::style;
|
||||
|
||||
use std::mem;
|
||||
use std::rc::Rc;
|
||||
use std::fmt::Display;
|
||||
use std::sync::{ONCE_INIT, Once};
|
||||
static START: Once = ONCE_INIT;
|
||||
|
||||
pub struct Environment
|
||||
{
|
||||
context: Rc<Context>,
|
||||
terminal: Box<terminal::Terminal>,
|
||||
cursor: Box<cursor::TerminalCursor>,
|
||||
color: Box<style::TerminalColor>
|
||||
}
|
||||
|
||||
impl Environment
|
||||
{
|
||||
pub fn new() -> Environment
|
||||
{
|
||||
return Environment { context: Context::new(), terminal: unsafe{ mem::zeroed()}, cursor: unsafe{ mem::zeroed()}, color: unsafe{ mem::zeroed() }}
|
||||
}
|
||||
|
||||
pub fn terminal(&mut self) -> &Box<terminal::Terminal>
|
||||
{
|
||||
START.call_once(|| {
|
||||
self.terminal = terminal::terminal(self.context.clone());
|
||||
|
||||
});
|
||||
|
||||
&self.terminal
|
||||
}
|
||||
|
||||
pub fn cursor(&mut self) -> &Box<cursor::TerminalCursor>
|
||||
{
|
||||
START.call_once(|| {
|
||||
self.cursor = cursor::cursor(self.context.clone());
|
||||
|
||||
});
|
||||
|
||||
&self.cursor
|
||||
}
|
||||
|
||||
pub fn color(&mut self) -> &Box<style::TerminalColor>
|
||||
{
|
||||
START.call_once(|| {
|
||||
self.color = style::color(self.context.clone());
|
||||
|
||||
});
|
||||
|
||||
&self.color
|
||||
}
|
||||
|
||||
pub fn paint<D: Display>(&mut self, value: D) -> style::StyledObject<D>
|
||||
{
|
||||
self.terminal().paint(value)
|
||||
}
|
||||
|
||||
pub fn context(&self) -> Rc<Context>
|
||||
{
|
||||
return self.context.clone()
|
||||
}
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
//! Some actions need to preformed platform independently since they can not be solved `ANSI escape codes`.
|
||||
|
||||
use Context;
|
||||
use ScreenManager;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
#[cfg(windows)]
|
||||
use kernel::windows_kernel::terminal::{exit, terminal_size};
|
||||
@ -13,9 +15,13 @@ use kernel::windows_kernel::cursor::pos;
|
||||
use kernel::unix_kernel::terminal::{pos, exit,terminal_size };
|
||||
|
||||
/// Get the terminal size based on the current platform.
|
||||
pub fn get_terminal_size() -> (u16, u16)
|
||||
pub fn get_terminal_size(screen_manager: &Rc<Mutex<ScreenManager>>) -> (u16, u16)
|
||||
{
|
||||
terminal_size()
|
||||
#[cfg(unix)]
|
||||
return terminal_size(screen_manager);
|
||||
|
||||
#[cfg(windows)]
|
||||
return terminal_size(screen_manager);
|
||||
}
|
||||
|
||||
/// Get the cursor position based on the current platform.
|
||||
@ -25,7 +31,7 @@ pub fn get_cursor_position(context: Rc<Context>) -> (u16, u16)
|
||||
return pos(context.clone());
|
||||
|
||||
#[cfg(windows)]
|
||||
return pos();
|
||||
return pos(&context.screen_manager);
|
||||
}
|
||||
|
||||
/// exit the current terminal.
|
||||
@ -46,12 +52,13 @@ pub fn get_module<T>(winapi_impl: T, unix_impl: T) -> Option<T>
|
||||
let mut does_support = true;
|
||||
|
||||
if cfg!(target_os = "windows") {
|
||||
#[cfg(windows)]
|
||||
use kernel::windows_kernel::ansi_support::try_enable_ansi_support;
|
||||
// #[cfg(windows)]
|
||||
// use kernel::windows_kernel::ansi_support::try_enable_ansi_support;
|
||||
|
||||
// Try to enable ansi on windows if not than use WINAPI.
|
||||
does_support = try_enable_ansi_support();
|
||||
// does_support = try_enable_ansi_support();
|
||||
|
||||
does_support = false;
|
||||
if !does_support
|
||||
{
|
||||
term = Some(winapi_impl);
|
||||
@ -60,6 +67,7 @@ pub fn get_module<T>(winapi_impl: T, unix_impl: T) -> Option<T>
|
||||
|
||||
if does_support
|
||||
{
|
||||
println!("Does support");
|
||||
term = Some(unix_impl);
|
||||
}
|
||||
|
||||
|
@ -5,4 +5,7 @@ pub mod macros;
|
||||
pub mod traits;
|
||||
pub mod functions;
|
||||
pub mod screen;
|
||||
pub mod environment;
|
||||
|
||||
#[cfg(target_os = "unix")]
|
||||
pub mod raw;
|
@ -12,6 +12,8 @@
|
||||
//!
|
||||
//! With these modes you can easier design the terminal screen.
|
||||
//!
|
||||
//! !! Note that this module is only working for unix currently. !!
|
||||
//!
|
||||
//! # Example
|
||||
//!
|
||||
//! ```rust
|
||||
|
@ -4,9 +4,13 @@
|
||||
//! The alternate buffer is exactly the dimensions of the window, without any scrollback region.
|
||||
//! For an example of this behavior, consider when vim is launched from bash.
|
||||
//! Vim uses the entirety of the screen to edit the file, then returning to bash leaves the original buffer unchanged.
|
||||
//!
|
||||
//! !! Note: this module is only working for unix and windows 10 terminals only. If you are using windows 10 or lower do not implement this functionality. Work in progress...
|
||||
//!
|
||||
|
||||
use Context;
|
||||
use state::commands::*;
|
||||
use shared::functions;
|
||||
|
||||
use std::io::{self, Write};
|
||||
use std::rc::Rc;
|
||||
@ -79,27 +83,20 @@ impl Drop for AlternateScreen
|
||||
{
|
||||
fn drop(&mut self)
|
||||
{
|
||||
let mut mutex = &self.context.state_manager;
|
||||
{
|
||||
let mut state_manager = mutex.lock().unwrap();
|
||||
use CommandManager;
|
||||
|
||||
let mut mx = &state_manager.get(self.command_id);
|
||||
{
|
||||
let mut command = mx.lock().unwrap();
|
||||
command.undo();
|
||||
}
|
||||
}
|
||||
CommandManager::undo(self.context.clone(), self.command_id);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the alternate screen command to enable and disable alternate screen based on the current platform
|
||||
fn get_to_alternate_screen_command(context: Rc<Context>) -> u16
|
||||
{
|
||||
// #[cfg(target_os = "windows")]
|
||||
// let command = functions::get_module::<Box<ICommand>>(win_commands::ToAlternateScreenBufferCommand::new(), shared_commands::ToAlternateScreenBufferCommand::new(), context).unwrap();
|
||||
//
|
||||
// #[cfg(not(target_os = "windows"))]
|
||||
// shared_commands::ToAlternateScreenBufferCommand::new(context.clone())
|
||||
#[cfg(target_os = "windows")]
|
||||
let command_id = functions::get_module::<u16>(win_commands::ToAlternateScreenBufferCommand::new(context.clone()), shared_commands::ToAlternateScreenBufferCommand::new(context.clone())).unwrap();
|
||||
|
||||
win_commands::ToAlternateScreenBufferCommand::new(context.clone())
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let command_id = shared_commands::ToAlternateScreenBufferCommand::new(context.clone());
|
||||
|
||||
return command_id;
|
||||
}
|
@ -44,9 +44,10 @@ impl IStateCommand for ToAlternateScreenBufferCommand
|
||||
{
|
||||
fn execute(&mut self) -> bool
|
||||
{
|
||||
|
||||
println!("asdfasdf");
|
||||
let mut screen = self.context.screen_manager.lock().unwrap();
|
||||
{
|
||||
screen.write_ansi_str(csi!("?1049h"));
|
||||
screen.toggle_is_alternate_screen(true);
|
||||
return true;
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
//! This module contains the commands that can be used for windows systems.
|
||||
|
||||
use super::IStateCommand;
|
||||
use { StateManager, Context };
|
||||
use {StateManager, Context};
|
||||
|
||||
use kernel::windows_kernel::{kernel, ansi_support};
|
||||
use winapi::shared::minwindef::DWORD;
|
||||
use winapi::um::wincon;
|
||||
use winapi::um::wincon::{ENABLE_VIRTUAL_TERMINAL_PROCESSING ,SMALL_RECT, COORD, CHAR_INFO};
|
||||
use winapi::um::wincon::{ENABLE_VIRTUAL_TERMINAL_PROCESSING, SMALL_RECT, COORD, CHAR_INFO};
|
||||
use std::mem;
|
||||
|
||||
use std::rc::Rc;
|
||||
@ -17,7 +17,7 @@ use std::sync::Mutex;
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct EnableAnsiCommand
|
||||
{
|
||||
mask: DWORD,
|
||||
mask: DWORD,
|
||||
}
|
||||
|
||||
impl EnableAnsiCommand
|
||||
@ -31,7 +31,7 @@ impl EnableAnsiCommand
|
||||
|
||||
impl IStateCommand for EnableAnsiCommand
|
||||
{
|
||||
fn execute(&mut self,) -> bool
|
||||
fn execute(&mut self) -> bool
|
||||
{
|
||||
// we need to check whether we tried to enable ansi before. If we have we can just return if that had succeeded.
|
||||
if ansi_support::has_been_tried_to_enable_ansi() && ansi_support::ansi_enabled()
|
||||
@ -59,23 +59,23 @@ impl IStateCommand for EnableAnsiCommand
|
||||
fn undo(&mut self) -> bool
|
||||
{
|
||||
if ansi_support::ansi_enabled()
|
||||
{
|
||||
let output_handle = kernel::get_output_handle();
|
||||
|
||||
let mut dw_mode: DWORD = 0;
|
||||
if !kernel::get_console_mode(&output_handle, &mut dw_mode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dw_mode &= !self.mask;
|
||||
if !kernel::set_console_mode(&output_handle, dw_mode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
let output_handle = kernel::get_output_handle();
|
||||
|
||||
ansi_support::set_ansi_enabled(false);
|
||||
}
|
||||
let mut dw_mode: DWORD = 0;
|
||||
if !kernel::get_console_mode(&output_handle, &mut dw_mode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dw_mode &= !self.mask;
|
||||
if !kernel::set_console_mode(&output_handle, dw_mode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ansi_support::set_ansi_enabled(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -86,18 +86,18 @@ impl IStateCommand for EnableAnsiCommand
|
||||
pub struct EnableRawModeCommand
|
||||
{
|
||||
mask: DWORD,
|
||||
key: u16
|
||||
key: u16,
|
||||
}
|
||||
|
||||
impl EnableRawModeCommand
|
||||
{
|
||||
pub fn new(state_manager: &Mutex<StateManager>) -> u16 {
|
||||
use self::wincon::{ENABLE_LINE_INPUT,ENABLE_PROCESSED_INPUT, ENABLE_ECHO_INPUT};
|
||||
use self::wincon::{ENABLE_LINE_INPUT, ENABLE_PROCESSED_INPUT, ENABLE_ECHO_INPUT};
|
||||
|
||||
let mut state = state_manager.lock().unwrap();
|
||||
{
|
||||
let key = state.get_changes_count();
|
||||
let command = EnableRawModeCommand { mask: ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT, key: key };
|
||||
let command = EnableRawModeCommand { mask: ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT, key: key };
|
||||
state.register_change(Box::from(command), key);
|
||||
key
|
||||
}
|
||||
@ -112,16 +112,16 @@ impl IStateCommand for EnableRawModeCommand
|
||||
|
||||
let mut dw_mode: DWORD = 0;
|
||||
if !kernel::get_console_mode(&input_handle, &mut dw_mode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
let new_mode = dw_mode & !self.mask;
|
||||
|
||||
if !kernel::set_console_mode(&input_handle, new_mode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
@ -132,16 +132,16 @@ impl IStateCommand for EnableRawModeCommand
|
||||
|
||||
let mut dw_mode: DWORD = 0;
|
||||
if !kernel::get_console_mode(&output_handle, &mut dw_mode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
let new_mode = dw_mode | self.mask;
|
||||
|
||||
if !kernel::set_console_mode(&output_handle, new_mode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
@ -161,7 +161,7 @@ impl ToAlternateScreenBufferCommand
|
||||
let mut state = context.state_manager.lock().unwrap();
|
||||
{
|
||||
let key = state.get_changes_count();
|
||||
let command = ToAlternateScreenBufferCommand {context: context.clone()};
|
||||
let command = ToAlternateScreenBufferCommand { context: context.clone() };
|
||||
|
||||
state.register_change(Box::from(command), key);
|
||||
key
|
||||
@ -175,7 +175,7 @@ impl IStateCommand for ToAlternateScreenBufferCommand
|
||||
{
|
||||
use super::super::super::manager::WinApiScreenManager;
|
||||
|
||||
let mut chi_buffer: [CHAR_INFO;160] = unsafe {mem::zeroed() };
|
||||
let mut chi_buffer: [CHAR_INFO; 160] = unsafe { mem::zeroed() };
|
||||
|
||||
let handle = kernel::get_output_handle();
|
||||
|
||||
@ -189,7 +189,7 @@ impl IStateCommand for ToAlternateScreenBufferCommand
|
||||
screen_manager.toggle_is_alternate_screen(true);
|
||||
|
||||
let b: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
|
||||
Some(b) => { b },
|
||||
Some(b) => { b }
|
||||
None => panic!("")
|
||||
};
|
||||
|
||||
|
@ -45,10 +45,13 @@ impl Context
|
||||
}
|
||||
}
|
||||
|
||||
use std::io::Write;
|
||||
|
||||
impl Drop for Context
|
||||
{
|
||||
fn drop(&mut self)
|
||||
{
|
||||
panic!();
|
||||
let mut changes = self.state_manager.lock().unwrap();
|
||||
changes.restore_changes();
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ impl StateManager
|
||||
{
|
||||
let mut item = item.lock().unwrap();
|
||||
item.undo();
|
||||
|
||||
println!("undo!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ impl TerminalColor {
|
||||
/// Create new instance whereon color related actions can be performed.
|
||||
pub fn new(context: Rc<Context>) -> TerminalColor {
|
||||
#[cfg(target_os = "windows")]
|
||||
let color = functions::get_module::<Box<ITerminalColor>>(WinApiColor::new(), AnsiColor::new());
|
||||
let color = functions::get_module::<Box<ITerminalColor>>(WinApiColor::new(context.screen_manager.clone()), AnsiColor::new());
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let color = Some(AnsiColor::new() as Box<ITerminalColor>);
|
||||
|
@ -8,15 +8,16 @@ use std::sync::Mutex;
|
||||
use std::rc::Rc;
|
||||
|
||||
/// This struct is an windows implementation for color related actions.
|
||||
#[derive(Debug)]
|
||||
pub struct WinApiColor {
|
||||
original_console_color: u16,
|
||||
screen_manager: Rc<Mutex<ScreenManager>>
|
||||
}
|
||||
|
||||
impl WinApiColor {
|
||||
pub fn new() -> Box<WinApiColor> {
|
||||
pub fn new(screen_manager: Rc<Mutex<ScreenManager>>) -> Box<WinApiColor> {
|
||||
Box::from(WinApiColor {
|
||||
original_console_color: kernel::get_original_console_color(),
|
||||
original_console_color: kernel::get_original_console_color(&screen_manager),
|
||||
screen_manager: screen_manager
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -26,7 +27,7 @@ impl ITerminalColor for WinApiColor {
|
||||
fn set_fg(&self, fg_color: Color, screen_manager: Rc<Mutex<ScreenManager>>) {
|
||||
let color_value = &self.color_value(fg_color, ColorType::Foreground);
|
||||
|
||||
let csbi = kernel::get_console_screen_buffer_info();
|
||||
let csbi = kernel::get_console_screen_buffer_info(&self.screen_manager);
|
||||
|
||||
// Notice that the color values are stored in wAttribute.
|
||||
// So we need to use bitwise operators to check if the values exists or to get current console colors.
|
||||
@ -41,13 +42,13 @@ impl ITerminalColor for WinApiColor {
|
||||
color = color | wincon::BACKGROUND_INTENSITY as u16;
|
||||
}
|
||||
|
||||
kernel::set_console_text_attribute(color);
|
||||
kernel::set_console_text_attribute(color,&self.screen_manager);
|
||||
}
|
||||
|
||||
fn set_bg(&self, bg_color: Color, screen_manager: Rc<Mutex<ScreenManager>>) {
|
||||
let color_value = &self.color_value(bg_color, ColorType::Background);
|
||||
|
||||
let csbi = kernel::get_console_screen_buffer_info();
|
||||
let csbi = kernel::get_console_screen_buffer_info(&self.screen_manager);
|
||||
// Notice that the color values are stored in wAttribute.
|
||||
// So wee need to use bitwise operators to check if the values exists or to get current console colors.
|
||||
let mut color: u16;
|
||||
@ -61,11 +62,11 @@ impl ITerminalColor for WinApiColor {
|
||||
color = color | wincon::FOREGROUND_INTENSITY as u16;
|
||||
}
|
||||
|
||||
kernel::set_console_text_attribute(color);
|
||||
kernel::set_console_text_attribute(color,&self.screen_manager);
|
||||
}
|
||||
|
||||
fn reset(&self, screen_manager: Rc<Mutex<ScreenManager>>) {
|
||||
kernel::set_console_text_attribute(self.original_console_color);
|
||||
kernel::set_console_text_attribute(self.original_console_color,&self.screen_manager);
|
||||
}
|
||||
|
||||
/// This will get the winapi color value from the Color and ColorType struct
|
||||
|
@ -10,7 +10,7 @@ use std::rc::Rc;
|
||||
use super::super::Attribute;
|
||||
|
||||
/// Struct that contains the style properties that can be applied to an displayable object.
|
||||
#[derive(Clone)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct ObjectStyle {
|
||||
pub fg_color: Option<Color>,
|
||||
pub bg_color: Option<Color>,
|
||||
|
@ -43,7 +43,7 @@ impl ITerminal for AnsiTerminal {
|
||||
}
|
||||
|
||||
fn terminal_size(&self) -> (u16, u16) {
|
||||
functions::get_terminal_size()
|
||||
functions::get_terminal_size(&self.context.screen_manager)
|
||||
}
|
||||
|
||||
fn scroll_up(&self, count: i16) {
|
||||
|
@ -6,6 +6,7 @@ use Context;
|
||||
use super::super::style;
|
||||
use super::super::shared::functions;
|
||||
|
||||
use std::fmt::Write;
|
||||
use std::fmt;
|
||||
use std::rc::Rc;
|
||||
|
||||
@ -193,6 +194,20 @@ impl Terminal {
|
||||
terminal.exit();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn write<D: fmt::Display>(&mut self, value: D)
|
||||
{
|
||||
let mut mutex = &self.context.screen_manager;
|
||||
{
|
||||
let mut screen_manager = mutex.lock().unwrap();
|
||||
|
||||
use std::fmt::Write;
|
||||
let mut string = String::new();
|
||||
write!(string, "{}", value).unwrap();
|
||||
|
||||
screen_manager.write_val(string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Get an Terminal implementation whereon terminal related actions can be performed.
|
||||
|
@ -7,6 +7,9 @@ use super::{ClearType, ITerminal, Rc};
|
||||
use winapi::um::wincon::{SMALL_RECT, COORD, CONSOLE_SCREEN_BUFFER_INFO,};
|
||||
use kernel::windows_kernel::{kernel, terminal};
|
||||
use super::super::shared::functions;
|
||||
use super::super::ScreenManager;
|
||||
|
||||
use std::sync::Mutex;
|
||||
|
||||
/// This struct is an windows implementation for terminal related actions.
|
||||
pub struct WinApiTerminal
|
||||
@ -23,29 +26,29 @@ impl WinApiTerminal {
|
||||
impl ITerminal for WinApiTerminal {
|
||||
|
||||
fn clear(&self, clear_type: ClearType) {
|
||||
let csbi = kernel::get_console_screen_buffer_info();
|
||||
let csbi = kernel::get_console_screen_buffer_info(&self.context.screen_manager);
|
||||
let pos = cursor(self.context.clone()).pos();
|
||||
|
||||
match clear_type
|
||||
{
|
||||
ClearType::All => clear_entire_screen(csbi, self.context.clone()),
|
||||
ClearType::FromCursorDown => clear_after_cursor(pos,csbi, self.context.clone()),
|
||||
ClearType::FromCursorUp => clear_before_cursor(pos, csbi, self.context.clone()),
|
||||
ClearType::CurrentLine => clear_current_line(pos, csbi, self.context.clone()),
|
||||
ClearType::UntilNewLine => clear_until_line(pos, csbi,self.context.clone()),
|
||||
ClearType::All => clear_entire_screen(csbi, &self.context),
|
||||
ClearType::FromCursorDown => clear_after_cursor(pos,csbi, &self.context),
|
||||
ClearType::FromCursorUp => clear_before_cursor(pos, csbi, &self.context),
|
||||
ClearType::CurrentLine => clear_current_line(pos, csbi, &self.context),
|
||||
ClearType::UntilNewLine => clear_until_line(pos, csbi, &self.context),
|
||||
};
|
||||
}
|
||||
|
||||
fn terminal_size(&self) -> (u16, u16) {
|
||||
terminal::terminal_size()
|
||||
terminal::terminal_size(&self.context.screen_manager)
|
||||
}
|
||||
|
||||
fn scroll_up(&self, count: i16) {
|
||||
// yet to be inplemented
|
||||
// yet to be implemented
|
||||
}
|
||||
|
||||
fn scroll_down(&self, count: i16) {
|
||||
let csbi = kernel::get_console_screen_buffer_info();
|
||||
let csbi = kernel::get_console_screen_buffer_info(&self.context.screen_manager);
|
||||
let mut srct_window;
|
||||
|
||||
// Set srctWindow to the current window size and location.
|
||||
@ -56,7 +59,7 @@ impl ITerminal for WinApiTerminal {
|
||||
srct_window.Top += count; // move top down
|
||||
srct_window.Bottom += count; // move bottom down
|
||||
|
||||
let success = kernel::set_console_info(true, &mut srct_window);
|
||||
let success = kernel::set_console_info(true, &mut srct_window, &self.context.screen_manager);
|
||||
if success {
|
||||
panic!("Something went wrong when scrolling down");
|
||||
}
|
||||
@ -76,7 +79,7 @@ impl ITerminal for WinApiTerminal {
|
||||
}
|
||||
|
||||
// Get the position of the current console window
|
||||
let csbi = kernel::get_console_screen_buffer_info();
|
||||
let csbi = kernel::get_console_screen_buffer_info(&self.context.screen_manager);
|
||||
let mut success = false;
|
||||
|
||||
// If the buffer is smaller than this new window size, resize the
|
||||
@ -105,7 +108,7 @@ impl ITerminal for WinApiTerminal {
|
||||
}
|
||||
|
||||
if resize_buffer {
|
||||
success = kernel::set_console_screen_buffer_size(size);
|
||||
success = kernel::set_console_screen_buffer_size(size, &self.context.screen_manager);
|
||||
|
||||
if !success
|
||||
{
|
||||
@ -118,12 +121,12 @@ impl ITerminal for WinApiTerminal {
|
||||
fsr_window.Bottom = fsr_window.Top + height;
|
||||
fsr_window.Right = fsr_window.Left + width;
|
||||
|
||||
let success = kernel::set_console_info(true, &fsr_window);
|
||||
let success = kernel::set_console_info(true, &fsr_window, &self.context.screen_manager);
|
||||
|
||||
if success {
|
||||
// If we resized the buffer, un-resize it.
|
||||
if resize_buffer {
|
||||
kernel::set_console_screen_buffer_size(csbi.dwSize);
|
||||
kernel::set_console_screen_buffer_size(csbi.dwSize, &self.context.screen_manager);
|
||||
}
|
||||
|
||||
let bounds = kernel::get_largest_console_window_size();
|
||||
@ -145,7 +148,7 @@ impl ITerminal for WinApiTerminal {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clear_after_cursor(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, context: Rc<Context>) {
|
||||
pub fn clear_after_cursor(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, context: &Rc<Context>) {
|
||||
let (mut x,mut y) = pos;
|
||||
|
||||
// if cursor position is at the outer right position
|
||||
@ -160,10 +163,10 @@ pub fn clear_after_cursor(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, cont
|
||||
// get sum cells before cursor
|
||||
let cells_to_write = csbi.dwSize.X as u32 * csbi.dwSize.Y as u32;
|
||||
|
||||
clear(start_location,cells_to_write);
|
||||
clear(start_location,cells_to_write, &context.screen_manager);
|
||||
}
|
||||
|
||||
pub fn clear_before_cursor(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, context: Rc<Context>) {
|
||||
pub fn clear_before_cursor(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, context: &Rc<Context>) {
|
||||
let (xpos,ypos) = pos;
|
||||
|
||||
// one cell after cursor position
|
||||
@ -176,10 +179,10 @@ pub fn clear_before_cursor(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, con
|
||||
// get sum cells before cursor
|
||||
let cells_to_write = (csbi.dwSize.X as u32 * ypos as u32) + (xpos as u32 + 1);
|
||||
|
||||
clear(start_location, cells_to_write);
|
||||
clear(start_location, cells_to_write, &context.screen_manager);
|
||||
}
|
||||
|
||||
pub fn clear_entire_screen(csbi: CONSOLE_SCREEN_BUFFER_INFO, context: Rc<Context>) {
|
||||
pub fn clear_entire_screen(csbi: CONSOLE_SCREEN_BUFFER_INFO, context: &Rc<Context>) {
|
||||
// position x at start
|
||||
let x = 0;
|
||||
// position y at start
|
||||
@ -191,13 +194,13 @@ pub fn clear_entire_screen(csbi: CONSOLE_SCREEN_BUFFER_INFO, context: Rc<Context
|
||||
|
||||
let cells_to_write = csbi.dwSize.X as u32 * csbi.dwSize.Y as u32;
|
||||
|
||||
clear( start_location, cells_to_write);
|
||||
clear( start_location, cells_to_write, &context.screen_manager);
|
||||
|
||||
// put the cursor back at (0, 0)
|
||||
cursor(context.clone()).goto(0, 0);
|
||||
}
|
||||
|
||||
pub fn clear_current_line(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, context: Rc<Context>)
|
||||
pub fn clear_current_line(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, context: &Rc<Context>)
|
||||
{
|
||||
// position x at start
|
||||
let x = 0;
|
||||
@ -210,13 +213,13 @@ pub fn clear_current_line(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, cont
|
||||
|
||||
let cells_to_write = csbi.dwSize.X as u32;
|
||||
|
||||
clear(start_location, cells_to_write);
|
||||
clear(start_location, cells_to_write, &context.screen_manager);
|
||||
|
||||
// put the cursor back at 1 cell on current row
|
||||
cursor(context.clone()).goto(0, y);
|
||||
}
|
||||
|
||||
pub fn clear_until_line(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, context: Rc<Context>)
|
||||
pub fn clear_until_line(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, context: &Rc<Context>)
|
||||
{
|
||||
let (x,y) = pos;
|
||||
|
||||
@ -225,7 +228,7 @@ pub fn clear_until_line(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, contex
|
||||
// get sum cells before cursor
|
||||
let cells_to_write = (csbi.dwSize.X - x as i16) as u32;
|
||||
|
||||
clear(start_location, cells_to_write);
|
||||
clear(start_location, cells_to_write, &context.screen_manager);
|
||||
|
||||
// put the cursor back at original cursor position
|
||||
cursor(context.clone()).goto(x,y);
|
||||
@ -233,12 +236,13 @@ pub fn clear_until_line(pos: (u16,u16), csbi: CONSOLE_SCREEN_BUFFER_INFO, contex
|
||||
|
||||
fn clear(
|
||||
start_loaction: COORD,
|
||||
cells_to_write: u32
|
||||
cells_to_write: u32,
|
||||
screen_manager: &Rc<Mutex<ScreenManager>>
|
||||
) {
|
||||
let mut cells_written = 0;
|
||||
let mut success = false;
|
||||
|
||||
success = kernel::fill_console_output_character(&mut cells_written, start_loaction, cells_to_write);
|
||||
success = kernel::fill_console_output_character(&mut cells_written, start_loaction, cells_to_write, screen_manager);
|
||||
|
||||
if !success
|
||||
{
|
||||
@ -247,7 +251,7 @@ fn clear(
|
||||
|
||||
cells_written = 0;
|
||||
|
||||
success = kernel::fill_console_output_attribute(&mut cells_written, start_loaction, cells_to_write);
|
||||
success = kernel::fill_console_output_attribute(&mut cells_written, start_loaction, cells_to_write, screen_manager);
|
||||
|
||||
if !success {
|
||||
panic!("Couldnot reset attributes after cursor");
|
||||
|
Loading…
Reference in New Issue
Block a user