Merge pull request #2 from TimonPost/dev

Dev merge confirm
This commit is contained in:
Timon 2018-01-27 19:00:45 +01:00 committed by GitHub
commit 7a925c8d50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 1095 additions and 709 deletions

View File

@ -3,25 +3,11 @@
<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" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change beforePath="$PROJECT_DIR$/Cargo.toml" afterPath="$PROJECT_DIR$/Cargo.toml" /> <change beforePath="$PROJECT_DIR$/src/crossterm_style/mod.rs" afterPath="$PROJECT_DIR$/src/crossterm_style/mod.rs" />
<change beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" /> <change beforePath="$PROJECT_DIR$/src/crossterm_style/styles/objectstyle.rs" afterPath="$PROJECT_DIR$/src/crossterm_style/styles/objectstyle.rs" />
<change beforePath="$PROJECT_DIR$/examples/bin.rs" afterPath="$PROJECT_DIR$/examples/bin.rs" /> <change beforePath="$PROJECT_DIR$/src/crossterm_style/styles/styledobject.rs" afterPath="$PROJECT_DIR$/src/crossterm_style/styles/styledobject.rs" />
<change beforePath="$PROJECT_DIR$/examples/terminal/mod.rs" afterPath="$PROJECT_DIR$/examples/terminal/mod.rs" />
<change beforePath="$PROJECT_DIR$/src/crossterm_cursor/cursor.rs" afterPath="$PROJECT_DIR$/src/crossterm_cursor/cursor.rs" />
<change beforePath="$PROJECT_DIR$/src/crossterm_cursor/winapi_cursor.rs" afterPath="$PROJECT_DIR$/src/crossterm_cursor/winapi_cursor.rs" />
<change beforePath="$PROJECT_DIR$/src/crossterm_style/color/base_color.rs" afterPath="$PROJECT_DIR$/src/crossterm_style/color/base_color.rs" />
<change beforePath="$PROJECT_DIR$/src/crossterm_style/color/winapi_color.rs" afterPath="$PROJECT_DIR$/src/crossterm_style/color/winapi_color.rs" />
<change beforePath="$PROJECT_DIR$/src/crossterm_terminal/winapi_terminal.rs" afterPath="$PROJECT_DIR$/src/crossterm_terminal/winapi_terminal.rs" />
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs" />
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/color.rs" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/color.rs" /> <change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/color.rs" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/color.rs" />
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs" />
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/handle.rs" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/handle.rs" />
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" /> <change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" />
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/terminal.rs" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/terminal.rs" />
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/winapi_extentions.rs" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/winapi_extentions.rs" />
<change beforePath="$PROJECT_DIR$/src/lib.rs" afterPath="$PROJECT_DIR$/src/lib.rs" />
<change beforePath="$PROJECT_DIR$/src/shared/enums.rs" afterPath="" />
<change beforePath="$PROJECT_DIR$/src/shared/mod.rs" afterPath="$PROJECT_DIR$/src/shared/mod.rs" />
</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" />
@ -32,49 +18,16 @@
</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="bin.rs" pinned="false" current-in-tab="false"> <file leaf-file-name="Cargo.toml" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/examples/bin.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="11" lean-forward="false" selection-start-line="12" selection-start-column="11" selection-end-line="12" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Cargo.lock" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Cargo.lock">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Cargo.toml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Cargo.toml"> <entry file="file://$PROJECT_DIR$/Cargo.toml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170"> <state relative-caret-position="255">
<caret line="10" column="12" lean-forward="false" selection-start-line="10" selection-start-column="12" selection-end-line="10" selection-end-column="12" /> <caret line="15" column="33" lean-forward="true" selection-start-line="15" selection-start-column="33" selection-end-line="15" selection-end-column="33" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="README.md" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="195">
<caret line="86" column="14" lean-forward="false" selection-start-line="86" selection-start-column="14" selection-end-line="86" selection-end-column="14" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</file>
</leaf> </leaf>
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
@ -85,10 +38,27 @@
<find>winapi</find> <find>winapi</find>
<find>kernel32</find> <find>kernel32</find>
<find>HANDLE</find> <find>HANDLE</find>
<find>CONSOLE_SCREEN_BUFFER_INFO</find>
<find>handleapi</find> <find>handleapi</find>
<find>terminal_cursor</find> <find>terminal_cursor</find>
<find>terminal</find> <find>terminal</find>
<find>r</find>
<find>short</find>
<find>console_mode</find>
<find>set</find>
<find>fsr_window</find>
<find>resizeBuffer</find>
<find>set_console_text_attribute</find>
<find>set(</find>
<find>kern</find>
<find>pos</find>
<find>csbi</find>
<find>kernel</find>
<find>success</find>
<find>count</find>
<find>xpos</find>
<find>handle::</find>
<find>wincon</find>
<find>CONSOLE_SCREEN_BUFFER_INFO</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>crossterm_cursor</replace> <replace>crossterm_cursor</replace>
@ -105,25 +75,40 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/src/crossterm_style/color/winapi_color.rs" />
<option value="$PROJECT_DIR$/src/crossterm_terminal/winapi_terminal.rs" />
<option value="$PROJECT_DIR$/src/crossterm_style/color/base_color.rs" />
<option value="$PROJECT_DIR$/src/shared/enums.rs" /> <option value="$PROJECT_DIR$/src/shared/enums.rs" />
<option value="$PROJECT_DIR$/src/shared/mod.rs" /> <option value="$PROJECT_DIR$/src/shared/mod.rs" />
<option value="$PROJECT_DIR$/src/crossterm_cursor/winapi_cursor.rs" />
<option value="$PROJECT_DIR$/src/crossterm_cursor/cursor.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/winapi_extentions.rs" /> <option value="$PROJECT_DIR$/src/kernel/windows_kernel/winapi_extentions.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/color.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs" />
<option value="$PROJECT_DIR$/src/lib.rs" /> <option value="$PROJECT_DIR$/src/lib.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/handle.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/terminal.rs" />
<option value="$PROJECT_DIR$/examples/terminal/mod.rs" />
<option value="$PROJECT_DIR$/Cargo.toml" />
<option value="$PROJECT_DIR$/README.md" /> <option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/src/shared/traits.rs" />
<option value="$PROJECT_DIR$/src/crossterm_cursor/ansi_cursor.rs" />
<option value="$PROJECT_DIR$/examples/cursor/mod.rs" />
<option value="$PROJECT_DIR$/Cargo.toml" />
<option value="$PROJECT_DIR$/src/crossterm_cursor/base_cursor.rs" />
<option value="$PROJECT_DIR$/src/crossterm_cursor/cursor.rs" />
<option value="$PROJECT_DIR$/src/crossterm_terminal/ansi_terminal.rs" />
<option value="$PROJECT_DIR$/todo.txt" />
<option value="$PROJECT_DIR$/src/crossterm_terminal/terminal.rs" />
<option value="$PROJECT_DIR$/src/crossterm_terminal/base_terminal.rs" />
<option value="$PROJECT_DIR$/src/crossterm_terminal/winapi_terminal.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/ansi_support.rs" />
<option value="$PROJECT_DIR$/src/crossterm_cursor/winapi_cursor.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/functions.rs" />
<option value="$PROJECT_DIR$/examples/color/mod.rs" />
<option value="$PROJECT_DIR$/examples/terminal/mod.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs" />
<option value="$PROJECT_DIR$/examples/bin.rs" /> <option value="$PROJECT_DIR$/examples/bin.rs" />
<option value="$PROJECT_DIR$/src/crossterm_style/color/color.rs" />
<option value="$PROJECT_DIR$/src/crossterm_style/color/base_color.rs" />
<option value="$PROJECT_DIR$/src/crossterm_style/color/winapi_color.rs" />
<option value="$PROJECT_DIR$/src/crossterm_style/mod.rs" />
<option value="$PROJECT_DIR$/src/crossterm_style/styles/styledobject.rs" />
<option value="$PROJECT_DIR$/src/crossterm_style/styles/objectstyle.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/terminal.rs" />
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/color.rs" />
</list> </list>
</option> </option>
</component> </component>
@ -134,10 +119,10 @@
<sorting>DEFINITION_ORDER</sorting> <sorting>DEFINITION_ORDER</sorting>
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-8" /> <option name="x" value="1016" />
<option name="y" value="-8" /> <option name="y" value="-8" />
<option name="width" value="2576" /> <option name="width" value="1616" />
<option name="height" value="1056" /> <option name="height" value="916" />
</component> </component>
<component name="ProjectView"> <component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1"> <navigator currentView="ProjectPane" proportions="" version="1">
@ -154,6 +139,7 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="PackagesPane" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<expand> <expand>
@ -164,23 +150,22 @@
<path> <path>
<item name="crossterm" type="b2602c69:ProjectViewProjectNode" /> <item name="crossterm" type="b2602c69:ProjectViewProjectNode" />
<item name="crossterm" type="462c0819:PsiDirectoryNode" /> <item name="crossterm" type="462c0819:PsiDirectoryNode" />
<item name="examples" type="462c0819:PsiDirectoryNode" /> <item name="src" type="462c0819:PsiDirectoryNode" />
</path> </path>
</expand> </expand>
<select /> <select />
</subPane> </subPane>
</pane> </pane>
<pane id="Scratches" /> <pane id="Scratches" />
<pane id="AndroidView" />
<pane id="PackagesPane" />
<pane id="Scope" /> <pane id="Scope" />
<pane id="AndroidView" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.General" /> <property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.General" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" /> <property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../console" /> <property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="org.rust.cargo.project.model.PROJECT_DISCOVERY" value="true" /> <property name="org.rust.cargo.project.model.PROJECT_DISCOVERY" value="true" />
</component> </component>
<component name="RunDashboard"> <component name="RunDashboard">
@ -292,16 +277,24 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1513618274599</updated> <updated>1513618274599</updated>
<workItem from="1513618275819" duration="650000" /> <workItem from="1513618275819" duration="650000" />
<workItem from="1516296788994" duration="11582000" /> <workItem from="1516296788994" duration="11697000" />
<workItem from="1516389177617" duration="4698000" />
<workItem from="1516465253623" duration="2380000" />
<workItem from="1516481436076" duration="612000" />
<workItem from="1516541142596" duration="1772000" />
<workItem from="1516642567147" duration="9639000" />
<workItem from="1516732433377" duration="10104000" />
<workItem from="1516816975304" duration="6256000" />
<workItem from="1516900692734" duration="812000" />
<workItem from="1517074341232" duration="930000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="12242000" /> <option name="totallyTimeSpent" value="49560000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-8" y="-8" width="2576" height="1056" extended-state="6" /> <frame x="-8" y="-8" width="2576" height="1056" extended-state="6" />
<editor active="true" />
<layout> <layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
@ -316,9 +309,8 @@
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.09765625" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.09765625" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32979852" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
@ -330,6 +322,7 @@
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32979852" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout> </layout>
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -343,89 +336,6 @@
<watches-manager /> <watches-manager />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/examples/bin.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="22" lean-forward="false" selection-start-line="0" selection-start-column="22" selection-end-line="0" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/shared/enums.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/shared/functions.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/shared/macros.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/shared/traits.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_terminal/ansi_terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_terminal/terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/bin.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/term_cursor_example/mod.rs" /> <entry file="file://$PROJECT_DIR$/examples/term_cursor_example/mod.rs" />
<entry file="file://$PROJECT_DIR$/examples/bin.rs"> <entry file="file://$PROJECT_DIR$/examples/bin.rs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -439,15 +349,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/shared/functions.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -455,91 +356,15 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_terminal/ansi_terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/examples/term_cursor_example/mod.rs" /> <entry file="file://$PROJECT_DIR$/examples/term_cursor_example/mod.rs" />
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/mod.rs"> <entry file="file://$PROJECT_DIR$/src/shared/enums.rs" />
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_style/color/winapi_color.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="4" column="0" lean-forward="false" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
<folding>
<element signature="e#939#940#0" expanded="false" />
<element signature="e#1012#1013#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_style/color/base_color.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="0" lean-forward="false" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/shared/enums.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_terminal/winapi_terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="34" column="36" lean-forward="false" selection-start-line="34" selection-start-column="36" selection-end-line="34" selection-end-column="36" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_cursor/cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
<caret line="88" column="21" lean-forward="false" selection-start-line="88" selection-start-column="21" selection-end-line="88" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/shared/traits.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/shared/mod.rs"> <entry file="file://$PROJECT_DIR$/src/shared/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">
<caret line="2" column="15" lean-forward="false" selection-start-line="2" selection-start-column="15" selection-end-line="2" selection-end-column="15" /> <caret line="2" column="15" lean-forward="false" selection-start-line="2" selection-start-column="15" selection-end-line="2" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.4/src/um/wincon.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="298">
<caret line="298" column="11" lean-forward="false" selection-start-line="298" selection-start-column="11" selection-end-line="298" selection-end-column="11" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -547,7 +372,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306"> <state relative-caret-position="306">
<caret line="137" column="9" lean-forward="false" selection-start-line="137" selection-start-column="9" selection-end-line="137" selection-end-column="9" /> <caret line="137" column="9" lean-forward="false" selection-start-line="137" selection-start-column="9" selection-end-line="137" selection-end-column="9" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -555,7 +379,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="298"> <state relative-caret-position="298">
<caret line="118" column="9" lean-forward="false" selection-start-line="118" selection-start-column="9" selection-end-line="118" selection-end-column="9" /> <caret line="118" column="9" lean-forward="false" selection-start-line="118" selection-start-column="9" selection-end-line="118" selection-end-column="9" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -563,7 +386,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306"> <state relative-caret-position="306">
<caret line="1341" column="11" lean-forward="false" selection-start-line="1341" selection-start-column="11" selection-end-line="1341" selection-end-column="11" /> <caret line="1341" column="11" lean-forward="false" selection-start-line="1341" selection-start-column="11" selection-end-line="1341" selection-end-column="11" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -571,7 +393,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -579,55 +400,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306"> <state relative-caret-position="306">
<caret line="284" column="10" lean-forward="false" selection-start-line="284" selection-start-column="10" selection-end-line="284" selection-end-column="10" /> <caret line="284" column="10" lean-forward="false" selection-start-line="284" selection-start-column="10" selection-end-line="284" selection-end-column="10" />
<folding />
</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="0">
<caret line="0" column="34" lean-forward="false" selection-start-line="0" selection-start-column="34" selection-end-line="0" selection-end-column="34" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/color.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/winapi_extentions.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="11" column="8" lean-forward="false" selection-start-line="11" selection-start-column="8" selection-end-line="11" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.4/src/lib.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</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="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/handle.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
<caret line="14" column="16" lean-forward="false" selection-start-line="14" selection-start-column="16" selection-end-line="14" selection-end-column="16" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -635,15 +407,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136"> <state relative-caret-position="136">
<caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" /> <caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/color/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="9" column="22" lean-forward="false" selection-start-line="9" selection-start-column="22" selection-end-line="9" selection-end-column="22" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -651,55 +414,23 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/cursor.rs"> <entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state relative-caret-position="0"> <state split_layout="SPLIT">
<caret line="0" column="30" lean-forward="false" selection-start-line="0" selection-start-column="30" selection-end-line="0" selection-end-column="30" /> <first_editor relative-caret-position="569">
<folding /> <caret line="108" column="23" lean-forward="false" selection-start-line="108" selection-start-column="23" selection-end-line="108" selection-end-column="23" />
</first_editor>
<second_editor />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/examples/cursor/mod.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 relative-caret-position="952"> <state relative-caret-position="136">
<caret line="59" column="18" lean-forward="false" selection-start-line="59" selection-start-column="18" selection-end-line="59" selection-end-column="18" /> <caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_cursor/winapi_cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
<caret line="20" column="5" lean-forward="false" selection-start-line="20" selection-start-column="5" selection-end-line="20" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/terminal/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="25" column="14" lean-forward="false" selection-start-line="25" selection-start-column="14" selection-end-line="25" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_terminal/terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="298">
<caret line="47" column="11" lean-forward="false" selection-start-line="47" selection-start-column="11" selection-end-line="47" selection-end-column="11" />
<folding />
</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="357">
<caret line="87" column="14" lean-forward="true" selection-start-line="87" selection-start-column="14" selection-end-line="87" selection-end-column="14" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -707,37 +438,260 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_cursor/base_cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="374">
<caret line="22" column="133" lean-forward="false" selection-start-line="22" selection-start-column="4" selection-end-line="22" selection-end-column="133" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_cursor/cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="4131">
<caret line="243" column="12" lean-forward="false" selection-start-line="243" selection-start-column="12" selection-end-line="243" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_mouse/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/todo.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="4" column="52" lean-forward="false" selection-start-line="4" selection-start-column="52" selection-end-line="4" selection-end-column="52" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_terminal/ansi_terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="742">
<caret line="55" column="64" lean-forward="false" selection-start-line="55" selection-start-column="64" selection-end-line="55" selection-end-column="64" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_terminal/base_terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="17" column="38" lean-forward="false" selection-start-line="17" selection-start-column="38" selection-end-line="17" selection-end-column="38" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.4/src/lib.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="487">
<caret line="41" column="13" lean-forward="false" selection-start-line="41" selection-start-column="13" selection-end-line="41" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.4/src/shared/minwindef.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="298">
<caret line="36" column="25" lean-forward="false" selection-start-line="36" selection-start-column="25" selection-end-line="36" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_cursor/ansi_cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="663">
<caret line="43" column="5" lean-forward="false" selection-start-line="43" selection-start-column="5" selection-end-line="43" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.4/src/um/wincon.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="298">
<caret line="298" column="11" lean-forward="false" selection-start-line="298" selection-start-column="11" selection-end-line="298" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/handle.rs" />
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/winapi_extentions.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="17" lean-forward="false" selection-start-line="1" selection-start-column="17" selection-end-line="1" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/color/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="334">
<caret line="30" column="45" lean-forward="false" selection-start-line="30" selection-start-column="45" selection-end-line="30" selection-end-column="45" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/cursor/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="468">
<caret line="64" column="30" lean-forward="false" selection-start-line="64" selection-start-column="30" selection-end-line="64" selection-end-column="30" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/shared/functions.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_cursor/winapi_cursor.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="17" column="0" lean-forward="false" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_terminal/terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="765">
<caret line="162" column="25" lean-forward="false" selection-start-line="162" selection-start-column="25" selection-end-line="162" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/terminal/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="487">
<caret line="117" column="18" lean-forward="true" selection-start-line="117" selection-start-column="18" selection-end-line="117" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_terminal/winapi_terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="22" column="57" lean-forward="false" selection-start-line="22" selection-start-column="57" selection-end-line="22" selection-end-column="57" />
</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="34">
<caret line="2" column="21" lean-forward="false" selection-start-line="2" selection-start-column="21" selection-end-line="2" selection-end-column="21" />
</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="38" lean-forward="true" selection-start-line="2" selection-start-column="38" selection-end-line="2" selection-end-column="38" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/bin.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="15" column="14" lean-forward="false" selection-start-line="15" selection-start-column="14" selection-end-line="15" selection-end-column="14" />
<folding />
</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="221">
<caret line="16" column="5" lean-forward="false" selection-start-line="16" selection-start-column="5" selection-end-line="16" selection-end-column="5" />
<folding>
<element signature="e#222#223#0" expanded="false" />
<element signature="e#272#273#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_style/color/color.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="4" column="0" lean-forward="false" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_style/color/base_color.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="11" column="28" lean-forward="false" selection-start-line="11" selection-start-column="28" selection-end-line="11" selection-end-column="28" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/kernel/linux_kernel/terminal.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="21" column="16" lean-forward="true" selection-start-line="21" selection-start-column="16" selection-end-line="21" selection-end-column="16" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_style/styles/styledobject.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" column="0" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_style/color/winapi_color.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="561">
<caret line="35" column="39" lean-forward="false" selection-start-line="35" selection-start-column="39" selection-end-line="35" selection-end-column="39" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_style/styles/objectstyle.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="725">
<caret line="60" column="14" lean-forward="false" selection-start-line="60" selection-start-column="14" selection-end-line="60" selection-end-column="14" />
<folding>
<element signature="e#1550#1551#0" expanded="false" />
<element signature="e#1587#1588#0" expanded="false" />
</folding>
</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="663">
<caret line="153" column="8" lean-forward="false" selection-start-line="153" selection-start-column="8" selection-end-line="153" selection-end-column="8" />
<folding />
</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="249">
<caret line="138" column="12" lean-forward="false" selection-start-line="138" selection-start-column="12" selection-end-line="138" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_style/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="298">
<caret line="53" column="4" lean-forward="false" selection-start-line="53" selection-start-column="4" selection-end-line="53" selection-end-column="4" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/color.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1394">
<caret line="84" column="9" lean-forward="false" selection-start-line="84" selection-start-column="9" selection-end-line="84" selection-end-column="9" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/Cargo.toml"> <entry file="file://$PROJECT_DIR$/Cargo.toml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170"> <state relative-caret-position="255">
<caret line="10" column="12" lean-forward="false" selection-start-line="10" selection-start-column="12" selection-end-line="10" selection-end-column="12" /> <caret line="15" column="33" lean-forward="true" selection-start-line="15" selection-start-column="33" selection-end-line="15" selection-end-column="33" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/examples/bin.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="11" lean-forward="false" selection-start-line="12" selection-start-column="11" selection-end-line="12" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="195">
<caret line="86" column="14" lean-forward="false" selection-start-line="86" selection-start-column="14" selection-end-line="86" selection-end-column="14" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</component> </component>
<component name="masterDetails"> <component name="masterDetails">
<states> <states>

View File

@ -16,5 +16,8 @@ winapi = { version = "0.3", features = ["winbase","winuser","consoleapi","proces
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
libc = "0.2" libc = "0.2"
[[bin]]
name = "example_bin"
path = "./examples/bin.rs"

View File

@ -1,11 +1,25 @@
//! This bin folder can be used to try the examples out located in the examples directory.
//!
//! All you need to do is:
//!
//! - Download the crossterm source code.
//! - Add this in the Cargo.toml file:
//! ``` [[bin]]
//! name = "example_bin"
//! path = "./examples/bin.rs"
//! ```
//!
//! - Run program with: `cargo run`
// Import crossterm crate.
extern crate crossterm; extern crate crossterm;
use self::crossterm::crossterm_style::*; // Add the usings for the crossterms modules to play with crossterm
use self::crossterm::crossterm_style;
use self::crossterm::crossterm_cursor; use self::crossterm::crossterm_cursor;
use self::crossterm::crossterm_terminal::*; use self::crossterm::crossterm_terminal;
use std::io::{stdin, stdout, Write};
// Import the example modules.
pub mod color; pub mod color;
pub mod cursor; pub mod cursor;
pub mod terminal; pub mod terminal;

View File

@ -28,7 +28,7 @@ pub fn paint_background()
// This will give you an object back wits can be styled and displayed. // This will give you an object back wits can be styled and displayed.
let mut styledobject = paint("Red background color"); let mut styledobject = paint("Red background color");
// Call the method `on()` on the object given by `paint()` and pass in an Color from the Color enum. // Call the method `on()` on the object given by `paint()` and pass in an Color from the Color enum.
styledobject = styledobject.on(Color::Blue); styledobject = styledobject.on(Color::Red);
// Print the object to the console and check see the result // Print the object to the console and check see the result
println!("{}", styledobject); println!("{}", styledobject);
@ -98,3 +98,32 @@ pub fn print_all_background_colors()
println!("Grey : \t\t {}", paint(" ").on(Color::Grey)); println!("Grey : \t\t {}", paint(" ").on(Color::Grey));
println!("White : \t {}", paint(" ").on(Color::White)); println!("White : \t {}", paint(" ").on(Color::White));
} }
/// Print font with all available attributes. Note that this can only be used at unix systems and that some are not supported widely.
#[cfg(unix)]
pub fn print_font_with_attributes()
{
println!("{}", paint("Normal text"));
println!("{}", paint("Bold text").bold());
println!("{}", paint("Italic text").italic());
println!("{}", paint("Slow blinking text").slow_blink());
println!("{}", paint("Rapid blinking text").rapid_blink());
println!("{}", paint("Hidden text").hidden());
println!("{}", paint("Underlined text").underlined());
println!("{}", paint("Reversed color").reverse());
println!("{}", paint("Dim text color").dim());
println!("{}", paint("Crossed out font").crossed_out());
}
/// Print all supported rgb colors
#[cfg(unix)]#[cfg(unix)]
pub fn print_supported_colors()
{
let count = crossterm::crossterm_style::get().get_available_color_count().unwrap();
for i in 0..count
{
println!("{}", paint(format!("Color: {}",i)).with(Color::AnsiValue(i as u8)));
}
}

View File

@ -76,6 +76,27 @@ pub fn print()
get().goto(10,5).print("@"); get().goto(10,5).print("@");
} }
/// Save and reset cursor position.
pub fn safe_and_reset_position()
{
let mut cursor = get();
// Goto X: 5 Y: 5
cursor.goto(5,5);
// Safe cursor position: X: 5 Y: 5
cursor.safe_position();
// Goto X: 5 Y: 20
cursor.goto(5,20);
// Print at X: 5 Y: 20.
print!("Yea!");
// Reset back to X: 5 Y: 5.
cursor.reset_position();
// Print Back at X: 5 Y: 5.
print!("Back");
println!()
}

View File

@ -80,7 +80,7 @@ pub fn clear_until_new_line()
print_test_data(); print_test_data();
// Set terminal cursor position (see example for more info). // Set terminal cursor position (see example for more info).
crossterm_cursor::get().goto(4,4); crossterm_cursor::get().goto(4,7);
// Clear all the cells until next line. // Clear all the cells until next line.
terminal.clear(ClearType::UntilNewLine); terminal.clear(ClearType::UntilNewLine);
@ -96,6 +96,14 @@ pub fn print_terminal_size()
print!("X: {}, y: {}", terminal_size.0, terminal_size.1); print!("X: {}, y: {}", terminal_size.0, terminal_size.1);
} }
/// Set the terminal size to width 10, height: 10.
pub fn set_terminal_size()
{
let mut terminal = get();
terminal.set_size(10,10);
}
// scroll down 10 lines // scroll down 10 lines
pub fn scroll_down() pub fn scroll_down()
{ {
@ -103,7 +111,7 @@ pub fn scroll_down()
// Get terminal // Get terminal
let mut terminal = get(); let mut terminal = get();
// Scroll down 10 lines. // Scroll down 10 lines.
let terminal_size = terminal.scroll_down(10); terminal.scroll_down(10);
} }
// scroll down 10 lines // scroll down 10 lines
@ -114,5 +122,14 @@ pub fn scroll_up()
// Get terminal // Get terminal
let mut terminal = get(); let mut terminal = get();
// Scroll up 10 lines. // Scroll up 10 lines.
let terminal_size = terminal.scroll_up(10); terminal.scroll_up(10);
}
// Resize the terminal to X: 10, Y: 10
pub fn resize_terminal()
{
// Get terminal
let mut terminal = get();
// Get terminal size
terminal.set_size(1,1);
} }

View File

@ -44,4 +44,16 @@ impl ITerminalCursor for AnsiCursor {
let mut some_writer = io::stdout(); let mut some_writer = io::stdout();
write!(&mut some_writer, csi!("{}D"), count); write!(&mut some_writer, csi!("{}D"), count);
} }
fn safe_position(&mut self)
{
let mut some_writer = io::stdout();
write!(&mut some_writer, csi!("s"));
}
fn reset_position(&self)
{
let mut some_writer = io::stdout();
write!(&mut some_writer, csi!("u"));
}
} }

View File

@ -20,4 +20,8 @@ pub trait ITerminalCursor {
fn move_down(&self, count: u16); fn move_down(&self, count: u16);
/// Move the cursor `n` times left. /// Move the cursor `n` times left.
fn move_left(&self, count: u16); fn move_left(&self, count: u16);
/// Save cursor position for recall later. Note that this position is stored program based not per instance of the cursor struct.
fn safe_position(&mut self);
/// Return to saved cursor position
fn reset_position(&self);
} }

View File

@ -209,6 +209,52 @@ impl TerminalCursor {
std::io::stdout().flush(); std::io::stdout().flush();
self self
} }
/// Save cursor position for recall later.
///
/// Note that this position is stored program based not per instance of the `Cursor` struct.
///
/// #Example
///
/// ```rust
///
/// extern crate crossterm;
///
/// use self::crossterm::crossterm_cursor::get;
///
/// get().safe_position();
///
/// ```
pub fn safe_position(&mut self)
{
&self.init();
if let Some(ref mut terminal_cursor) = self.terminal_cursor {
terminal_cursor.safe_position();
}
}
/// Return to saved cursor position
///
/// Note that this method reset to the position set by `safe_position()` and that this position is stored program based not per instance of the `Cursor` struct.
///
/// #Example
///
/// ```rust
///
/// extern crate crossterm;
///
/// use self::crossterm::crossterm_cursor::get;
///
/// get().reset_position();
///
/// ```
pub fn reset_position(&mut self)
{
&self.init();
if let Some(ref terminal_cursor) = self.terminal_cursor {
terminal_cursor.reset_position();
}
}
} }
/// Get the concrete ITerminalCursor implementation based on the current operating system. /// Get the concrete ITerminalCursor implementation based on the current operating system.

View File

@ -17,34 +17,40 @@ impl ITerminalCursor for WinApiCursor {
} }
fn pos(&self) -> (i16, i16) { fn pos(&self) -> (i16, i16) {
(cursor::xpos(), cursor::ypos()) cursor::pos()
} }
fn move_up(&self, count: u16) { fn move_up(&self, count: u16) {
let xpos = cursor::xpos(); let (xpos,ypos) = cursor::pos();
let ypos = cursor::ypos();
cursor::set(xpos, ypos - count as i16); cursor::set(xpos, ypos - count as i16);
} }
fn move_right(&self, count: u16) { fn move_right(&self, count: u16) {
let xpos = cursor::xpos(); let (xpos,ypos) = cursor::pos();
let ypos = cursor::ypos();
cursor::set(xpos + count as i16, ypos); cursor::set(xpos + count as i16, ypos);
} }
fn move_down(&self, count: u16) { fn move_down(&self, count: u16) {
let xpos = cursor::xpos(); let (xpos,ypos) = cursor::pos();
let ypos = cursor::ypos();
cursor::set(xpos, ypos + count as i16); cursor::set(xpos, ypos + count as i16);
} }
fn move_left(&self, count: u16) { fn move_left(&self, count: u16) {
let xpos = cursor::xpos(); let (xpos,ypos) = cursor::pos();
let ypos = cursor::ypos();
cursor::set(xpos - count as i16, ypos); cursor::set(xpos - count as i16, ypos);
} }
fn safe_position(&mut self)
{
cursor::save_cursor_pos();
}
fn reset_position(&self)
{
cursor::reset_to_saved_position();
}
} }

View File

View File

@ -3,7 +3,7 @@ use std::io::Write;
use std::string::String; use std::string::String;
use Construct; use Construct;
use super::color::{Color, ColorType}; use super::super::{Color, ColorType};
use super::base_color::ITerminalColor; use super::base_color::ITerminalColor;
@ -19,14 +19,13 @@ impl Construct for ANSIColor {
impl ITerminalColor for ANSIColor { impl ITerminalColor for ANSIColor {
fn set_fg(&self, fg_color: Color) { fn set_fg(&self, fg_color: Color) {
let mut some_writer = io::stdout(); let mut some_writer = io::stdout();
write!(&mut some_writer, csi!("38;5;{}m"), self.color_value(fg_color, ColorType::Foreground)); write!(&mut some_writer, csi!("{}m"), self.color_value(fg_color, ColorType::Foreground));
} }
fn set_bg(&self, bg_color: Color) { fn set_bg(&self, bg_color: Color) {
let mut some_writer = io::stdout(); let mut some_writer = io::stdout();
write!(&mut some_writer, csi!("48;5;{}m"), self.color_value(bg_color, ColorType::Background)); write!(&mut some_writer, csi!("{}m"), self.color_value(bg_color, ColorType::Background));
} }
fn reset(&self) { fn reset(&self) {
@ -36,23 +35,41 @@ impl ITerminalColor for ANSIColor {
fn color_value(&self, color: Color, color_type: ColorType) -> String { fn color_value(&self, color: Color, color_type: ColorType) -> String {
// Construct ANSI escape color code string. ;1 is for the brightness let mut ansi_value = String::new();
match color {
Color::Black => "0", match color_type
Color::Red => "9", {
Color::DarkRed =>"1", ColorType::Foreground => {
Color::Green => "10", ansi_value.push_str("38;")
Color::DarkGreen => "2", },
Color::Yellow => "11", ColorType::Background => {
Color::DarkYellow => "3", ansi_value.push_str("48;")
Color::Blue => "12", },
Color::DarkBlue => "4", }
Color::Magenta => "13",
Color::DarkMagenta => "5", let rgb_val;
Color::Cyan => "14",
Color::DarkCyan => "6", let color_val = match color {
Color::Grey => "15", Color::Black => "5;0",
Color::White => "7", Color::Red => "5;9",
}.to_string() Color::DarkRed =>"5;1",
Color::Green => "5;10",
Color::DarkGreen => "5;2",
Color::Yellow => "5;11",
Color::DarkYellow => "5;3",
Color::Blue => "5;12",
Color::DarkBlue => "5;4",
Color::Magenta => "5;13",
Color::DarkMagenta => "5;5",
Color::Cyan => "5;14",
Color::DarkCyan => "5;6",
Color::Grey => "5;15",
Color::White => "5;7",
Color::Rgb{r,g,b} => { rgb_val = format!("2;{};{};{}", r,g,b); rgb_val.as_str()},
Color::AnsiValue(val) => { rgb_val = format!("5;{}",val); rgb_val.as_str() }
};
ansi_value.push_str(color_val);
ansi_value
} }
} }

View File

@ -9,7 +9,7 @@
///! so that the color related actions can be preformed on both unix and windows systems. ///! so that the color related actions can be preformed on both unix and windows systems.
///! ///!
use super::color::{Color, ColorType}; use super::super::{Color, ColorType};
pub trait ITerminalColor { pub trait ITerminalColor {
/// Set the forground color to the given color. /// Set the forground color to the given color.

View File

@ -2,91 +2,18 @@
//! Like styling the font, foreground color and background color. //! Like styling the font, foreground color and background color.
use std::fmt; use std::fmt;
use std::convert::From; use std::io;
use std::str::FromStr;
use Construct; use Construct;
use crossterm_style::{ObjectStyle, StyledObject}; use crossterm_style::{ObjectStyle, StyledObject};
use super::base_color::ITerminalColor; use super::base_color::ITerminalColor;
use super::super::Color;
#[cfg(unix)] #[cfg(unix)]
use super::ANSIColor; use super::ANSIColor;
#[cfg(windows)] #[cfg(windows)]
use super::WinApiColor; use super::WinApiColor;
/// Colors that are available for coloring the termainal font.
#[derive(Debug, Copy, Clone)]
pub enum Color {
Black,
Red,
DarkRed,
Green,
DarkGreen,
Yellow,
DarkYellow,
Blue,
DarkBlue,
Magenta,
DarkMagenta,
Cyan,
DarkCyan,
Grey,
White,
}
/// Color types that can be used to determine if the Color enum is an Fore- or Background Color
#[derive(Debug, Copy, Clone)]
pub enum ColorType {
Background,
Foreground,
}
impl<'a> From<&'a str> for Color {
fn from(src: &str) -> Self {
src.parse().unwrap_or(Color::White)
}
}
impl From<String> for Color {
fn from(src: String) -> Self {
src.parse().unwrap_or(Color::White)
}
}
impl FromStr for Color {
type Err = ();
fn from_str(src: &str) -> Result<Self, Self::Err> {
let src = src.to_lowercase();
match src.as_ref() {
"black" => Ok(Color::Black),
"red" => Ok(Color::Red),
"dark_red" => Ok(Color::DarkRed),
"green" => Ok(Color::Green),
"dark_green" => Ok(Color::DarkGreen),
"yellow" => Ok(Color::Yellow),
"dark_yellow" => Ok(Color::DarkYellow),
"blue" => Ok(Color::Blue),
"dark_blue" => Ok(Color::DarkBlue),
"magenta" => Ok(Color::Magenta),
"dark_magenta" => Ok(Color::DarkMagenta),
"cyan" => Ok(Color::Cyan),
"dark_cyan" => Ok(Color::DarkCyan),
"grey" => Ok(Color::Grey),
"white" => Ok(Color::White),
_ => Ok(Color::White),
}
}
}
/// Struct that stores an specific platform implementation for color related actions. /// Struct that stores an specific platform implementation for color related actions.
pub struct TerminalColor { pub struct TerminalColor {
terminal_color: Option<Box<ITerminalColor>>, terminal_color: Option<Box<ITerminalColor>>,
@ -171,6 +98,23 @@ impl TerminalColor {
terminal_color.reset(); terminal_color.reset();
} }
} }
/// Get available color count.
pub fn get_available_color_count(&self) -> io::Result<u16>
{
use std::env;
Ok(match env::var_os("TERM") {
Some(val) => {
if val.to_str().unwrap_or("").contains("256color") {
256
} else {
8
}
}
None => 8,
})
}
} }
/// Get an concrete ITerminalColor implementation based on the current operating system. /// Get an concrete ITerminalColor implementation based on the current operating system.
@ -237,3 +181,5 @@ where
{ {
ObjectStyle::new().apply_to(val) ObjectStyle::new().apply_to(val)
} }

View File

@ -1,5 +1,5 @@
use Construct; use Construct;
use super::color::{ColorType, Color}; use super::super::{ColorType, Color};
use super::base_color::ITerminalColor; use super::base_color::ITerminalColor;
use kernel::windows_kernel; use kernel::windows_kernel;

View File

@ -5,3 +5,97 @@ pub use self::color::color::*;
pub use self::styles::objectstyle::ObjectStyle; pub use self::styles::objectstyle::ObjectStyle;
pub use self::styles::styledobject::StyledObject; pub use self::styles::styledobject::StyledObject;
use std::convert::From;
use std::str::FromStr;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd)]
pub enum Attribute {
Bold = 1,
Dim = 2,
Italic = 3,
Underlined = 4,
SlowBlink = 5,
RapidBlink = 6,
Reverse = 7,
Hidden = 8,
CrossedOut = 9
}
/// Colors that are available for coloring the termainal font.
#[derive(Debug, Copy, Clone)]
pub enum Color {
Black,
Red,
DarkRed,
Green,
DarkGreen,
Yellow,
DarkYellow,
Blue,
DarkBlue,
Magenta,
DarkMagenta,
Cyan,
DarkCyan,
Grey,
White,
#[cfg(unix)]
Rgb { r: u8, g: u8, b:u8 },
#[cfg(unix)]
AnsiValue(u8)
}
/// Color types that can be used to determine if the Color enum is an Fore- or Background Color
#[derive(Debug, Copy, Clone)]
pub enum ColorType {
Background,
Foreground,
}
impl<'a> From<&'a str> for Color {
fn from(src: &str) -> Self {
src.parse().unwrap_or(Color::White)
}
}
impl From<String> for Color {
fn from(src: String) -> Self {
src.parse().unwrap_or(Color::White)
}
}
impl FromStr for Color {
type Err = ();
fn from_str(src: &str) -> Result<Self, Self::Err> {
let src = src.to_lowercase();
match src.as_ref() {
"black" => Ok(Color::Black),
"red" => Ok(Color::Red),
"dark_red" => Ok(Color::DarkRed),
"green" => Ok(Color::Green),
"dark_green" => Ok(Color::DarkGreen),
"yellow" => Ok(Color::Yellow),
"dark_yellow" => Ok(Color::DarkYellow),
"blue" => Ok(Color::Blue),
"dark_blue" => Ok(Color::DarkBlue),
"magenta" => Ok(Color::Magenta),
"dark_magenta" => Ok(Color::DarkMagenta),
"cyan" => Ok(Color::Cyan),
"dark_cyan" => Ok(Color::DarkCyan),
"grey" => Ok(Color::Grey),
"white" => Ok(Color::White),
_ => Ok(Color::White),
}
}
}

View File

@ -1,11 +1,16 @@
use crossterm_style::{Color, StyledObject}; use crossterm_style::{Color, StyledObject};
use std::fmt::Display; use std::fmt::Display;
use super::super::Attribute;
/// Struct that contains the style properties that can be applied to an displayable object. /// Struct that contains the style properties that can be applied to an displayable object.
#[derive(Clone)] #[derive(Clone)]
pub struct ObjectStyle { pub struct ObjectStyle {
pub fg_color: Option<Color>, pub fg_color: Option<Color>,
pub bg_color: Option<Color>, pub bg_color: Option<Color>,
#[cfg(unix)]
pub attrs: Vec<Attribute>
} }
impl Default for ObjectStyle { impl Default for ObjectStyle {
@ -13,6 +18,8 @@ impl Default for ObjectStyle {
ObjectStyle { ObjectStyle {
fg_color: Some(Color::White), fg_color: Some(Color::White),
bg_color: Some(Color::Black), bg_color: Some(Color::Black),
#[cfg(unix)]
attrs: Vec::new()
} }
} }
} }
@ -34,6 +41,8 @@ impl ObjectStyle {
return ObjectStyle { return ObjectStyle {
fg_color: None, fg_color: None,
bg_color: None, bg_color: None,
#[cfg(unix)]
attrs: Vec::new()
}; };
} }
@ -48,4 +57,10 @@ impl ObjectStyle {
self.fg_color = Some(color); self.fg_color = Some(color);
self self
} }
#[cfg(unix)]
pub fn add_attr(&mut self, attr: Attribute)
{
self.attrs.push(attr);
}
} }

View File

@ -2,6 +2,8 @@ use std;
use std::fmt; use std::fmt;
use std::io::Write; use std::io::Write;
use super::super::Attribute;
use crossterm_style::{Color, ObjectStyle}; use crossterm_style::{Color, ObjectStyle};
/// Struct that contains both the style and the content wits will be styled. /// Struct that contains both the style and the content wits will be styled.
@ -11,11 +13,14 @@ pub struct StyledObject<D> {
} }
impl<D> StyledObject<D> { impl<D> StyledObject<D> {
/// Sets the foreground of the styled object to the passed `Color` /// Set the foreground of the styled object to the passed `Color`
/// ///
/// #Example /// #Example
/// ///
/// ```rust /// ```rust
/// extern crate crossterm;
/// use self::crossterm::crossterm_style::{paint,Color};
///
/// // create an styled object with the foreground color red. /// // create an styled object with the foreground color red.
/// let styledobject = paint("I am colored red").with(Color::Red); /// let styledobject = paint("I am colored red").with(Color::Red);
/// // create an styled object with the foreground color blue. /// // create an styled object with the foreground color blue.
@ -33,11 +38,13 @@ impl<D> StyledObject<D> {
self self
} }
/// Sets the background of the styled object to the passed `Color` /// Set the background of the styled object to the passed `Color`
/// ///
/// #Example /// #Example
/// ///
/// ```rust /// ```rust
/// extern crate crossterm;
/// use self::crossterm::crossterm_style::{paint,Color};
/// ///
/// // create an styled object with the background color red. /// // create an styled object with the background color red.
/// let styledobject = paint("I am colored red").on(Color::Red); /// let styledobject = paint("I am colored red").on(Color::Red);
@ -55,6 +62,44 @@ impl<D> StyledObject<D> {
self.object_style = self.object_style.bg(background_color); self.object_style = self.object_style.bg(background_color);
self self
} }
/// Set the attribute of an styled object to the passed `Attribute`
///
/// #Example
///
/// ```rust
///
/// extern crate crossterm;
/// use self::crossterm::crossterm_style::{paint,Attribute};
///
/// println!("{}", paint("Bold").attr(Attribute::Bold));
///
/// ```
#[cfg(unix)]
pub fn attr(mut self, attr: Attribute) -> StyledObject<D>
{
&self.object_style.add_attr(attr);
self
}
/// Increase the font intensity.
#[cfg(unix)]#[inline(always)] pub fn bold(self) -> StyledObject<D> { self.attr(Attribute::Bold) }
/// Faint (decreased intensity) (Not widely supported).
#[cfg(unix)]#[inline(always)] pub fn dim(self) -> StyledObject<D> { self.attr(Attribute::Dim) }
/// Make the font italic (Not widely supported; Sometimes treated as inverse).
#[cfg(unix)]#[inline(always)] pub fn italic(self) -> StyledObject<D> { self.attr(Attribute::Italic) }
/// Underline font.
#[cfg(unix)]#[inline(always)] pub fn underlined(self) -> StyledObject<D> { self.attr(Attribute::Underlined) }
/// Slow Blink (less than 150 per minute; not widely supported).
#[cfg(unix)]#[inline(always)] pub fn slow_blink(self) -> StyledObject<D> { self.attr(Attribute::SlowBlink) }
/// Rapid Blink (MS-DOS ANSI.SYS; 150+ per minute; not widely supported).
#[cfg(unix)]#[inline(always)] pub fn rapid_blink(self) -> StyledObject<D> { self.attr(Attribute::RapidBlink) }
/// Swap foreground and background colors.
#[cfg(unix)]#[inline(always)] pub fn reverse(self) -> StyledObject<D> { self.attr(Attribute::Reverse) }
/// Hide text (Not widely supported).
#[cfg(unix)]#[inline(always)] pub fn hidden(self) -> StyledObject<D> { self.attr(Attribute::Hidden) }
/// Characters legible, but marked for deletion. Not widely supported.
#[cfg(unix)]#[inline(always)] pub fn crossed_out(self) -> StyledObject<D> { self.attr(Attribute::CrossedOut) }
} }
/// This is used to make StyledObject able to be displayed. /// This is used to make StyledObject able to be displayed.
@ -78,6 +123,13 @@ macro_rules! impl_fmt
colored_terminal.set_fg(fg); colored_terminal.set_fg(fg);
reset = true; reset = true;
} }
#[cfg(unix)]
for attr in self.object_style.attrs.iter() {
write!(f, csi!("{}m"), *attr as i16);
reset = true;
}
fmt::$name::fmt(&self.content, f)?; fmt::$name::fmt(&self.content, f)?;
std::io::stdout().flush().expect("Flush stdout failed"); std::io::stdout().flush().expect("Flush stdout failed");

View File

@ -50,4 +50,9 @@ impl ITerminal for UnixTerminal {
let mut some_writer = io::stdout(); let mut some_writer = io::stdout();
write!(&mut some_writer, csi!("{}T"), count); write!(&mut some_writer, csi!("{}T"), count);
} }
fn set_size(&self, width: i16, height: i16) {
let mut some_writer = io::stdout();
write!(&mut some_writer, csi!("8;{};{}t"), width, height);
}
} }

View File

@ -16,4 +16,6 @@ pub trait ITerminal {
fn scroll_up(&self, count: i16); fn scroll_up(&self, count: i16);
/// Scroll `n` lines down in the current terminal. /// Scroll `n` lines down in the current terminal.
fn scroll_down(&self, count: i16); fn scroll_down(&self, count: i16);
/// Resize terminal to the given width and height.
fn set_size(&self,width: i16, height: i16);
} }

View File

@ -120,6 +120,31 @@ impl Terminal {
terminal.scroll_down(count); terminal.scroll_down(count);
} }
} }
/// Set the terminal size. Note that not all terminals can be set to a very small scale.
///
/// #Example
///
/// ```rust
///
/// extern crate crossterm;
/// use crossterm::crossterm_terminal;
///
/// let mut term = crossterm_terminal::get();
///
/// // Set of the size to X: 10 and Y: 10
/// let size = term.set_size(10,10);
///
/// ```
pub fn set_size(&mut self, width: i16, height: i16)
{
&self.init();
if let Some (ref terminal) = self.terminal
{
terminal.set_size(width,height);
}
}
} }
/// Get the concrete ITerminal implementation based on the current operating system. /// Get the concrete ITerminal implementation based on the current operating system.

View File

@ -35,4 +35,6 @@ impl ITerminal for WinApiTerminal {
fn scroll_down(&self, count: i16) { fn scroll_down(&self, count: i16) {
terminal::scroll_down(count as i16); terminal::scroll_down(count as i16);
} }
fn set_size(&self, width: i16, height: i16) { terminal::resize_terminal(width,height); }
} }

View File

@ -1,18 +1,7 @@
use winapi::shared::ntdef::HANDLE; use super::kernel;
use winapi::um::consoleapi::SetConsoleMode;
use super::handle;
/// Enables ansi for windows terminals. /// Enables ansi for windows terminals.
pub fn enable_ansi_support() { pub fn enable_ansi_support() {
let enable_ansi_code: u32 = 7; let enable_ansi_code: u32 = 7;
let output_handle = handle::get_output_handle(); kernel::set_console_mode(enable_ansi_code);
set_console_mode(output_handle, enable_ansi_code)
}
/// Set the console mode of the windows terminal.
fn set_console_mode(handle: HANDLE, console_mode: u32) {
unsafe {
SetConsoleMode(handle, console_mode);
}
} }

View File

@ -1,10 +1,9 @@
use winapi::um::wincon; use winapi::um::wincon;
use super::{handle, kernel};
use super::{kernel};
use crossterm_style as style; use crossterm_style as style;
use winapi::um::wincon::{SetConsoleTextAttribute}; /// This will set the foreground color by the given winapi color.
/// This will set the forground color by the given winapi color value parsed to u16.
pub fn set_fg_color(fg_color: u16) { pub fn set_fg_color(fg_color: u16) {
let csbi = kernel::get_console_screen_buffer_info(); let csbi = kernel::get_console_screen_buffer_info();
@ -21,10 +20,10 @@ pub fn set_fg_color(fg_color: u16) {
color = color | wincon::BACKGROUND_INTENSITY as u16; color = color | wincon::BACKGROUND_INTENSITY as u16;
} }
set_console_text_attribute(color); kernel::set_console_text_attribute(color);
} }
/// This will set the forground color by the given winapi color value parsed to u16. /// This will set the background color by the given winapi color value.
pub fn set_bg_color(bg_color: u16) { pub fn set_bg_color(bg_color: u16) {
let csbi = kernel::get_console_screen_buffer_info(); let csbi = kernel::get_console_screen_buffer_info();
// Notice that the color values are stored in wAttribute. // Notice that the color values are stored in wAttribute.
@ -34,21 +33,21 @@ pub fn set_bg_color(bg_color: u16) {
let fg_color = attrs & 0x0007; let fg_color = attrs & 0x0007;
color = fg_color | bg_color; color = fg_color | bg_color;
// foreground intensity is a seperate value in attrs, // foreground intensity is a separate value in attrs,
// wee need to check if this was applied to the current fg color. // wee need to check if this was applied to the current fg color.
if (attrs & wincon::FOREGROUND_INTENSITY as u16) != 0 { if (attrs & wincon::FOREGROUND_INTENSITY as u16) != 0 {
color = color | wincon::FOREGROUND_INTENSITY as u16; color = color | wincon::FOREGROUND_INTENSITY as u16;
} }
set_console_text_attribute(color); kernel::set_console_text_attribute(color);
} }
/// This will reset the colors to the value given in u16. /// This will reset the colors to the given winapi color value.
pub fn reset(original_color: u16) { pub fn reset(original_color: u16) {
set_console_text_attribute(original_color); kernel::set_console_text_attribute(original_color);
} }
/// This will get the winapi color value from the Color struct /// This will get the winapi color value from the Color and ColorType struct
pub fn winapi_color_val(color: style::Color, color_type: style::ColorType) -> u16 { pub fn winapi_color_val(color: style::Color, color_type: style::ColorType) -> u16 {
use crossterm_style::{Color, ColorType}; use crossterm_style::{Color, ColorType};
@ -107,12 +106,3 @@ pub fn winapi_color_val(color: style::Color, color_type: style::ColorType) -> u1
winapi_color as u16 winapi_color as u16
} }
/// This will set the console attributes by the given value
fn set_console_text_attribute(value: u16) {
let output_handle = handle::get_output_handle();
unsafe {
SetConsoleTextAttribute(output_handle, value);
}
}

View File

@ -1,53 +1,35 @@
use winapi::um::wincon::COORD; use super::kernel;
use super::{handle, kernel};
use shared::functions;
use winapi::um::wincon::{SetConsoleCursorPosition}; /// This stores the cursor pos, at program level. So it can be recalled later.
static mut SAVED_CURSOR_POS:(i16,i16) = (0,0);
/// Set the current cursor position to X and Y
/// Set the cursor position to an coordinate (x,y). pub fn set(x: i16, y: i16)
pub fn set(x: i16, y: i16) { {
set_cursor_pos(x as i16, y as i16); kernel::set_console_cursor_position(x, y );
} }
/// Get the current cursor x position. /// Reset to saved cursor position
pub fn xpos() -> i16 { pub fn reset_to_saved_position()
let csbi = kernel::get_console_screen_buffer_info(); {
csbi.dwCursorPosition.X
}
/// Get the current cursor y position.
pub fn ypos() -> i16 {
let csbi = kernel::get_console_screen_buffer_info();
csbi.dwCursorPosition.Y
}
pub fn move_down(count: u16) {
let csbi = kernel::get_console_screen_buffer_info();
unsafe { unsafe {
let output_handle = handle::get_output_handle(); kernel::set_console_cursor_position(SAVED_CURSOR_POS.0, SAVED_CURSOR_POS.1);
SetConsoleCursorPosition(
output_handle,
COORD {
X: csbi.dwCursorPosition.X,
Y: csbi.dwCursorPosition.Y + count as i16,
},
);
} }
} }
/// Set the cursor position to an coordinate (x,y). /// Save current cursor position to recall later.
fn set_cursor_pos(x: i16, y: i16) { pub fn save_cursor_pos()
functions::is_cursor_out_of_range(x, y); {
let position = pos();
let output_handle = handle::get_output_handle();
let position = COORD { X: x, Y: y };
unsafe { unsafe {
let success = SetConsoleCursorPosition(output_handle, position); SAVED_CURSOR_POS = (position.0, position.1);
if success == 0 {
panic!("Cannot set console cursor position");
}
} }
} }
/// Get current cursor position (X,Y)
pub fn pos() -> (i16,i16)
{
let csbi = kernel::get_console_screen_buffer_info();
( csbi.dwCursorPosition.X , csbi.dwCursorPosition.Y )
}

View File

@ -1,31 +0,0 @@
use winapi::um::winnt;
use winapi::um::winbase;
use winapi::um::handleapi;
use winapi::um::processenv::{GetStdHandle};
// static mut CONSOLE_INPUT_HANDLE:Option<winnt::HANDLE> = None;
static mut CONSOLE_OUTPUT_HANDLE: Option<winnt::HANDLE> = None;
/// Get the std_output_handle of the console
pub fn get_output_handle() -> winnt::HANDLE {
unsafe {
if let Some(handle) = CONSOLE_OUTPUT_HANDLE {
handle
} else {
let handle = GetStdHandle(winbase::STD_OUTPUT_HANDLE);
CONSOLE_OUTPUT_HANDLE = Some(handle);
handle
}
}
}
/// Checks if the console handle is an invalid handle value.
pub fn is_valid_handle(handle: &winnt::HANDLE) -> bool {
if *handle == handleapi::INVALID_HANDLE_VALUE {
true
} else {
false
}
}

View File

@ -1,16 +1,46 @@
use winapi::um::wincon::{GetConsoleScreenBufferInfo,CONSOLE_SCREEN_BUFFER_INFO}; use winapi::um::winnt::HANDLE;
use super::{handle, Empty}; use winapi::um::winbase::STD_OUTPUT_HANDLE;
use winapi::um::handleapi::INVALID_HANDLE_VALUE;
use winapi::um::processenv::{GetStdHandle};
use winapi::um::consoleapi::{SetConsoleMode};
use winapi::um::wincon::{ SetConsoleWindowInfo, SetConsoleCursorPosition, SetConsoleTextAttribute, SetConsoleScreenBufferSize,
GetLargestConsoleWindowSize, GetConsoleScreenBufferInfo,
FillConsoleOutputCharacterA, FillConsoleOutputAttribute,
CONSOLE_SCREEN_BUFFER_INFO, SMALL_RECT, COORD
};
use super::{Empty};
static mut CONSOLE_OUTPUT_HANDLE: Option<HANDLE> = None;
/// Get the std_output_handle of the console
pub fn get_output_handle() -> HANDLE {
unsafe {
if let Some(handle) = CONSOLE_OUTPUT_HANDLE {
handle
} else {
let handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_OUTPUT_HANDLE = Some(handle);
handle
}
}
}
/// Checks if the console handle is an invalid handle value.
pub fn is_valid_handle(handle: &HANDLE) -> bool {
if *handle == INVALID_HANDLE_VALUE {
true
} else {
false
}
}
/// Get console screen buffer info. /// Get console screen buffer info.
pub fn get_console_screen_buffer_info() -> CONSOLE_SCREEN_BUFFER_INFO { pub fn get_console_screen_buffer_info() -> CONSOLE_SCREEN_BUFFER_INFO {
let output_handle = handle::get_output_handle(); let output_handle = get_output_handle();
let mut csbi = CONSOLE_SCREEN_BUFFER_INFO::empty(); let mut csbi = CONSOLE_SCREEN_BUFFER_INFO::empty();
let success; let success;
if handle::is_valid_handle(&output_handle) {
return CONSOLE_SCREEN_BUFFER_INFO::empty();
}
unsafe { success = GetConsoleScreenBufferInfo(output_handle, &mut csbi) } unsafe { success = GetConsoleScreenBufferInfo(output_handle, &mut csbi) }
if success == 0 { if success == 0 {
@ -20,8 +50,129 @@ pub fn get_console_screen_buffer_info() -> CONSOLE_SCREEN_BUFFER_INFO {
csbi csbi
} }
/// Get the current console colors. pub fn get_largest_console_window_size() -> COORD
{
let output_handle = get_output_handle();
unsafe {
GetLargestConsoleWindowSize(output_handle)
}
}
pub fn get_original_console_color() -> u16 { pub fn get_original_console_color() -> u16 {
let console_buffer_info = get_console_screen_buffer_info(); let console_buffer_info = get_console_screen_buffer_info();
console_buffer_info.wAttributes as u16 console_buffer_info.wAttributes as u16
} }
pub fn set_console_mode(console_mode: u32)
{
let output_handle = get_output_handle();
unsafe {
SetConsoleMode(output_handle, console_mode);
}
}
pub fn set_console_cursor_position(x: i16, y: i16)
{
if x < 0 || x >= <i16>::max_value() {
panic!("X: {}, Argument Out of Range Exception", x);
}
if y < 0 || y >= <i16>::max_value() {
panic!("Y: {}, Argument Out of Range Exception", y);
}
let output_handle = get_output_handle();
let position = COORD { X: x, Y: y };
unsafe {
let success = SetConsoleCursorPosition(output_handle, position);
if success == 0 {
panic!("Argument out of range.");
}
}
}
pub fn set_console_text_attribute(value: u16)
{
let output_handle = get_output_handle();
unsafe {
SetConsoleTextAttribute(output_handle, value);
}
}
pub fn set_console_info(absolute: bool, rect: &SMALL_RECT) -> bool
{
let output_handle = get_output_handle();
let absolute = match absolute { true => 1, false => 0, };
unsafe
{
let success = SetConsoleWindowInfo(output_handle,absolute ,rect);
is_true(success)
}
}
pub fn set_console_screen_buffer_size( size: COORD) -> bool
{
let output_handle = get_output_handle();
unsafe
{
let success = SetConsoleScreenBufferSize(output_handle, size);
is_true(success)
}
}
pub fn fill_console_output_character(cells_written: &mut u32, start_location: COORD, cells_to_write: u32) -> bool
{
let output_handle = get_output_handle();
unsafe {
// fill the cells in console with blanks
let success = FillConsoleOutputCharacterA (
output_handle,
' ' as i8,
cells_to_write,
start_location,
cells_written,
);
is_true(success)
}
}
pub fn fill_console_output_attribute(cells_written: &mut u32, start_location: COORD, cells_to_write: u32) -> bool
{
// Get the position of the current console window
let csbi = get_console_screen_buffer_info();
let output_handle = get_output_handle();
let success;
unsafe {
success = FillConsoleOutputAttribute (
output_handle,
csbi.wAttributes,
cells_to_write,
start_location,
cells_written,
);
}
is_true(success)
}
/// Parse integer to an bool
fn is_true(value: i32) -> bool
{
if value == 0{
false
}
else{
true
}
}

View File

@ -1,7 +1,6 @@
pub mod cursor; pub mod cursor;
pub mod color; pub mod color;
pub mod ansi_support; pub mod ansi_support;
pub mod handle;
pub mod kernel; pub mod kernel;
pub mod terminal; pub mod terminal;
mod winapi_extentions; mod winapi_extentions;

View File

@ -1,8 +1,5 @@
use super::{cursor, handle, kernel}; use super::{cursor, kernel};
use winapi::um::wincon::{SMALL_RECT, COORD};
use winapi;
use winapi::shared::ntdef::TRUE;
use winapi::um::wincon::{SetConsoleWindowInfo,FillConsoleOutputCharacterA, FillConsoleOutputAttribute, COORD, CONSOLE_SCREEN_BUFFER_INFO};
/// Get the terminal size (y,x) /// Get the terminal size (y,x)
pub fn terminal_size() -> Option<(u16, u16)> { pub fn terminal_size() -> Option<(u16, u16)> {
@ -16,7 +13,6 @@ pub fn terminal_size() -> Option<(u16, u16)> {
/// Scroll down `n` rows /// Scroll down `n` rows
pub fn scroll_down(rows: i16) { pub fn scroll_down(rows: i16) {
let output_handle = handle::get_output_handle();
let csbi = kernel::get_console_screen_buffer_info(); let csbi = kernel::get_console_screen_buffer_info();
let mut srct_window; let mut srct_window;
@ -28,22 +24,16 @@ pub fn scroll_down(rows: i16) {
srct_window.Top += rows; // move top down srct_window.Top += rows; // move top down
srct_window.Bottom += rows; // move bottom down srct_window.Bottom += rows; // move bottom down
unsafe { let success = kernel::set_console_info(true, &mut srct_window);
if SetConsoleWindowInfo(output_handle, TRUE as i32, &mut srct_window) != 1 { if success {
panic!("Something whent wrong when scrolling down"); panic!("Something went wrong when scrolling down");
}
} }
} }
} }
pub fn clear_after_cursor() { pub fn clear_after_cursor() {
let output_handle = handle::get_output_handle();
let csbi = kernel::get_console_screen_buffer_info(); let csbi = kernel::get_console_screen_buffer_info();
let (mut x,mut y) = cursor::pos();
// one cell after cursor position
let mut x = cursor::xpos() as i16 ;
// one at row of cursor position
let mut y = cursor::ypos() as i16;
// if cursor position is at the outer right position // if cursor position is at the outer right position
if x > csbi.dwSize.X if x > csbi.dwSize.X
@ -53,16 +43,16 @@ pub fn clear_after_cursor() {
} }
// location where to start clearing // location where to start clearing
let start_loaction = COORD { X: x, Y: y }; let start_location = COORD { X: x, Y: y };
// get sum cells before cursor // get sum cells before cursor
let cells_to_write = csbi.dwSize.X as u32 * csbi.dwSize.Y as u32; let cells_to_write = csbi.dwSize.X as u32 * csbi.dwSize.Y as u32;
clear(output_handle, csbi, start_loaction,cells_to_write); clear(start_location,cells_to_write);
} }
pub fn clear_before_cursor() { pub fn clear_before_cursor() {
let output_handle = handle::get_output_handle();
let csbi = kernel::get_console_screen_buffer_info(); let csbi = kernel::get_console_screen_buffer_info();
let (xpos,ypos) = cursor::pos();
// one cell after cursor position // one cell after cursor position
let x = 0; let x = 0;
@ -70,30 +60,27 @@ pub fn clear_before_cursor() {
let y = 0; let y = 0;
// location where to start clearing // location where to start clearing
let start_loaction = COORD { X: x, Y: y }; let start_location = COORD { X: x, Y: y };
// get sum cells before cursor // get sum cells before cursor
let cells_to_write = (csbi.dwSize.X as u32 * cursor::ypos() as u32) + (cursor::xpos()) as u32; let cells_to_write = (csbi.dwSize.X as u32 * ypos as u32) + (xpos as u32 + 1);
// println!("{:?}", (csbi.dwSize.X as u32 * (cursor::ypos() - 1) as u32)); clear(start_location, cells_to_write);
clear(output_handle, csbi, start_loaction, cells_to_write);
} }
pub fn clear_entire_screen() { pub fn clear_entire_screen() {
let output_handle = handle::get_output_handle();
let csbi = kernel::get_console_screen_buffer_info(); let csbi = kernel::get_console_screen_buffer_info();
// position x at start // position x at start
let x = 0; let x = 0;
// position y at start // position y at start
let y = 0; let y = 0;
// location where to start clearing // location where to start clearing
let start_loaction = COORD { X: x, Y: y }; let start_location = COORD { X: x, Y: y };
// get sum cells before cursor // get sum cells before cursor
let cells_to_write = csbi.dwSize.X as u32 * csbi.dwSize.Y as u32; let cells_to_write = csbi.dwSize.X as u32 * csbi.dwSize.Y as u32;
clear(output_handle, csbi, start_loaction, cells_to_write); clear( start_location, cells_to_write);
// put the cursor back at (0, 0) // put the cursor back at (0, 0)
cursor::set(0, 0); cursor::set(0, 0);
@ -101,21 +88,19 @@ pub fn clear_entire_screen() {
pub fn clear_current_line() pub fn clear_current_line()
{ {
let output_handle = handle::get_output_handle();
let csbi = kernel::get_console_screen_buffer_info(); let csbi = kernel::get_console_screen_buffer_info();
// position x at start // position x at start
let x = 0; let x = 0;
// position y at start // position y at start
let y = cursor::ypos(); let y = cursor::pos().1;
// location where to start clearing // location where to start clearing
let start_loaction = COORD { X: x, Y: y }; let start_location = COORD { X: x, Y: y };
// get sum cells before cursor // get sum cells before cursor
let cells_to_write = csbi.dwSize.X as u32; let cells_to_write = csbi.dwSize.X as u32;
clear(output_handle, csbi, start_loaction, cells_to_write); clear(start_location, cells_to_write);
// put the cursor back at (0, 0) // put the cursor back at (0, 0)
cursor::set(x, y); cursor::set(x, y);
@ -123,62 +108,114 @@ pub fn clear_current_line()
pub fn clear_until_line() pub fn clear_until_line()
{ {
let output_handle = handle::get_output_handle();
let csbi = kernel::get_console_screen_buffer_info(); let csbi = kernel::get_console_screen_buffer_info();
let (x,y) = cursor::pos();
// position x at start
let x = cursor::xpos();
// position y at start
let y = cursor::ypos();
// location where to start clearing // location where to start clearing
let start_loaction = COORD { X: x -1, Y: y }; let start_location = COORD { X: x, Y: y };
// get sum cells before cursor // get sum cells before cursor
let cells_to_write = (csbi.dwSize.X - x) as u32 - 1; let cells_to_write = (csbi.dwSize.X - x) as u32;
clear(output_handle, csbi, start_loaction, cells_to_write); clear(start_location, cells_to_write);
// put the cursor back at (0, 0) // put the cursor back at (0, 0)
cursor::set(x, y); cursor::set(x, y);
} }
pub fn resize_terminal(width: i16, height: i16)
{
if width <= 0
{
panic!("Cannot set the terminal width lower than 1");
}
if height <= 0
{
panic!("Cannot set the terminal height lower then 1")
}
// Get the position of the current console window
let csbi = kernel::get_console_screen_buffer_info();
let mut success = false;
// If the buffer is smaller than this new window size, resize the
// buffer to be large enough. Include window position.
let mut resize_buffer = false;
let mut size = COORD { X: csbi.dwSize.X, Y: csbi.dwSize.Y };
if csbi.dwSize.X < csbi.srWindow.Left + width
{
if csbi.srWindow.Left >= i16::max_value() - width
{
panic!("Argument out of range when setting terminal width.");
}
size.X = csbi.srWindow.Left + width;
resize_buffer = true;
}
if csbi.dwSize.Y < csbi.srWindow.Top + height {
if csbi.srWindow.Top >= i16::max_value() - height
{
panic!("Argument out of range when setting terminal height");
}
size.Y = csbi.srWindow.Top + height;
resize_buffer = true;
}
if resize_buffer {
success = kernel::set_console_screen_buffer_size(size);
if !success
{
panic!("Something went wrong when setting screen buffer size.");
}
}
let mut fsr_window: SMALL_RECT = csbi.srWindow;
// Preserve the position, but change the size.
fsr_window.Bottom = fsr_window.Top + height;
fsr_window.Right = fsr_window.Left + width;
let success = kernel::set_console_info(true, &fsr_window);
if success {
// If we resized the buffer, un-resize it.
if resize_buffer {
kernel::set_console_screen_buffer_size(csbi.dwSize);
}
let bounds = kernel::get_largest_console_window_size();
if width > bounds.X
{
panic!("Argument width: {} out of range when setting terminal width.", width);
}
if height > bounds.Y
{
panic!("Argument height: {} out of range when setting terminal height", height);
}
}
}
fn clear( fn clear(
handle: winapi::um::winnt::HANDLE,
csbi: CONSOLE_SCREEN_BUFFER_INFO,
start_loaction: COORD, start_loaction: COORD,
cells_to_write: u32 cells_to_write: u32
) { ) {
let mut cells_written = 0; let mut cells_written = 0;
let mut success; let mut success = false;
unsafe { success = kernel::fill_console_output_character(&mut cells_written,start_loaction,cells_to_write);
// fill the cells in console with blanks
success = FillConsoleOutputCharacterA (
handle,
' ' as i8,
cells_to_write,
start_loaction,
&mut cells_written,
);
}
if success == 0 { if !success {
panic!("Couldnot clear screen after cursor"); panic!("Could not clear screen after cursor");
} }
cells_written = 0; cells_written = 0;
unsafe { success = kernel::fill_console_output_attribute(&mut cells_written,start_loaction, cells_to_write);
success = FillConsoleOutputAttribute (
handle,
csbi.wAttributes,
cells_to_write,
start_loaction,
&mut cells_written,
);
}
if success == 0 { if !success {
panic!("Couldnot reset attributes after cursor"); panic!("Couldnot reset attributes after cursor");
} }
} }

View File

@ -1,6 +1,7 @@
#[macro_use] #[macro_use]
mod shared; mod shared;
mod kernel; mod kernel;
pub mod crossterm_cursor; pub mod crossterm_cursor;
pub mod crossterm_style; pub mod crossterm_style;
pub mod crossterm_terminal; pub mod crossterm_terminal;

View File

@ -1,9 +0,0 @@
pub fn is_cursor_out_of_range(x: i16, y: i16) {
if x < 0 || x >= <i16>::max_value() {
panic!("Argument Out of Range Exception");
}
if y < 0 || y >= <i16>::max_value() {
panic!("Argument Out of Range Exception");
}
}

View File

@ -1,4 +1,3 @@
#[macro_use] #[macro_use]
pub mod macros; pub mod macros;
pub mod traits; pub mod traits;
pub mod functions;

View File

@ -6,7 +6,7 @@ pub trait Construct {
Self: Sized; Self: Sized;
} }
/// This trait is used to create an empty instance of an struct. /// This trait can be used to create an empty instance of an struct.
pub trait Empty { pub trait Empty {
fn empty() -> Self; fn empty() -> Self;
} }

View File

@ -1 +1,15 @@
Windows logic clear aan passen before after cursor Windows logic clear aan passen before after cursor
ideas:
https://apple.stackexchange.com/questions/33736/can-a-terminal-window-be-resized-with-a-terminal-command
new inplemented:
Safe and restore cursor
Resize terminal
Styling font with attributes
RGB color option added for unix
ANSI cutom color value input added for unix