Alternate screen windows working. Only have to change the code to call get_current_handle() instead of get_output_hanlde()
This commit is contained in:
parent
7544578122
commit
621d698ac6
@ -3,12 +3,9 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="310aeab2-4737-4e8e-b7eb-0aac10d104a3" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs" beforeDir="false" afterPath="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/manager/manager.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/manager/manager.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/shared/screen.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/shared/screen.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/manager/win_manager.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/manager/win_manager.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/state/commands/win_commands.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/state/commands/win_commands.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/style/styles/styledobject.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/style/styles/styledobject.rs" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
@ -19,11 +16,15 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="manager.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/manager.rs">
|
||||
<file leaf-file-name="win_manager.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/win_manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="434">
|
||||
<caret line="30" column="64" selection-start-line="30" selection-start-column="64" selection-end-line="30" selection-end-column="64" />
|
||||
<state relative-caret-position="672">
|
||||
<caret line="63" column="21" selection-start-line="63" selection-start-column="11" selection-end-line="63" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="e#1321#1322#0" expanded="true" />
|
||||
<element signature="e#1377#1378#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -37,20 +38,11 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="win_manager.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/win_manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="391">
|
||||
<caret line="26" selection-start-line="26" selection-end-line="26" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="kernel.rs" pinned="false" current-in-tab="false">
|
||||
<file leaf-file-name="kernel.rs" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="663">
|
||||
<caret line="39" column="1" selection-start-line="39" selection-start-column="1" selection-end-line="39" selection-end-column="1" />
|
||||
<state relative-caret-position="612">
|
||||
<caret line="36" column="32" lean-forward="true" selection-start-line="36" selection-start-column="32" selection-end-line="36" selection-end-column="32" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -78,11 +70,20 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="alternate_screen.rs" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="alternate_screen.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/alternate_screen.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="485">
|
||||
<caret line="59" column="1" selection-start-line="59" selection-start-column="1" selection-end-line="59" selection-end-column="1" />
|
||||
<state relative-caret-position="638">
|
||||
<caret line="74" column="52" selection-start-line="74" selection-start-column="52" selection-end-line="74" selection-end-column="52" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="unix_command.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/unix_command.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="600">
|
||||
<caret line="40" column="9" selection-start-line="40" selection-start-column="9" selection-end-line="40" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -90,8 +91,8 @@
|
||||
<file leaf-file-name="win_commands.rs" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/win_commands.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="722">
|
||||
<caret line="219" column="10" lean-forward="true" selection-start-line="219" selection-start-column="10" selection-end-line="219" selection-end-column="10" />
|
||||
<state relative-caret-position="424">
|
||||
<caret line="193" column="10" selection-start-line="187" selection-start-column="7" selection-end-line="193" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -116,8 +117,6 @@
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>ScreenManager</find>
|
||||
<find>color</find>
|
||||
<find>cursor(</find>
|
||||
<find>IStateCommand</find>
|
||||
<find>execute</find>
|
||||
@ -146,6 +145,8 @@
|
||||
<find>WinApiScreenManager</find>
|
||||
<find>color(</find>
|
||||
<find>d</find>
|
||||
<find>srct_read_rect</find>
|
||||
<find>get_output_handle();</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>crossterm_cursor</replace>
|
||||
@ -213,13 +214,13 @@
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/alternate_screen.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/terminal.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/cursor/mod.rs" />
|
||||
<option value="$PROJECT_DIR$/src/manager/win_manager.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/commands/win_commands.rs" />
|
||||
<option value="$PROJECT_DIR$/src/manager/manager.rs" />
|
||||
<option value="$PROJECT_DIR$/src/shared/screen.rs" />
|
||||
<option value="$PROJECT_DIR$/src/style/styles/styledobject.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" />
|
||||
<option value="$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs" />
|
||||
<option value="$PROJECT_DIR$/src/state/commands/win_commands.rs" />
|
||||
<option value="$PROJECT_DIR$/src/manager/win_manager.rs" />
|
||||
<option value="$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@ -559,12 +560,12 @@
|
||||
<workItem from="1529689699529" duration="6745000" />
|
||||
<workItem from="1529741655974" duration="14906000" />
|
||||
<workItem from="1530030893916" duration="6941000" />
|
||||
<workItem from="1530039628703" duration="1642000" />
|
||||
<workItem from="1530039628703" duration="4296000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="621485000" />
|
||||
<option name="totallyTimeSpent" value="624139000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="2576" height="1056" extended-state="6" />
|
||||
@ -586,6 +587,7 @@
|
||||
<window_info id="Designer" order="3" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.1625" />
|
||||
<window_info anchor="right" id="Database" order="6" />
|
||||
<window_info anchor="bottom" id="Find" order="1" sideWeight="0.496875" weight="0.20828906" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info id="UI Designer" order="4" />
|
||||
@ -597,7 +599,6 @@
|
||||
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Find" order="1" sideWeight="0.496875" visible="true" weight="0.20828906" />
|
||||
</layout>
|
||||
<layout-to-restore>
|
||||
<window_info anchor="right" id="Palette" order="3" />
|
||||
@ -775,17 +776,14 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/unix_command.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="600">
|
||||
<caret line="40" column="9" selection-start-line="40" selection-start-column="9" selection-end-line="40" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/style/color/color.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="788">
|
||||
<caret line="129" column="7" selection-start-line="129" selection-start-column="7" selection-end-line="129" selection-end-column="7" />
|
||||
<folding>
|
||||
<element signature="e#3841#3842#0" expanded="true" />
|
||||
<element signature="e#3886#3887#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -814,6 +812,10 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="886">
|
||||
<caret line="62" column="31" selection-start-line="62" selection-start-column="31" selection-end-line="62" selection-end-column="31" />
|
||||
<folding>
|
||||
<element signature="e#500#501#0" expanded="true" />
|
||||
<element signature="e#522#523#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -835,6 +837,10 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="541">
|
||||
<caret line="129" column="45" selection-start-line="129" selection-start-column="45" selection-end-line="129" selection-end-column="45" />
|
||||
<folding>
|
||||
<element signature="e#3437#3438#0" expanded="true" />
|
||||
<element signature="e#3468#3469#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -842,6 +848,10 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="12" column="1" selection-start-line="12" selection-start-column="1" selection-end-line="12" selection-end-column="1" />
|
||||
<folding>
|
||||
<element signature="e#276#277#0" expanded="true" />
|
||||
<element signature="e#307#308#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -887,13 +897,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/win_manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="391">
|
||||
<caret line="26" selection-start-line="26" selection-end-line="26" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="434">
|
||||
@ -922,23 +925,9 @@
|
||||
</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="39" column="1" selection-start-line="39" selection-start-column="1" selection-end-line="39" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/mod.rs">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/win_commands.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="722">
|
||||
<caret line="219" column="10" lean-forward="true" selection-start-line="219" selection-start-column="10" selection-end-line="219" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="629">
|
||||
@ -948,8 +937,40 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/Crossterm 0.2.2 - New Version (Not finished)/terminal/alternate_screen.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="485">
|
||||
<caret line="59" column="1" selection-start-line="59" selection-start-column="1" selection-end-line="59" selection-end-column="1" />
|
||||
<state relative-caret-position="638">
|
||||
<caret line="74" column="52" selection-start-line="74" selection-start-column="52" selection-end-line="74" selection-end-column="52" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/unix_command.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="600">
|
||||
<caret line="40" column="9" selection-start-line="40" selection-start-column="9" selection-end-line="40" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/state/commands/win_commands.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="424">
|
||||
<caret line="193" column="10" selection-start-line="187" selection-start-column="7" selection-end-line="193" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/manager/win_manager.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="672">
|
||||
<caret line="63" column="21" selection-start-line="63" selection-start-column="11" selection-end-line="63" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="e#1321#1322#0" expanded="true" />
|
||||
<element signature="e#1377#1378#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kernel/windows_kernel/kernel.rs">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="612">
|
||||
<caret line="36" column="32" lean-forward="true" selection-start-line="36" selection-start-column="32" selection-end-line="36" selection-end-column="32" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -1,4 +1,8 @@
|
||||
//! This module is the core of all the `WINAPI` actions. All unsafe `WINAPI` function call are done here.
|
||||
use Context;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
||||
use winapi::um::winnt::HANDLE;
|
||||
use winapi::um::winbase::{STD_OUTPUT_HANDLE, STD_INPUT_HANDLE };
|
||||
use winapi::um::handleapi::INVALID_HANDLE_VALUE;
|
||||
@ -20,6 +24,21 @@ use super::{Empty};
|
||||
static mut CONSOLE_OUTPUT_HANDLE: Option<HANDLE> = None;
|
||||
static mut CONSOLE_INPUT_HANDLE: Option<HANDLE> = None;
|
||||
|
||||
|
||||
pub fn get_current_handle(context: Rc<Context>) -> Rc<HANDLE>
|
||||
{
|
||||
let mut screen_manager = context.screen_manager.lock().unwrap();
|
||||
use super::super::super::manager::WinApiScreenManager;
|
||||
let b: &mut WinApiScreenManager = match screen_manager.as_any().downcast_mut::<WinApiScreenManager>() {
|
||||
Some(b) => { b },
|
||||
None => panic!("")
|
||||
};
|
||||
|
||||
let handle = b.get_handle();
|
||||
|
||||
return handle.clone()
|
||||
}
|
||||
|
||||
/// Get the std_output_handle of the console
|
||||
pub fn get_output_handle() -> HANDLE {
|
||||
unsafe {
|
||||
|
@ -4,6 +4,7 @@ use winapi::um::winnt::HANDLE;
|
||||
|
||||
use std::io::{self,Write};
|
||||
use std::any::Any;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct WinApiScreenManager
|
||||
{
|
||||
@ -59,4 +60,15 @@ impl WinApiScreenManager {
|
||||
{
|
||||
self.alternate_handle = alternate_handle;
|
||||
}
|
||||
|
||||
pub fn get_handle(&mut self) -> Rc<HANDLE>
|
||||
{
|
||||
if self.is_alternate_screen
|
||||
{
|
||||
return Rc::from(self.alternate_handle);
|
||||
}
|
||||
else {
|
||||
return Rc::from(self.output);
|
||||
}
|
||||
}
|
||||
}
|
@ -195,45 +195,6 @@ impl IStateCommand for ToAlternateScreenBufferCommand
|
||||
|
||||
b.set_alternate_handle(new_handle);
|
||||
|
||||
// Set the source rectangle.
|
||||
let mut srct_read_rect = SMALL_RECT
|
||||
{
|
||||
Top: 0,
|
||||
Left: 0 ,
|
||||
Bottom: 1,
|
||||
Right: 79,
|
||||
};
|
||||
|
||||
// The temporary buffer size is 2 rows x 80 columns.
|
||||
let coord_buffer_size = COORD
|
||||
{
|
||||
X: 2,
|
||||
Y: 80
|
||||
};
|
||||
|
||||
// The top left destination cell of the temporary buffer is
|
||||
// row 0, col 0.
|
||||
let coord_buffer_coord = COORD
|
||||
{
|
||||
X: 0,
|
||||
Y: 0,
|
||||
};
|
||||
|
||||
// Copy the block from the screen buffer to the temp. buffer.
|
||||
kernel::read_console_output(&handle, &mut chi_buffer, coord_buffer_size, coord_buffer_coord, &mut srct_read_rect);
|
||||
|
||||
// Set the destination rectangle.
|
||||
let mut srct_write_rect = SMALL_RECT
|
||||
{
|
||||
Top: 10,
|
||||
Left: 0,
|
||||
Bottom: 11,
|
||||
Right: 19,
|
||||
};
|
||||
|
||||
// Copy from the temporary buffer to the new screen buffer.
|
||||
kernel::write_console_output(&new_handle, &mut chi_buffer, coord_buffer_size, coord_buffer_coord, &mut srct_write_rect);
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user