summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/term/mod.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2021-11-22 21:34:09 +0300
committerGitHub <noreply@github.com>2021-11-22 18:34:09 +0000
commit8681f71084894db6d1e258be17db1f80bb669314 (patch)
tree24d3c0ced916d2d171fd03f50cd34dcda8f0aa06 /alacritty_terminal/src/term/mod.rs
parentc89939b5d14e581e1aeaa940d81843192e0abc79 (diff)
downloadalacritty-8681f71084894db6d1e258be17db1f80bb669314.tar.gz
alacritty-8681f71084894db6d1e258be17db1f80bb669314.zip
Add parameters to `msg create-window` subcommand
Alacritty's `msg create-window` subcommand would previously inherit all the CLI parameters from the original executable. However not only could this lead to unexpected behavior, it also prevents multi-window users from making use of parameters like `-e`, `--working-directory`, or `--hold`. This is solved by adding a JSON-based message format to the IPC socket messages which instructs the Alacritty server on which CLI parameters should be used to create the new window. Fixes #5562. Fixes #5561. Fixes #5560.
Diffstat (limited to 'alacritty_terminal/src/term/mod.rs')
-rw-r--r--alacritty_terminal/src/term/mod.rs32
1 files changed, 16 insertions, 16 deletions
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 894bd763..9b7a4c35 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -288,7 +288,7 @@ impl<T> Term<T> {
self.vi_mode_recompute_selection();
}
- pub fn new<C>(config: &Config<C>, size: SizeInfo, event_proxy: T) -> Term<T> {
+ pub fn new(config: &Config, size: SizeInfo, event_proxy: T) -> Term<T> {
let num_cols = size.columns;
let num_lines = size.screen_lines;
@@ -323,7 +323,7 @@ impl<T> Term<T> {
}
}
- pub fn update_config<C>(&mut self, config: &Config<C>)
+ pub fn update_config(&mut self, config: &Config)
where
T: EventListener,
{
@@ -1903,7 +1903,7 @@ pub mod test {
// Create terminal with the appropriate dimensions.
let size = SizeInfo::new(num_cols as f32, lines.len() as f32, 1., 1., 0., 0., false);
- let mut term = Term::new(&Config::<()>::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
// Fill terminal with content.
for (line, text) in lines.iter().enumerate() {
@@ -1938,7 +1938,7 @@ mod tests {
use std::mem;
use crate::ansi::{self, CharsetIndex, Handler, StandardCharset};
- use crate::config::MockConfig;
+ use crate::config::Config;
use crate::grid::{Grid, Scroll};
use crate::index::{Column, Point, Side};
use crate::selection::{Selection, SelectionType};
@@ -1947,7 +1947,7 @@ mod tests {
#[test]
fn scroll_display_page_up() {
let size = SizeInfo::new(5., 10., 1.0, 1.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
// Create 11 lines of scrollback.
for _ in 0..20 {
@@ -1973,7 +1973,7 @@ mod tests {
#[test]
fn scroll_display_page_down() {
let size = SizeInfo::new(5., 10., 1.0, 1.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
// Create 11 lines of scrollback.
for _ in 0..20 {
@@ -2003,7 +2003,7 @@ mod tests {
#[test]
fn semantic_selection_works() {
let size = SizeInfo::new(5., 3., 1.0, 1.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
let mut grid: Grid<Cell> = Grid::new(3, 5, 0);
for i in 0..5 {
for j in 0..2 {
@@ -2051,7 +2051,7 @@ mod tests {
#[test]
fn line_selection_works() {
let size = SizeInfo::new(5., 1., 1.0, 1.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
let mut grid: Grid<Cell> = Grid::new(1, 5, 0);
for i in 0..5 {
grid[Line(0)][Column(i)].c = 'a';
@@ -2072,7 +2072,7 @@ mod tests {
#[test]
fn selecting_empty_line() {
let size = SizeInfo::new(3.0, 3.0, 1.0, 1.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
let mut grid: Grid<Cell> = Grid::new(3, 3, 0);
for l in 0..3 {
if l != 1 {
@@ -2110,7 +2110,7 @@ mod tests {
#[test]
fn input_line_drawing_character() {
let size = SizeInfo::new(21.0, 51.0, 3.0, 3.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
let cursor = Point::new(Line(0), Column(0));
term.configure_charset(CharsetIndex::G0, StandardCharset::SpecialCharacterAndLineDrawing);
term.input('a');
@@ -2121,7 +2121,7 @@ mod tests {
#[test]
fn clear_saved_lines() {
let size = SizeInfo::new(21.0, 51.0, 3.0, 3.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
// Add one line of scrollback.
term.grid.scroll_up(&(Line(0)..Line(1)), 1);
@@ -2143,7 +2143,7 @@ mod tests {
#[test]
fn grow_lines_updates_active_cursor_pos() {
let mut size = SizeInfo::new(100.0, 10.0, 1.0, 1.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
// Create 10 lines of scrollback.
for _ in 0..19 {
@@ -2163,7 +2163,7 @@ mod tests {
#[test]
fn grow_lines_updates_inactive_cursor_pos() {
let mut size = SizeInfo::new(100.0, 10.0, 1.0, 1.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
// Create 10 lines of scrollback.
for _ in 0..19 {
@@ -2189,7 +2189,7 @@ mod tests {
#[test]
fn shrink_lines_updates_active_cursor_pos() {
let mut size = SizeInfo::new(100.0, 10.0, 1.0, 1.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
// Create 10 lines of scrollback.
for _ in 0..19 {
@@ -2209,7 +2209,7 @@ mod tests {
#[test]
fn shrink_lines_updates_inactive_cursor_pos() {
let mut size = SizeInfo::new(100.0, 10.0, 1.0, 1.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
// Create 10 lines of scrollback.
for _ in 0..19 {
@@ -2235,7 +2235,7 @@ mod tests {
#[test]
fn window_title() {
let size = SizeInfo::new(21.0, 51.0, 3.0, 3.0, 0.0, 0.0, false);
- let mut term = Term::new(&MockConfig::default(), size, ());
+ let mut term = Term::new(&Config::default(), size, ());
// Title None by default.
assert_eq!(term.title, None);