Merge pull request #1606 from zed-industries/terminal-finishing
Terminal finishing
This commit is contained in:
@@ -8,8 +8,8 @@ path = "src/terminal.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
alacritty_terminal = { git = "https://github.com/zed-industries/alacritty", rev = "4e1f0c6177975a040b37f942dfb0e723e46a9971" }
|
||||
procinfo = { git = "https://github.com/zed-industries/wezterm", rev = "40a7dbf93542fbe4178c2e4b4bd438126a6432b9", default-features = false }
|
||||
alacritty_terminal = { git = "https://github.com/zed-industries/alacritty", rev = "a51dbe25d67e84d6ed4261e640d3954fbdd9be45" }
|
||||
procinfo = { git = "https://github.com/zed-industries/wezterm", rev = "5cd757e5f2eb039ed0c6bb6512223e69d5efc64d", default-features = false }
|
||||
editor = { path = "../editor" }
|
||||
util = { path = "../util" }
|
||||
gpui = { path = "../gpui" }
|
||||
|
||||
@@ -272,6 +272,7 @@ impl TerminalBuilder {
|
||||
initial_size: TerminalSize,
|
||||
blink_settings: Option<TerminalBlink>,
|
||||
alternate_scroll: &AlternateScroll,
|
||||
window_id: usize,
|
||||
) -> Result<TerminalBuilder> {
|
||||
let pty_config = {
|
||||
let alac_shell = shell.clone().and_then(|shell| match shell {
|
||||
@@ -323,7 +324,7 @@ impl TerminalBuilder {
|
||||
let term = Arc::new(FairMutex::new(term));
|
||||
|
||||
//Setup the pty...
|
||||
let pty = match tty::new(&pty_config, initial_size.into(), None) {
|
||||
let pty = match tty::new(&pty_config, initial_size.into(), window_id as u64) {
|
||||
Ok(pty) => pty,
|
||||
Err(error) => {
|
||||
bail!(TerminalError {
|
||||
@@ -572,12 +573,21 @@ impl Terminal {
|
||||
});
|
||||
self.write_to_pty(format(color))
|
||||
}
|
||||
InternalEvent::Resize(new_size) => {
|
||||
self.cur_size = *new_size;
|
||||
InternalEvent::Resize(mut new_size) => {
|
||||
new_size.height = f32::max(new_size.line_height, new_size.height);
|
||||
new_size.width = f32::max(new_size.cell_width, new_size.width);
|
||||
|
||||
self.pty_tx.0.send(Msg::Resize((*new_size).into())).ok();
|
||||
self.cur_size = new_size.clone();
|
||||
|
||||
term.resize(*new_size);
|
||||
self.pty_tx.0.send(Msg::Resize((new_size).into())).ok();
|
||||
|
||||
// When this resize happens
|
||||
// We go from 737px -> 703px height
|
||||
// This means there is 1 less line
|
||||
// that means the delta is 1
|
||||
// That means the selection is rotated by -1
|
||||
|
||||
term.resize(new_size);
|
||||
}
|
||||
InternalEvent::Clear => {
|
||||
self.write_to_pty("\x0c".to_string());
|
||||
|
||||
@@ -114,6 +114,7 @@ impl TerminalContainer {
|
||||
size_info,
|
||||
settings.terminal_overrides.blinking.clone(),
|
||||
scroll,
|
||||
cx.window_id(),
|
||||
) {
|
||||
Ok(terminal) => {
|
||||
let terminal = cx.add_model(|cx| terminal.subscribe(cx));
|
||||
|
||||
@@ -827,9 +827,9 @@ fn to_highlighted_range_lines(
|
||||
origin: Vector2F,
|
||||
) -> Option<(f32, Vec<HighlightedRangeLine>)> {
|
||||
// Step 1. Normalize the points to be viewport relative.
|
||||
//When display_offset = 1, here's how the grid is arranged:
|
||||
//--- Viewport top
|
||||
// When display_offset = 1, here's how the grid is arranged:
|
||||
//-2,0 -2,1...
|
||||
//--- Viewport top
|
||||
//-1,0 -1,1...
|
||||
//--------- Terminal Top
|
||||
// 0,0 0,1...
|
||||
|
||||
Reference in New Issue
Block a user