Winapi upgrade, windows tested again edited readme

This commit is contained in:
T 2018-01-18 22:47:09 +01:00
parent 9c52cbca11
commit 39b63822ae
20 changed files with 649 additions and 200 deletions

View File

@ -1,7 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<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$/Cargo.toml" afterPath="$PROJECT_DIR$/Cargo.toml" />
<change beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
<change beforePath="$PROJECT_DIR$/examples/bin.rs" afterPath="$PROJECT_DIR$/examples/bin.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/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/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>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -10,19 +31,69 @@
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="bin.rs" pinned="false" current-in-tab="true">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="bin.rs" pinned="false" current-in-tab="false">
<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" />
<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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="12" lean-forward="false" selection-start-line="10" selection-start-column="12" selection-end-line="10" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
</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>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>color</find>
<find>termin</find>
<find>Coord</find>
<find>winapi</find>
<find>kernel32</find>
<find>HANDLE</find>
<find>CONSOLE_SCREEN_BUFFER_INFO</find>
<find>handleapi</find>
<find>terminal_cursor</find>
<find>terminal</find>
</findStrings>
<replaceStrings>
<replace>crossterm_cursor</replace>
</replaceStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
@ -34,6 +105,24 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<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/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/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/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$/examples/bin.rs" />
</list>
</option>
@ -45,10 +134,10 @@
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="2552" />
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1616" />
<option name="height" value="876" />
<option name="width" value="2576" />
<option name="height" value="1056" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
@ -65,10 +154,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scratches" />
<pane id="AndroidView" />
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -81,22 +166,21 @@
<item name="crossterm" type="462c0819:PsiDirectoryNode" />
<item name="examples" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="crossterm" type="b2602c69:ProjectViewProjectNode" />
<item name="crossterm" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scratches" />
<pane id="AndroidView" />
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.General" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../console" />
<property name="org.rust.cargo.project.model.PROJECT_DISCOVERY" value="true" />
</component>
<component name="RunDashboard">
@ -208,42 +292,43 @@
<option name="presentableId" value="Default" />
<updated>1513618274599</updated>
<workItem from="1513618275819" duration="650000" />
<workItem from="1516296788994" duration="11582000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="650000" />
<option name="totallyTimeSpent" value="12242000" />
</component>
<component name="ToolWindowManager">
<frame x="2552" y="-8" width="1616" height="876" extended-state="6" />
<frame x="-8" y="-8" width="2576" height="1056" extended-state="6" />
<editor active="true" />
<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="-1" 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="Cargo" 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="-1" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" 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="-1" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" 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="-1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" 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="-1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" 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="-1" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" 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="-1" side_tool="false" content_ui="tabs" />
<window_info id="Cargo" 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&#9;" 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="Image Layers" 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 Analysis" 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="Event Log" 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="true" content_ui="tabs" />
<window_info id="Maven Projects" 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="Run" 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="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" 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="-1" 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="-1" 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="-1" 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="-1" 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.25" 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="-1" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" 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="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="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="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="-1" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" 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="-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="Theme Preview" 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="Debug" 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="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" 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="-1" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" 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="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" 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="Message" 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="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="Find" 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="1" 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="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" />
</layout>
</component>
@ -258,7 +343,15 @@
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/examples/term_cursor_example/mod.rs">
<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" />
@ -266,6 +359,74 @@
</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/bin.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@ -274,6 +435,309 @@
</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/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/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$/examples/term_cursor_example/mod.rs" />
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/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" />
<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">
<provider selected="true" editor-type-id="text-editor">
<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" />
<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>
</provider>
</entry>
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.4/src/shared/ntdef.rs">
<provider selected="true" editor-type-id="text-editor">
<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" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.4/src/um/winnt.rs">
<provider selected="true" editor-type-id="text-editor">
<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" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/kernel32-sys-0.2.2/src/lib.rs">
<provider selected="true" editor-type-id="text-editor">
<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" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.4/src/um/processenv.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://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.4/src/um/winbase.rs">
<provider selected="true" editor-type-id="text-editor">
<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" />
<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>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/lib.rs">
<provider selected="true" editor-type-id="text-editor">
<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" />
<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>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/crossterm_cursor/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" />
<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="0">
<caret line="0" column="30" lean-forward="false" selection-start-line="0" selection-start-column="30" selection-end-line="0" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/cursor/mod.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="952">
<caret line="59" column="18" lean-forward="false" selection-start-line="59" selection-start-column="18" selection-end-line="59" selection-end-column="18" />
<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>
</provider>
</entry>
<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>
<entry file="file://$PROJECT_DIR$/Cargo.toml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="12" lean-forward="false" selection-start-line="10" selection-start-column="12" selection-end-line="10" selection-end-column="12" />
<folding />
</state>
</provider>
</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 name="masterDetails">
<states>

View File

@ -5,10 +5,10 @@ authors = ["T <timonpost@hotmail.nl>"]
[dependencies]
[target.'cfg(windows)'.dependencies]
winapi = "0.2.8"
kernel32-sys = "0.2.1"
winapi = { version = "0.3", features = ["winbase","winuser","consoleapi","processenv","wincon", "handleapi"] }
[target.'cfg(unix)'.dependencies]
libc = "0.2"

View File

@ -17,7 +17,7 @@ crossterm = "*"
Add the crate to your solution.
And use the crossterm modules withs you want to use.
```
```rust
extern crate crossterm;
// this module is used for styling the terminal
@ -30,15 +30,15 @@ use self::crossterm::crossterm_terminal::*;
```
## Documentation
Documentation for the code can be found here ...
Documentation for the code can be found [here](https://atcentra.com/crossterm/index.html)
## Examples
For detailed examples of all crossterm functionalities check the `./examples/` direcory.
For detailed examples of all crossterm functionalities check the [examples](https://github.com/TimonPost/crossterm/tree/master/examples) direcory.
### Styled font
```rust
use crossterm_style::{paint, Color};
use crossterm::crossterm_style::{paint, Color};
// Crossterm provides method chaining so that you can style the font nicely.
// You can either store the styled font.
@ -52,57 +52,58 @@ For detailed examples of all crossterm functionalities check the `./examples/` d
```
### Cursor
```rust
use crossterm_cursor::get;
let mut cursor = get();
use crossterm::crossterm_cursor::get;
// Set the cursor to position X: 10, Y: 5 in the terminal
cursor.goto(10,5);
let mut cursor = get();
// Move the cursor to position 3 times to the up in the terminal
cursor.move_up(3)
// Set the cursor to position X: 10, Y: 5 in the terminal
cursor.goto(10,5);
// Move the cursor to position 3 times to the up in the terminal
cursor.move_up(3);
// Move the cursor to position 3 times to the right in the terminal
cursor.move_right(3);
cursor.move_right(3);
// Move the cursor to position 3 times to the down in the terminal
cursor.move_down(3);
// Move the cursor to position 3 times to the down in the terminal
cursor.move_down(3);
// Move the cursor to position 3 times to the left in the terminal
cursor.move_left(3);
cursor.move_left(3);
// Print an character at X: 10, Y: 5 (see examples for more explanation why to use this method).
cursor.goto(10,5).print("@");
// Print an character at X: 10, Y: 5 (see examples for more explanation why to use this method).
// cursor.goto(10,5).print("@");
```
### Terminal
```rust
use crossterm_terminal::{get,ClearType};
use crossterm::crossterm_terminal::{get,ClearType};
let mut cursor = get();
let mut cursor = get();
// Clear all lines in terminal;
terminal.clear(ClearType::All);
// Clear all cells from current cursor position down.
terminal.clear(ClearType::FromCursorDown);
// Clear all cells from current cursor position down.
terminal.clear(ClearType::FromCursorUp);
// Clear current line cells.
terminal.clear(ClearType::CurrentLine);
// Clear all the cells until next line.
terminal.clear(ClearType::UntilNewLine);
// Clear all lines in terminal;
terminal.clear(ClearType::All);
// Clear all cells from current cursor position down.
terminal.clear(ClearType::FromCursorDown);
// Clear all cells from current cursor position down.
terminal.clear(ClearType::FromCursorUp);
// Clear current line cells.
terminal.clear(ClearType::CurrentLine);
// Clear all the cells until next line.
terminal.clear(ClearType::UntilNewLine);
// Get terminal size
let terminal_size = terminal.terminal_size().unwrap();
// Print results
print!("X: {}, y: {}", terminal_size.0, terminal_size.1);
// Get terminal size
let terminal_size = terminal.terminal_size().unwrap();
// Print results
print!("X: {}, y: {}", terminal_size.0, terminal_size.1);
// Scroll down 10 lines.
terminal.scroll_down(10);
// Scroll down 10 lines.
terminal.scroll_down(10);
// Scroll up 10 lines.
terminal.scroll_up(10);
// Scroll up 10 lines.
terminal.scroll_up(10);
```
## Features crossterm 0.1
@ -138,7 +139,7 @@ If you have used this library for an terminal other than the above list without
## Notice
This library is not totally stable **yet**. There will not be changed mutch in the code design so do not worry to mutch. If there are any changes that affect previous versions I will describe what to change when upgrading crossterm to new version.
## Todo crossterm 0.2
## Todo features crossterm 0.2
- Handling mouse events
- Inplementing 256 colors for terminals that support those colors.

View File

@ -1,7 +1,7 @@
extern crate crossterm;
use self::crossterm::crossterm_style::*;
use self::crossterm::crossterm_cursor::*;
use self::crossterm::crossterm_cursor;
use self::crossterm::crossterm_terminal::*;
use std::io::{stdin, stdout, Write};
@ -12,7 +12,4 @@ pub mod terminal;
fn main() {
terminal_cursor::get().goto(5,5);
println!();
}

View File

@ -5,7 +5,7 @@
extern crate crossterm;
use crossterm::crossterm_terminal::{get, Terminal, ClearType};
use crossterm::terminal_cursor;
use crossterm::crossterm_cursor;
fn print_test_data()
{
@ -35,7 +35,7 @@ pub fn clear_from_cursor_down()
print_test_data();
// Set terminal cursor position (see example for more info).
terminal_cursor::get().goto(4,4);
crossterm_cursor::get().goto(4,8);
// Clear all cells from current cursor position down.
terminal.clear(ClearType::FromCursorDown);
@ -50,7 +50,7 @@ pub fn clear_from_cursor_up()
print_test_data();
// Set terminal cursor position (see example for more info).
terminal_cursor::get().goto(4,4);
crossterm_cursor::get().goto(4,8);
// Clear all cells from current cursor position down.
terminal.clear(ClearType::FromCursorUp);
@ -65,7 +65,7 @@ pub fn clear_current_line()
print_test_data();
// Set terminal cursor position (see example for more info).
terminal_cursor::get().goto(4,4);
crossterm_cursor::get().goto(4,4);
// Clear current line cells.
terminal.clear(ClearType::CurrentLine);
@ -80,7 +80,7 @@ pub fn clear_until_new_line()
print_test_data();
// Set terminal cursor position (see example for more info).
terminal_cursor::get().goto(4,4);
crossterm_cursor::get().goto(4,4);
// Clear all the cells until next line.
terminal.clear(ClearType::UntilNewLine);

View File

@ -103,6 +103,7 @@ impl TerminalCursor {
///
/// use self::crossterm::crossterm_cursor;
///
///
/// // move 1 time right
/// crossterm_cursor::get().move_right(1);
///

View File

@ -3,13 +3,11 @@ use kernel::windows_kernel::cursor;
use super::base_cursor::ITerminalCursor;
/// This struct is an windows implementation for cursor related actions.
pub struct WinApiCursor {
has_moved: bool,
}
pub struct WinApiCursor;
impl Construct for WinApiCursor {
fn new() -> Box<WinApiCursor> {
Box::from(WinApiCursor { has_moved: false })
Box::from(WinApiCursor { })
}
}

View File

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

View File

@ -1,6 +1,7 @@
use Construct;
use super::color::{Color, ColorType};
use super::color::{ColorType, Color};
use super::base_color::ITerminalColor;
use kernel::windows_kernel;
/// This struct is an windows implementation for color related actions.
#[derive(Debug)]
@ -11,7 +12,7 @@ pub struct WinApiColor {
impl Construct for WinApiColor {
fn new() -> Box<WinApiColor> {
Box::from(WinApiColor {
original_console_color: kernel::get_original_console_color(),
original_console_color: windows_kernel::kernel::get_original_console_color(),
})
}
}
@ -19,19 +20,19 @@ impl Construct for WinApiColor {
impl ITerminalColor for WinApiColor {
fn set_fg(&self, fg_color: Color) {
let color_value = &self.color_value(fg_color, ColorType::Foreground);
color::set_fg_color(color_value.parse().unwrap());
windows_kernel::color::set_fg_color(color_value.parse().unwrap());
}
fn set_bg(&self, bg_color: Color) {
let color_value = &self.color_value(bg_color, ColorType::Background);
color::set_bg_color(color_value.parse().unwrap());
windows_kernel::color::set_bg_color(color_value.parse().unwrap());
}
fn reset(&self) {
color::reset(self.original_console_color);
windows_kernel::color::reset(self.original_console_color);
}
fn color_value(&self, color: Color, color_type: ColorType) -> String {
color::winapi_color_val(color, color_type).to_string()
windows_kernel::color::winapi_color_val(color, color_type).to_string()
}
}

View File

@ -32,7 +32,7 @@ impl ITerminal for WinApiTerminal {
// yet to be inplemented
}
fn scroll_down(&self, count: u16) {
fn scroll_down(&self, count: i16) {
terminal::scroll_down(count as i16);
}
}

View File

@ -1,5 +1,6 @@
use winapi;
use kernel32;
use winapi::shared::ntdef::HANDLE;
use winapi::um::consoleapi::SetConsoleMode;
use super::handle;
/// Enables ansi for windows terminals.
@ -10,9 +11,8 @@ pub fn enable_ansi_support() {
}
/// Set the console mode of the windows terminal.
fn set_console_mode(handle: winapi::HANDLE, console_mode: u32) {
fn set_console_mode(handle: HANDLE, console_mode: u32) {
unsafe {
winapi::SW_HIDE;
kernel32::SetConsoleMode(handle, console_mode);
SetConsoleMode(handle, console_mode);
}
}

View File

@ -1,7 +1,8 @@
use winapi;
use kernel32;
use winapi::um::wincon;
use super::{handle, kernel};
use terminal_style as style;
use crossterm_style as style;
use winapi::um::wincon::{SetConsoleTextAttribute};
/// This will set the forground color by the given winapi color value parsed to u16.
pub fn set_fg_color(fg_color: u16) {
@ -16,8 +17,8 @@ pub fn set_fg_color(fg_color: u16) {
// background intensity is a seperate value in attrs,
// wee need to check if this was applied to the current bg color.
if (attrs & winapi::BACKGROUND_INTENSITY as u16) != 0 {
color = color | winapi::BACKGROUND_INTENSITY as u16;
if (attrs & wincon::BACKGROUND_INTENSITY as u16) != 0 {
color = color | wincon::BACKGROUND_INTENSITY as u16;
}
set_console_text_attribute(color);
@ -35,8 +36,8 @@ pub fn set_bg_color(bg_color: u16) {
// foreground intensity is a seperate value in attrs,
// wee need to check if this was applied to the current fg color.
if (attrs & winapi::FOREGROUND_INTENSITY as u16) != 0 {
color = color | winapi::FOREGROUND_INTENSITY as u16;
if (attrs & wincon::FOREGROUND_INTENSITY as u16) != 0 {
color = color | wincon::FOREGROUND_INTENSITY as u16;
}
set_console_text_attribute(color);
@ -49,19 +50,19 @@ pub fn reset(original_color: u16) {
/// This will get the winapi color value from the Color struct
pub fn winapi_color_val(color: style::Color, color_type: style::ColorType) -> u16 {
use terminal_style::{Color, ColorType};
use crossterm_style::{Color, ColorType};
let winapi_color: u32;
let winapi_color: u16;
let fg_green = winapi::FOREGROUND_GREEN;
let fg_red = winapi::FOREGROUND_RED;
let fg_blue = winapi::FOREGROUND_BLUE;
let fg_intensity = winapi::FOREGROUND_INTENSITY;
let fg_green = wincon::FOREGROUND_GREEN;
let fg_red = wincon::FOREGROUND_RED;
let fg_blue = wincon::FOREGROUND_BLUE;
let fg_intensity = wincon::FOREGROUND_INTENSITY;
let bg_green = winapi::BACKGROUND_GREEN;
let bg_red = winapi::BACKGROUND_RED;
let bg_blue = winapi::BACKGROUND_BLUE;
let bg_intensity = winapi::BACKGROUND_INTENSITY;
let bg_green = wincon::BACKGROUND_GREEN;
let bg_red = wincon::BACKGROUND_RED;
let bg_blue = wincon::BACKGROUND_BLUE;
let bg_intensity = wincon::BACKGROUND_INTENSITY;
match color_type {
ColorType::Foreground => {
@ -112,6 +113,6 @@ fn set_console_text_attribute(value: u16) {
let output_handle = handle::get_output_handle();
unsafe {
kernel32::SetConsoleTextAttribute(output_handle, value);
SetConsoleTextAttribute(output_handle, value);
}
}

View File

@ -1,16 +1,9 @@
use winapi;
use kernel32;
use winapi::um::wincon::COORD;
use super::{handle, kernel};
use shared::functions;
/// These are the movement directions of an cursor
#[derive(Debug)]
pub enum CursorDirection {
Top,
Right,
Down,
Left,
}
use winapi::um::wincon::{SetConsoleCursorPosition};
/// Set the cursor position to an coordinate (x,y).
pub fn set(x: i16, y: i16) {
@ -33,9 +26,9 @@ pub fn move_down(count: u16) {
let csbi = kernel::get_console_screen_buffer_info();
unsafe {
let output_handle = handle::get_output_handle();
kernel32::SetConsoleCursorPosition(
SetConsoleCursorPosition(
output_handle,
winapi::COORD {
COORD {
X: csbi.dwCursorPosition.X,
Y: csbi.dwCursorPosition.Y + count as i16,
},
@ -48,10 +41,10 @@ fn set_cursor_pos(x: i16, y: i16) {
functions::is_cursor_out_of_range(x, y);
let output_handle = handle::get_output_handle();
let position = winapi::COORD { X: x, Y: y };
let position = COORD { X: x, Y: y };
unsafe {
let success = kernel32::SetConsoleCursorPosition(output_handle, position);
let success = SetConsoleCursorPosition(output_handle, position);
if success == 0 {
panic!("Cannot set console cursor position");

View File

@ -1,16 +1,19 @@
use winapi;
use kernel32;
use winapi::um::winnt;
use winapi::um::winbase;
use winapi::um::handleapi;
// static mut CONSOLE_INPUT_HANDLE:Option<winapi::HANDLE> = None;
static mut CONSOLE_OUTPUT_HANDLE: Option<winapi::HANDLE> = None;
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() -> winapi::HANDLE {
pub fn get_output_handle() -> winnt::HANDLE {
unsafe {
if let Some(handle) = CONSOLE_OUTPUT_HANDLE {
handle
} else {
let handle = kernel32::GetStdHandle(winapi::STD_OUTPUT_HANDLE);
let handle = GetStdHandle(winbase::STD_OUTPUT_HANDLE);
CONSOLE_OUTPUT_HANDLE = Some(handle);
handle
}
@ -18,10 +21,11 @@ pub fn get_output_handle() -> winapi::HANDLE {
}
/// Checks if the console handle is an invalid handle value.
pub fn is_valid_handle(handle: &winapi::HANDLE) -> bool {
if *handle == winapi::INVALID_HANDLE_VALUE {
pub fn is_valid_handle(handle: &winnt::HANDLE) -> bool {
if *handle == handleapi::INVALID_HANDLE_VALUE {
true
} else {
false
}
}

View File

@ -1,18 +1,17 @@
use winapi;
use kernel32;
use winapi::um::wincon::{GetConsoleScreenBufferInfo,CONSOLE_SCREEN_BUFFER_INFO};
use super::{handle, Empty};
/// Get console screen buffer info.
pub fn get_console_screen_buffer_info() -> winapi::CONSOLE_SCREEN_BUFFER_INFO {
pub fn get_console_screen_buffer_info() -> CONSOLE_SCREEN_BUFFER_INFO {
let output_handle = handle::get_output_handle();
let mut csbi = winapi::CONSOLE_SCREEN_BUFFER_INFO::empty();
let mut csbi = CONSOLE_SCREEN_BUFFER_INFO::empty();
let success;
if handle::is_valid_handle(&output_handle) {
return winapi::CONSOLE_SCREEN_BUFFER_INFO::empty();
return CONSOLE_SCREEN_BUFFER_INFO::empty();
}
unsafe { success = kernel32::GetConsoleScreenBufferInfo(output_handle, &mut csbi) }
unsafe { success = GetConsoleScreenBufferInfo(output_handle, &mut csbi) }
if success == 0 {
panic!("Cannot get console screen buffer info");

View File

@ -1,6 +1,8 @@
use super::{cursor, handle, kernel};
use winapi;
use kernel32;
use super::{cursor, handle, kernel, Empty};
use winapi::shared::ntdef::TRUE;
use winapi::um::wincon::{SetConsoleWindowInfo,FillConsoleOutputCharacterA, FillConsoleOutputAttribute, COORD, CONSOLE_SCREEN_BUFFER_INFO};
/// Get the terminal size (y,x)
pub fn terminal_size() -> Option<(u16, u16)> {
@ -27,7 +29,7 @@ pub fn scroll_down(rows: i16) {
srct_window.Bottom += rows; // move bottom down
unsafe {
if kernel32::SetConsoleWindowInfo(output_handle, winapi::TRUE, &mut srct_window) != 1 {
if SetConsoleWindowInfo(output_handle, TRUE as i32, &mut srct_window) != 1 {
panic!("Something whent wrong when scrolling down");
}
}
@ -39,7 +41,7 @@ pub fn clear_after_cursor() {
let csbi = kernel::get_console_screen_buffer_info();
// one cell after cursor position
let mut x = cursor::xpos() as i16 + 1;
let mut x = cursor::xpos() as i16 ;
// one at row of cursor position
let mut y = cursor::ypos() as i16;
@ -51,7 +53,7 @@ pub fn clear_after_cursor() {
}
// location where to start clearing
let start_loaction = winapi::COORD { X: x, Y: y };
let start_loaction = COORD { X: x, Y: y };
// get sum cells before cursor
let cells_to_write = csbi.dwSize.X as u32 * csbi.dwSize.Y as u32;
@ -68,9 +70,9 @@ pub fn clear_before_cursor() {
let y = 0;
// location where to start clearing
let start_loaction = winapi::COORD { X: x, Y: y };
let start_loaction = COORD { X: x, Y: y };
// get sum cells before cursor
let cells_to_write = (csbi.dwSize.X as u32 * cursor::ypos() as u32) + (cursor::xpos() -1) as u32;
let cells_to_write = (csbi.dwSize.X as u32 * cursor::ypos() as u32) + (cursor::xpos()) as u32;
// println!("{:?}", (csbi.dwSize.X as u32 * (cursor::ypos() - 1) as u32));
clear(output_handle, csbi, start_loaction, cells_to_write);
@ -86,7 +88,7 @@ pub fn clear_entire_screen() {
let y = 0;
// location where to start clearing
let start_loaction = winapi::COORD { X: x, Y: y };
let start_loaction = COORD { X: x, Y: y };
// get sum cells before cursor
let cells_to_write = csbi.dwSize.X as u32 * csbi.dwSize.Y as u32;
@ -108,7 +110,7 @@ pub fn clear_current_line()
let y = cursor::ypos();
// location where to start clearing
let start_loaction = winapi::COORD { X: x, Y: y };
let start_loaction = COORD { X: x, Y: y };
// get sum cells before cursor
let cells_to_write = csbi.dwSize.X as u32;
@ -130,28 +132,28 @@ pub fn clear_until_line()
let y = cursor::ypos();
// location where to start clearing
let start_loaction = winapi::COORD { X: x -1, Y: y };
let start_loaction = COORD { X: x -1, Y: y };
// get sum cells before cursor
let cells_to_write = (csbi.dwSize.X - x) as u32 - 1;
clear(output_handle, csbi, start_loaction, cells_to_write);
print!("{:?}",start_loaction);
// put the cursor back at (0, 0)
cursor::set(x, y);
}
fn clear(
handle: winapi::HANDLE,
csbi: winapi::CONSOLE_SCREEN_BUFFER_INFO,
start_loaction: winapi::COORD,
handle: winapi::um::winnt::HANDLE,
csbi: CONSOLE_SCREEN_BUFFER_INFO,
start_loaction: COORD,
cells_to_write: u32
) {
let mut cells_written = 0;
let mut success;
unsafe {
// fill the cetain cells in console with blanks
success = kernel32::FillConsoleOutputCharacterA(
// fill the cells in console with blanks
success = FillConsoleOutputCharacterA (
handle,
' ' as i8,
cells_to_write,
@ -167,7 +169,7 @@ fn clear(
cells_written = 0;
unsafe {
success = kernel32::FillConsoleOutputAttribute(
success = FillConsoleOutputAttribute (
handle,
csbi.wAttributes,
cells_to_write,

View File

@ -1,15 +1,15 @@
use winapi;
use winapi::um::wincon::{COORD, CONSOLE_SCREEN_BUFFER_INFO, SMALL_RECT};
use super::Empty;
impl Empty for winapi::COORD {
fn empty() -> winapi::COORD {
winapi::COORD { X: 0, Y: 0 }
impl Empty for COORD {
fn empty() -> COORD {
COORD { X: 0, Y: 0 }
}
}
impl Empty for winapi::SMALL_RECT {
fn empty() -> winapi::SMALL_RECT {
winapi::SMALL_RECT {
impl Empty for SMALL_RECT {
fn empty() -> SMALL_RECT {
SMALL_RECT {
Top: 0,
Right: 0,
Bottom: 0,
@ -18,14 +18,14 @@ impl Empty for winapi::SMALL_RECT {
}
}
impl Empty for winapi::CONSOLE_SCREEN_BUFFER_INFO {
fn empty() -> winapi::CONSOLE_SCREEN_BUFFER_INFO {
winapi::CONSOLE_SCREEN_BUFFER_INFO {
dwSize: winapi::COORD::empty(),
dwCursorPosition: winapi::COORD::empty(),
impl Empty for CONSOLE_SCREEN_BUFFER_INFO {
fn empty() -> CONSOLE_SCREEN_BUFFER_INFO {
CONSOLE_SCREEN_BUFFER_INFO {
dwSize: COORD::empty(),
dwCursorPosition: COORD::empty(),
wAttributes: 0,
srWindow: winapi::SMALL_RECT::empty(),
dwMaximumWindowSize: winapi::COORD::empty(),
srWindow: SMALL_RECT::empty(),
dwMaximumWindowSize: COORD::empty(),
}
}
}

View File

@ -5,10 +5,8 @@ pub mod crossterm_cursor;
pub mod crossterm_style;
pub mod crossterm_terminal;
use shared::traits::{Construct, Empty};
use shared::traits::{Construct};
#[cfg(windows)]
extern crate kernel32;
#[cfg(windows)]
extern crate winapi;
#[cfg(unix)]

View File

@ -1,8 +0,0 @@
/// Contains directions that can be used for diffrent reasons.
#[derive(Debug)]
pub enum Direction {
Up,
Down,
Left,
Right,
}

View File

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