Problem with alacritty's handling of selections when the terminal resizes

This commit is contained in:
Mikayla Maki 2022-09-03 20:52:40 -07:00
parent acc1950ab4
commit 68cf91de32
5 changed files with 30 additions and 12 deletions

26
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",

View File

@ -8,7 +8,7 @@ path = "src/terminal.rs"
doctest = false
[dependencies]
alacritty_terminal = { git = "https://github.com/zed-industries/alacritty", rev = "4e1f0c6177975a040b37f942dfb0e723e46a9971" }
alacritty_terminal = { git = "https://github.com/zed-industries/alacritty", rev = "a51dbe25d67e84d6ed4261e640d3954fbdd9be45" }
procinfo = { git = "https://github.com/zed-industries/wezterm", rev = "40a7dbf93542fbe4178c2e4b4bd438126a6432b9", default-features = false }
editor = { path = "../editor" }
util = { path = "../util" }

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 {
@ -580,6 +581,12 @@ impl Terminal {
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 => {

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