added blink functionality for cursor. Fixed alternate screen for windows not fully working

This commit is contained in:
TimonPost 2018-06-23 19:48:22 +02:00
parent 7e1879f80c
commit d714817539
16 changed files with 475 additions and 277 deletions

View File

@ -3,8 +3,21 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="310aeab2-4737-4e8e-b7eb-0aac10d104a3" name="Default" comment=""> <list default="true" id="310aeab2-4737-4e8e-b7eb-0aac10d104a3" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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)/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$/src/cursor/ansi_cursor.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/cursor/ansi_cursor.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/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/cursor/mod.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/kernel.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.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/state/state_manager.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/state/state_manager.rs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/manager/ansi_manager.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/manager/ansi_manager.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/shared/screen.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/shared/screen.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/terminal/ansi_terminal.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/terminal/ansi_terminal.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/terminal/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/terminal/mod.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> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
@ -15,34 +28,43 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="win_commands.rs" pinned="false" current-in-tab="false"> <file leaf-file-name="winapi_cursor.rs" pinned="false" current-in-tab="false">
<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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-535"> <state relative-caret-position="740">
<caret line="178" selection-start-line="178" selection-end-line="178" /> <caret line="64" selection-start-line="64" selection-end-line="64" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="kernel.rs" pinned="false" current-in-tab="false"> <file leaf-file-name="winapi_terminal.rs" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs"> <entry file="file://$PROJECT_DIR$/src/terminal/winapi_terminal.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="476"> <state relative-caret-position="689">
<caret line="28" column="40" lean-forward="true" selection-start-line="28" selection-start-column="40" selection-end-line="28" selection-end-column="40" /> <caret line="143" column="5" selection-start-line="143" selection-start-column="5" selection-end-line="143" selection-end-column="5" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="mod.rs" pinned="false" current-in-tab="false"> <file leaf-file-name="ansi_terminal.rs" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/mod.rs"> <entry file="file://$PROJECT_DIR$/src/terminal/ansi_terminal.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="442"> <state relative-caret-position="587">
<caret line="28" column="7" selection-start-line="28" selection-start-column="7" selection-end-line="28" selection-end-column="7" /> <caret line="65" column="25" lean-forward="true" selection-start-line="65" selection-start-column="25" selection-end-line="65" selection-end-column="25" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="traits.rs" pinned="false" current-in-tab="true"> <file leaf-file-name="macros.rs" pinned="false" current-in-tab="false">
<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>
</file>
<file leaf-file-name="traits.rs" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/shared/traits.rs"> <entry file="file://$PROJECT_DIR$/src/shared/traits.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state> <state>
@ -51,38 +73,47 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="Cargo.toml" pinned="false" current-in-tab="false"> <file leaf-file-name="bin.rs" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Cargo.toml"> <entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272"> <state relative-caret-position="714">
<caret line="16" column="84" lean-forward="true" selection-start-line="16" selection-start-column="84" selection-end-line="16" selection-end-column="84" /> <caret line="42" column="12" selection-start-line="42" selection-start-column="12" selection-end-line="42" selection-end-column="12" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="state_manager.rs" pinned="false" current-in-tab="false"> <file leaf-file-name="terminal.rs" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/state/state_manager.rs"> <entry file="file://$PROJECT_DIR$/src/terminal/terminal.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="680"> <state relative-caret-position="281">
<caret line="46" column="22" selection-start-line="46" selection-start-column="22" selection-end-line="46" selection-end-column="22" /> <caret line="189" selection-start-line="189" selection-end-line="189" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="unix_command.rs" pinned="false" current-in-tab="false"> <file leaf-file-name="mod.rs" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/state/commands/unix_command.rs"> <entry file="file://$PROJECT_DIR$/src/terminal/mod.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51"> <state relative-caret-position="757">
<caret line="3" column="18" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" /> <caret line="51" column="39" selection-start-line="51" selection-start-column="39" selection-end-line="51" selection-end-column="39" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="context.rs" pinned="false" current-in-tab="false"> <file leaf-file-name="screen.rs" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/state/context.rs"> <entry file="file://$PROJECT_DIR$/src/shared/screen.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102"> <state relative-caret-position="510">
<caret line="7" column="18" selection-start-line="7" selection-start-column="11" selection-end-line="7" selection-end-column="18" /> <caret line="36" selection-start-line="36" selection-end-line="36" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ansi_cursor.rs" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/cursor/ansi_cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="731">
<caret line="92" selection-start-line="92" selection-end-line="92" />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -120,7 +151,6 @@
<find>&amp;context</find> <find>&amp;context</find>
<find>cursor</find> <find>cursor</find>
<find>context</find> <find>context</find>
<find>data</find>
<find>Mutex</find> <find>Mutex</find>
<find>WriteConsoleOutputW</find> <find>WriteConsoleOutputW</find>
<find>CONSOLE_CURSOR_INFO</find> <find>CONSOLE_CURSOR_INFO</find>
@ -128,6 +158,7 @@
<find>Borrow</find> <find>Borrow</find>
<find>fmt</find> <find>fmt</find>
<find>STD_OUTPUT_HANDLE</find> <find>STD_OUTPUT_HANDLE</find>
<find>data</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>crossterm_cursor</replace> <replace>crossterm_cursor</replace>
@ -170,38 +201,38 @@
<option value="$PROJECT_DIR$/src/state/commands/unix_command.rs" /> <option value="$PROJECT_DIR$/src/state/commands/unix_command.rs" />
<option value="$PROJECT_DIR$/src/state/commands/shared_commands.rs" /> <option value="$PROJECT_DIR$/src/state/commands/shared_commands.rs" />
<option value="$PROJECT_DIR$/src/lib.rs" /> <option value="$PROJECT_DIR$/src/lib.rs" />
<option value="$PROJECT_DIR$/src/terminal/mod.rs" />
<option value="$PROJECT_DIR$/src/style/color/color.rs" /> <option value="$PROJECT_DIR$/src/style/color/color.rs" />
<option value="$PROJECT_DIR$/src/cursor/ansi_cursor.rs" />
<option value="$PROJECT_DIR$/src/shared/functions.rs" /> <option value="$PROJECT_DIR$/src/shared/functions.rs" />
<option value="$PROJECT_DIR$/src/terminal/winapi_terminal.rs" />
<option value="$PROJECT_DIR$/src/terminal/terminal.rs" />
<option value="$PROJECT_DIR$/src/cursor/cursor.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)/color/mod.rs" /> <option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs" />
<option value="$PROJECT_DIR$/src/shared/raw.rs" /> <option value="$PROJECT_DIR$/src/shared/raw.rs" />
<option value="$PROJECT_DIR$/src/state/command_manager.rs" /> <option value="$PROJECT_DIR$/src/state/command_manager.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/alternate_screen.rs" />
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/raw_mode.rs" /> <option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/raw_mode.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)/terminal/terminal.rs" />
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs" />
<option value="$PROJECT_DIR$/src/manager/mod.rs" /> <option value="$PROJECT_DIR$/src/manager/mod.rs" />
<option value="$PROJECT_DIR$/src/manager/ansi_manager.rs" />
<option value="$PROJECT_DIR$/src/manager/manager.rs" />
<option value="$PROJECT_DIR$/src/manager/win_manager.rs" /> <option value="$PROJECT_DIR$/src/manager/win_manager.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/cursor.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/kernel/windows_kernel/ansi_support.rs" />
<option value="$PROJECT_DIR$/src/state/commands/win_commands.rs" />
<option value="$PROJECT_DIR$/src/state/commands/mod.rs" /> <option value="$PROJECT_DIR$/src/state/commands/mod.rs" />
<option value="$PROJECT_DIR$/src/state/context.rs" /> <option value="$PROJECT_DIR$/src/state/context.rs" />
<option value="$PROJECT_DIR$/src/cursor/winapi_cursor.rs" />
<option value="$PROJECT_DIR$/src/cursor/mod.rs" />
<option value="$PROJECT_DIR$/src/style/styles/objectstyle.rs" /> <option value="$PROJECT_DIR$/src/style/styles/objectstyle.rs" />
<option value="$PROJECT_DIR$/src/style/styles/styledobject.rs" /> <option value="$PROJECT_DIR$/src/style/styles/styledobject.rs" />
<option value="$PROJECT_DIR$/src/terminal/ansi_terminal.rs" />
<option value="$PROJECT_DIR$/src/shared/screen.rs" />
<option value="$PROJECT_DIR$/src/state/state_manager.rs" /> <option value="$PROJECT_DIR$/src/state/state_manager.rs" />
<option value="$PROJECT_DIR$/src/state/commands/win_commands.rs" />
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/cursor/mod.rs" />
<option value="$PROJECT_DIR$/src/manager/ansi_manager.rs" />
<option value="$PROJECT_DIR$/src/cursor/ansi_cursor.rs" />
<option value="$PROJECT_DIR$/src/cursor/mod.rs" />
<option value="$PROJECT_DIR$/src/manager/manager.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" /> <option value="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" />
<option value="$PROJECT_DIR$/src/cursor/winapi_cursor.rs" />
<option value="$PROJECT_DIR$/src/cursor/cursor.rs" />
<option value="$PROJECT_DIR$/src/shared/screen.rs" />
<option value="$PROJECT_DIR$/src/terminal/mod.rs" />
<option value="$PROJECT_DIR$/src/terminal/winapi_terminal.rs" />
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs" />
<option value="$PROJECT_DIR$/src/terminal/terminal.rs" />
<option value="$PROJECT_DIR$/src/terminal/ansi_terminal.rs" />
</list> </list>
</option> </option>
</component> </component>
@ -215,7 +246,7 @@
<packageJsonPaths /> <packageJsonPaths />
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-2568" /> <option name="x" value="-8" />
<option name="y" value="-8" /> <option name="y" value="-8" />
<option name="width" value="2576" /> <option name="width" value="2576" />
<option name="height" value="1056" /> <option name="height" value="1056" />
@ -558,15 +589,16 @@
<workItem from="1529421240749" duration="9819000" /> <workItem from="1529421240749" duration="9819000" />
<workItem from="1529512712024" duration="10322000" /> <workItem from="1529512712024" duration="10322000" />
<workItem from="1529599006635" duration="10804000" /> <workItem from="1529599006635" duration="10804000" />
<workItem from="1529689699529" duration="4979000" /> <workItem from="1529689699529" duration="6745000" />
<workItem from="1529741655974" duration="14906000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="592599000" /> <option name="totallyTimeSpent" value="609271000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-2568" y="-8" width="2576" height="1056" extended-state="6" /> <frame x="-8" y="-8" width="2576" height="1056" extended-state="6" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info anchor="right" id="Palette" order="3" /> <window_info anchor="right" id="Palette" order="3" />
@ -602,14 +634,14 @@
<window_info anchor="right" id="Palette" order="3" /> <window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Capture Analysis" order="8" /> <window_info anchor="right" id="Capture Analysis" order="8" />
<window_info anchor="bottom" id="Run" order="2" /> <window_info anchor="bottom" id="Version Control" order="8" />
<window_info anchor="right" id="Cargo" order="4" /> <window_info anchor="right" id="Cargo" order="4" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.1140625" /> <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.1140625" />
<window_info id="Structure" order="1" weight="0.25" /> <window_info id="Structure" order="1" weight="0.25" />
<window_info anchor="right" id="Commander" order="0" weight="0.4" /> <window_info anchor="right" id="Commander" order="0" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="bottom" id="TODO" order="6" /> <window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="8" /> <window_info anchor="bottom" id="Run" order="2" />
<window_info id="Image Layers" order="5" /> <window_info id="Image Layers" order="5" />
<window_info id="Designer" order="3" /> <window_info id="Designer" order="3" />
<window_info id="UI Designer" order="4" /> <window_info id="UI Designer" order="4" />
@ -635,14 +667,6 @@
<option name="myLimit" value="2678400000" /> <option name="myLimit" value="2678400000" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/style/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1258">
<caret line="49" column="4" selection-start-line="49" selection-start-column="4" selection-end-line="49" selection-end-column="4" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/drop.rs" />
<entry file="file://$PROJECT_DIR$/src/style/color/winapi_color.rs"> <entry file="file://$PROJECT_DIR$/src/style/color/winapi_color.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="374"> <state relative-caret-position="374">
@ -710,13 +734,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/terminal/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="782">
<caret line="46" column="54" selection-start-line="46" selection-start-column="54" selection-end-line="46" selection-end-column="54" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/style/color/color.rs"> <entry file="file://$PROJECT_DIR$/src/style/color/color.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="551"> <state relative-caret-position="551">
@ -724,34 +741,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/cursor/ansi_cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="31" column="34" selection-start-line="31" selection-start-column="34" selection-end-line="31" selection-end-column="34" />
</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="425">
<caret line="25" column="45" selection-start-line="25" selection-start-column="45" selection-end-line="25" selection-end-column="45" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/terminal/terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="187" column="5" selection-start-line="187" selection-start-column="5" selection-end-line="187" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/cursor/cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="476">
<caret line="246" column="9" selection-start-line="246" selection-start-column="9" selection-end-line="246" selection-end-column="9" />
</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$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/mod.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34"> <state relative-caret-position="34">
@ -759,17 +748,14 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/cursor/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-108">
<caret line="106" column="43" selection-start-line="106" selection-start-column="43" selection-end-line="106" selection-end-column="43" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/shared/raw.rs"> <entry file="file://$PROJECT_DIR$/src/shared/raw.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51"> <state relative-caret-position="51">
<caret line="53" column="61" selection-start-line="53" selection-start-column="61" selection-end-line="53" selection-end-column="61" /> <caret line="53" column="61" selection-start-line="53" selection-start-column="61" selection-end-line="53" selection-end-column="61" />
<folding>
<element signature="e#2623#2624#0" expanded="true" />
<element signature="e#2705#2706#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -787,13 +773,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="149" selection-start-line="149" selection-end-line="149" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/raw_mode.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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="466"> <state relative-caret-position="466">
@ -801,20 +780,6 @@
</state> </state>
</provider> </provider>
</entry> </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="119">
<caret line="37" column="47" selection-start-line="37" selection-start-column="47" selection-end-line="37" selection-end-column="47" />
</state>
</provider>
</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="578">
<caret line="36" column="10" selection-start-line="36" selection-start-column="10" selection-end-line="36" selection-end-column="10" />
</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$/.rustup/toolchains/nightly-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/liballoc/boxed.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1564"> <state relative-caret-position="1564">
@ -826,13 +791,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/manager/ansi_manager.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="697">
<caret line="48" column="33" selection-start-line="48" selection-start-column="33" selection-end-line="48" selection-end-column="33" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/manager/mod.rs"> <entry file="file://$PROJECT_DIR$/src/manager/mod.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="527"> <state relative-caret-position="527">
@ -840,20 +798,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/manager/manager.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="544">
<caret line="32" column="5" selection-start-line="32" selection-start-column="5" selection-end-line="32" selection-end-column="5" />
</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="561">
<caret line="36" column="38" selection-start-line="36" selection-start-column="38" selection-end-line="36" selection-end-column="38" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.5/src/um/winnt.rs"> <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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="738"> <state relative-caret-position="738">
@ -868,6 +812,69 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<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/style/styles/styledobject.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
</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$/src/state/state_manager.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="731">
<caret line="46" column="22" selection-start-line="46" selection-start-column="22" selection-end-line="46" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/state/commands/unix_command.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" column="18" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Cargo.toml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="16" column="84" selection-start-line="16" selection-start-column="84" selection-end-line="16" selection-end-column="84" />
</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://$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs"> <entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34"> <state relative-caret-position="34">
@ -875,6 +882,73 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/manager/ansi_manager.rs">
<provider selected="true" editor-type-id="text-editor">
<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://$USER_HOME$/.rustup/toolchains/nightly-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/libcore/time.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="305">
<caret line="109" column="17" selection-start-line="109" selection-start-column="17" selection-end-line="109" selection-end-column="17" />
<folding>
<element signature="e#3609#3610#0" expanded="true" />
<element signature="e#3657#3658#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<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$/examples/Crossterm 0.2.2 - New Version (Not finished)/cursor/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="576">
<caret line="136" column="33" selection-start-line="136" selection-start-column="33" selection-end-line="136" selection-end-column="33" />
</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="119">
<caret line="37" column="47" selection-start-line="37" selection-start-column="47" selection-end-line="37" selection-end-column="47" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1513">
<caret line="149" selection-start-line="149" selection-end-line="149" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/manager/manager.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="30" column="65" selection-start-line="30" selection-start-column="65" selection-end-line="30" selection-end-column="65" />
</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="321">
<caret line="192" column="29" selection-start-line="192" selection-start-column="29" selection-end-line="192" selection-end-column="29" />
</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="399">
<caret line="139" column="17" selection-start-line="139" selection-start-column="17" selection-end-line="139" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs"> <entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34"> <state relative-caret-position="34">
@ -888,116 +962,45 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/state/commands/mod.rs"> <entry file="file://$PROJECT_DIR$/src/manager/win_manager.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493"> <state relative-caret-position="451">
<caret line="29" column="108" selection-start-line="29" selection-start-column="108" selection-end-line="29" selection-end-column="108" /> <caret line="36" column="38" selection-start-line="36" selection-start-column="38" selection-end-line="36" selection-end-column="38" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/cursor/cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-510">
<caret line="21" column="56" selection-start-line="21" selection-start-column="56" selection-end-line="21" selection-end-column="56" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/cursor/ansi_cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="731">
<caret line="92" selection-start-line="92" selection-end-line="92" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/cursor/winapi_cursor.rs"> <entry file="file://$PROJECT_DIR$/src/cursor/winapi_cursor.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153"> <state relative-caret-position="740">
<caret line="9" column="19" lean-forward="true" selection-start-line="9" selection-start-column="19" selection-end-line="9" selection-end-column="19" /> <caret line="64" selection-start-line="64" selection-end-line="64" />
<folding>
<element signature="e#650#651#0" expanded="true" />
<element signature="e#721#722#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/cursor/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="19" selection-start-line="19" selection-end-line="19" />
</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" />
<folding>
<element signature="e#1746#1747#0" expanded="true" />
<element signature="e#1783#1784#0" expanded="true" />
</folding>
</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="51">
<caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
</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="85">
<caret line="5" column="38" selection-start-line="5" selection-start-column="38" selection-end-line="5" selection-end-column="38" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/shared/screen.rs"> <entry file="file://$PROJECT_DIR$/src/shared/screen.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34"> <state relative-caret-position="510">
<caret line="2" selection-start-line="2" selection-end-line="2" selection-end-column="12" /> <caret line="36" selection-start-line="36" selection-end-line="36" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/shared/mod.rs"> <entry file="file://$PROJECT_DIR$/src/terminal/mod.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68"> <state relative-caret-position="757">
<caret line="4" column="15" lean-forward="true" selection-start-line="4" selection-start-column="15" selection-end-line="4" selection-end-column="15" /> <caret line="51" column="39" selection-start-line="51" selection-start-column="39" selection-end-line="51" selection-end-column="39" />
</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="-535">
<caret line="178" selection-start-line="178" selection-end-line="178" />
</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="680">
<caret line="46" column="22" selection-start-line="46" selection-start-column="22" selection-end-line="46" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/state/commands/unix_command.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" column="18" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Cargo.toml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="16" column="84" lean-forward="true" selection-start-line="16" selection-start-column="84" selection-end-line="16" selection-end-column="84" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/state/context.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102">
<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/kernel.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="476">
<caret line="28" column="40" lean-forward="true" selection-start-line="28" selection-start-column="40" selection-end-line="28" selection-end-column="40" />
</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> </state>
</provider> </provider>
</entry> </entry>
@ -1008,6 +1011,41 @@
</state> </state>
</provider> </provider>
</entry> </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="714">
<caret line="42" column="12" selection-start-line="42" selection-start-column="12" selection-end-line="42" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/terminal/terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="281">
<caret line="189" selection-start-line="189" selection-end-line="189" />
</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="689">
<caret line="143" column="5" selection-start-line="143" selection-start-column="5" selection-end-line="143" selection-end-column="5" />
</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/terminal/ansi_terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="587">
<caret line="65" column="25" lean-forward="true" selection-start-line="65" selection-start-column="25" selection-end-line="65" selection-end-column="25" />
</state>
</provider>
</entry>
</component> </component>
<component name="masterDetails"> <component name="masterDetails">
<states> <states>

View File

@ -30,10 +30,15 @@ use std::io::Write;
use std::{time, thread}; use std::{time, thread};
fn main() { fn main() {
// alternate_screen::switch_between_main_and_alternate_screen(); //// alternate_screen::switch_between_main_and_alternate_screen();
let context = Context::new(); let context = Context::new();
let mut scre = screen::AlternateScreen::from(context.clone()); // let mut scre = screen::AlternateScreen::from(context.clone());
write!(scre, "asdf"); // write!(scre, "asdf");
scre.flush(); // scre.flush();
thread::sleep(time::Duration::from_secs(3)); // thread::sleep(time::Duration::from_secs(3));
use crossterm::terminal::terminal;
let curs = terminal(context.clone());
curs.set_title(String::from("Test"));
} }

View File

@ -122,6 +122,24 @@ pub fn safe_and_reset_position()
println!() println!()
} }
/// Hide cursor display | demonstration.
pub fn hide_cursor()
{
let context = Context::new();
let cursor = cursor(context.clone());
cursor.hide();
}
/// Show cursor display | demonstration.
pub fn show_cursor()
{
let context = Context::new();
let cursor = cursor(context.clone());
cursor.show();
}

View File

@ -19,12 +19,11 @@ impl AnsiCursor {
} }
impl ITerminalCursor for AnsiCursor { impl ITerminalCursor for AnsiCursor {
fn goto(&self, x: u16, y: u16) fn goto(&self, x: u16, y: u16)
{ {
let mut screen = self.context.screen_manager.lock().unwrap(); let mut screen = self.context.screen_manager.lock().unwrap();
{ {
screen.write_ansi(format!(csi!("{};{}H"), y + 1, x +1)); screen.write_ansi(format!(csi!("{};{}H"), y + 1, x + 1));
} }
} }
@ -91,4 +90,18 @@ impl ITerminalCursor for AnsiCursor {
screen.write_ansi_str(csi!("?25h")); screen.write_ansi_str(csi!("?25h"));
} }
} }
fn blink(&self, blink: bool)
{
let mut screen = self.context.screen_manager.lock().unwrap();
{
if blink
{
screen.write_ansi_str(csi!("?12h"));
}
else {
screen.write_ansi_str(csi!("?12l"));
}
}
}
} }

View File

@ -26,7 +26,7 @@ impl TerminalCursor
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
let cursor = Some(AnsiCursor::new(context.clone()) as Box<ITerminalCursor>); let cursor = Some(AnsiCursor::new(context.clone()) as Box<ITerminalCursor>);
TerminalCursor { terminal_cursor: cursor , context} TerminalCursor { terminal_cursor: Some(WinApiCursor::new()), context}
} }
/// Goto some position (x,y) in the terminal. /// Goto some position (x,y) in the terminal.
@ -105,7 +105,7 @@ impl TerminalCursor
/// // Move the cursor to position 3 times to the up in the terminal /// // Move the cursor to position 3 times to the up in the terminal
/// cursor.move_up(3); /// cursor.move_up(3);
/// } /// }
/// ///
/// ``` /// ```
pub fn move_up(&mut self, count: u16) -> &mut TerminalCursor { pub fn move_up(&mut self, count: u16) -> &mut TerminalCursor {
if let Some(ref terminal_cursor) = self.terminal_cursor { if let Some(ref terminal_cursor) = self.terminal_cursor {
@ -293,6 +293,73 @@ impl TerminalCursor
terminal_cursor.reset_position(); terminal_cursor.reset_position();
} }
} }
/// Hide de cursor in the console.
///
/// #Example
///
/// ```rust
///
/// extern crate crossterm;
/// use self::crossterm::cursor::cursor;
/// use self::crossterm::Context;
///
/// let context = Context::new();
/// cursor(&context).hide();
///
/// ```
pub fn hide(&self)
{
if let Some(ref terminal_cursor) = self.terminal_cursor {
terminal_cursor.hide();
}
}
/// Show the cursor in the console.
///
/// #Example
///
/// ```rust
///
/// extern crate crossterm;
/// use self::crossterm::cursor::cursor;
/// use self::crossterm::Context;
///
/// let context = Context::new();
/// cursor(&context).show();
///
/// ```
pub fn show(&self)
{
if let Some(ref terminal_cursor) = self.terminal_cursor {
terminal_cursor.show();
}
}
/// Enable or disable blinking of the terminal.
///
/// Note that this only works on windows 10 and unix systems. If you are working on windows 10 or lower this won't work.
///
/// #Example
///
/// ```rust
///
/// extern crate crossterm;
/// use self::crossterm::cursor::cursor;
/// use self::crossterm::Context;
///
/// let context = Context::new();
/// let cursor = cursor(&context);
/// cursor.blink(true);
/// cursor.blink(false);
///
/// ```
pub fn blink(&self, blink: bool)
{
if let Some(ref terminal_cursor) = self.terminal_cursor {
terminal_cursor.blink(blink);
}
}
} }
/// Get an TerminalCursor implementation whereon cursor related actions can be performed. /// Get an TerminalCursor implementation whereon cursor related actions can be performed.
@ -312,7 +379,12 @@ impl TerminalCursor
/// // Get cursor and goto pos X: 5, Y: 10 /// // Get cursor and goto pos X: 5, Y: 10
/// let mut cursor = cursor::cursor(&context); /// let mut cursor = cursor::cursor(&context);
/// cursor.goto(5,10); /// cursor.goto(5,10);
/// ///
/// cursor.show();
/// cursor.hide();
/// cursor.blink();
/// cursor.move_left(2);
///
/// //Or you can do it in one line. /// //Or you can do it in one line.
/// cursor::cursor(&context).goto(5,10); /// cursor::cursor(&context).goto(5,10);
/// ///

View File

@ -51,4 +51,6 @@ pub trait ITerminalCursor {
fn hide(&self); fn hide(&self);
/// Show the terminal cursor /// Show the terminal cursor
fn show(&self); fn show(&self);
/// enable or disable the blinking of the cursor.
fn blink(&self, blink: bool);
} }

View File

@ -62,4 +62,9 @@ impl ITerminalCursor for WinApiCursor {
{ {
kernel::cursor_visibility(true); kernel::cursor_visibility(true);
} }
fn blink(&self, blink: bool)
{
}
} }

View File

@ -134,11 +134,11 @@ pub fn set_console_cursor_position(x: i16, y: i16)
pub fn cursor_visibility(visable: bool) pub fn cursor_visibility(visable: bool)
{ {
let handle = get_output_handle(); let handle = get_output_handle();
let cursor_info = CONSOLE_CURSOR_INFO let cursor_info = CONSOLE_CURSOR_INFO
{ {
dwSize: 100,
bVisible: if visable { FALSE } else {TRUE} dwSize: 1,
bVisible: if visable { TRUE } else {FALSE}
}; };
unsafe unsafe
@ -299,17 +299,37 @@ pub fn write_console_output(write_buffer: &HANDLE, copy_buffer: &mut [CHAR_INFO;
pub fn write_char_buffer(handle: HANDLE, buf: &[u8]) pub fn write_char_buffer(handle: HANDLE, buf: &[u8])
{ {
use std::ffi::CString; use std::ffi::{ NulError, CString };
use std::str; 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(_) => "",
};
let utf16_bytes: Vec<u16> = utf8.encode_utf16().collect();
let 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;
// get buffer info // get buffer info
let csbi = get_console_screen_buffer_info(); let csbi = get_console_screen_buffer_info();
// get string from u8[] and parse it to an c_str
let mut data = str::from_utf8(buf).unwrap();
let c_str = CString::new(data).unwrap();
let ptr: *const u16 = c_str.as_ptr() as *const u16;
panic!("{:?}", ptr);
// get current position // get current position
let current_pos = COORD {X: csbi.dwCursorPosition.X, Y: csbi.dwCursorPosition.Y}; let current_pos = COORD {X: csbi.dwCursorPosition.X, Y: csbi.dwCursorPosition.Y};
@ -318,9 +338,16 @@ pub fn write_char_buffer(handle: HANDLE, buf: &[u8])
// write to console // write to console
unsafe unsafe
{ {
WriteConsoleOutputCharacterA(handle, ptr, str_length, current_pos, &mut cells_written);
WriteConsoleOutputAttribute(handle, ptr, data.len() as u32, current_pos, &mut cells_written);
} }
// 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 /// Parse integer to an bool

View File

@ -15,12 +15,6 @@ pub struct AnsiScreenManager
impl IScreenManager for AnsiScreenManager impl IScreenManager for AnsiScreenManager
{ {
// fn stdout(&mut self) -> &mut Self::Output
// {
// return &mut self.output
// }
fn toggle_is_alternate_screen(&mut self, is_alternate_screen: bool) fn toggle_is_alternate_screen(&mut self, is_alternate_screen: bool)
{ {
self.is_alternate_screen = is_alternate_screen; self.is_alternate_screen = is_alternate_screen;

View File

@ -20,15 +20,15 @@ impl ScreenManager
{ {
/// Create new screen manager instance whereon screen related actions can be performed. /// Create new screen manager instance whereon screen related actions can be performed.
pub fn new() -> ScreenManager { pub fn new() -> ScreenManager {
// #[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
// let screen_manager = functions::get_module::<Box<IScreenManager>>(Box::from(WinApiScreenManager::new()), Box::from(AnsiScreenManager::new())).unwrap(); let screen_manager = functions::get_module::<Box<IScreenManager>>(Box::from(WinApiScreenManager::new()), Box::from(AnsiScreenManager::new())).unwrap();
//
// #[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
// let screen_manager = Box::new(AnsiScreenManager::new()); let screen_manager = Box::new(AnsiScreenManager::new());
ScreenManager ScreenManager
{ {
screen_manager: Box::from(WinApiScreenManager::new()), screen_manager: Box::from(WinApiScreenManager::new())
} }
} }

View File

@ -1,4 +1,9 @@
//! This module contains all the logic for switching between alternate screen and main screen. //! This module contains all the logic for switching between alternate screen and main screen.
//!
//! *Nix style applications often utilize an alternate screen buffer, so that they can modify the entire contents of the buffer, without affecting the application that started them.
//! 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.
use Context; use Context;
use state::commands::*; use state::commands::*;

View File

@ -174,14 +174,8 @@ impl IStateCommand for ToAlternateScreenBufferCommand
{ {
fn execute(&mut self) -> bool fn execute(&mut self) -> bool
{ {
use super::super::super::kernel::windows_kernel::ansi_support;
use super::super::super::manager::WinApiScreenManager; use super::super::super::manager::WinApiScreenManager;
let does_support = ansi_support::try_enable_ansi_support();
let mut screen_manager = self.context.screen_manager.lock().unwrap();
screen_manager.toggle_is_alternate_screen(true);
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(); let handle = kernel::get_output_handle();
@ -192,6 +186,9 @@ impl IStateCommand for ToAlternateScreenBufferCommand
// Make the new screen buffer the active screen buffer. // Make the new screen buffer the active screen buffer.
kernel::set_active_screen_buffer(new_handle); kernel::set_active_screen_buffer(new_handle);
let mut screen_manager = self.context.screen_manager.lock().unwrap();
screen_manager.toggle_is_alternate_screen(true);
let b: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() { let b: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
Some(b) => { b }, Some(b) => { b },
None => panic!("&a isn't a B!") None => panic!("&a isn't a B!")

View File

@ -66,4 +66,12 @@ impl ITerminal for AnsiTerminal {
screen.write_ansi(format!(csi!("8;{};{}t"), width, height)); screen.write_ansi(format!(csi!("8;{};{}t"), width, height));
} }
} }
fn set_title(&self, title: String)
{
let mut screen = self.context.screen_manager.lock().unwrap();
{
screen.write_ansi_str("\x1b]2;New terminal titleBEL");
}
}
} }

View File

@ -48,4 +48,6 @@ pub trait ITerminal {
fn scroll_down(&self, count: i16); fn scroll_down(&self, count: i16);
/// Resize terminal to the given width and height. /// Resize terminal to the given width and height.
fn set_size(&self,width: i16, height: i16); fn set_size(&self,width: i16, height: i16);
/// Set the terminal title.
fn set_title(&self, title: String);
} }

View File

@ -186,6 +186,13 @@ impl Terminal {
{ {
style::ObjectStyle::new().apply_to(val, self.context.clone()) style::ObjectStyle::new().apply_to(val, self.context.clone())
} }
pub fn set_title(&self, title: String)
{
if let Some (ref terminal) = self.terminal {
terminal.set_title(title );
}
}
} }
/// Get an Terminal implementation whereon terminal related actions can be performed. /// Get an Terminal implementation whereon terminal related actions can be performed.

View File

@ -137,6 +137,11 @@ impl ITerminal for WinApiTerminal {
} }
} }
} }
fn set_title(&self, title: String)
{
}
} }
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>) {