Merge pull request #1606 from zed-industries/terminal-finishing

Terminal finishing
This commit is contained in:
Mikayla Maki 2022-09-06 10:41:40 -07:00 committed by GitHub
commit 1014d65e8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 18 deletions

28
Cargo.lock generated
View file

@ -59,10 +59,20 @@ dependencies = [
"memchr",
]
[[package]]
name = "alacritty_config"
version = "0.1.1-dev"
source = "git+https://github.com/zed-industries/alacritty?rev=a51dbe25d67e84d6ed4261e640d3954fbdd9be45#a51dbe25d67e84d6ed4261e640d3954fbdd9be45"
dependencies = [
"log",
"serde",
"serde_yaml",
]
[[package]]
name = "alacritty_config_derive"
version = "0.1.0"
source = "git+https://github.com/zed-industries/alacritty?rev=4e1f0c6177975a040b37f942dfb0e723e46a9971#4e1f0c6177975a040b37f942dfb0e723e46a9971"
version = "0.2.1-dev"
source = "git+https://github.com/zed-industries/alacritty?rev=a51dbe25d67e84d6ed4261e640d3954fbdd9be45#a51dbe25d67e84d6ed4261e640d3954fbdd9be45"
dependencies = [
"proc-macro2",
"quote",
@ -71,9 +81,10 @@ dependencies = [
[[package]]
name = "alacritty_terminal"
version = "0.17.0-dev"
source = "git+https://github.com/zed-industries/alacritty?rev=4e1f0c6177975a040b37f942dfb0e723e46a9971#4e1f0c6177975a040b37f942dfb0e723e46a9971"
version = "0.17.1-dev"
source = "git+https://github.com/zed-industries/alacritty?rev=a51dbe25d67e84d6ed4261e640d3954fbdd9be45#a51dbe25d67e84d6ed4261e640d3954fbdd9be45"
dependencies = [
"alacritty_config",
"alacritty_config_derive",
"base64",
"bitflags",
@ -85,7 +96,7 @@ dependencies = [
"mio-extras",
"miow 0.3.7",
"nix",
"parking_lot 0.11.2",
"parking_lot 0.12.1",
"regex-automata",
"serde",
"serde_yaml",
@ -3230,12 +3241,11 @@ dependencies = [
[[package]]
name = "nix"
version = "0.22.3"
version = "0.24.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf"
checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
"memoffset",
@ -3824,7 +3834,7 @@ dependencies = [
[[package]]
name = "procinfo"
version = "0.1.0"
source = "git+https://github.com/zed-industries/wezterm?rev=40a7dbf93542fbe4178c2e4b4bd438126a6432b9#40a7dbf93542fbe4178c2e4b4bd438126a6432b9"
source = "git+https://github.com/zed-industries/wezterm?rev=5cd757e5f2eb039ed0c6bb6512223e69d5efc64d#5cd757e5f2eb039ed0c6bb6512223e69d5efc64d"
dependencies = [
"libc",
"log",

View file

@ -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" }

View file

@ -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());

View file

@ -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));

View file

@ -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...