Compare commits

...

5 Commits

Author SHA1 Message Date
Christian Duerr ce800bfde2
Fix dynamic title override for multiple windows
This fixes an issue where Windows spawned after the initial one through
IPC or bindings would not update their title due to the initial window
having its title set through the CLI.

Title changes are still inhibited for additional windows when they are
spawned through `alacritty msg create-window` with the `--title` CLI
option added.

Closes #6836.
2024-04-23 15:42:16 +00:00
Kirill Chibisov 90054614c2
Fix IME preview overlapping text
Fix incorrect usage of the `flags` when drawing the preedit resulting
in setting the `flags`, but not actually reading the value back.

The logic to skip things was also used incorrectly, because the renderer
does that already based on the `WIDE_CHAR` flag on the cell.

Fixes: 67a433ceed (Skip whitespaces for wide chars in preedit)
2024-04-21 15:23:10 +04:00
Matt Fellenz 44dc9e19f4
Fix missing config import warning 2024-04-21 11:12:55 +00:00
William Viktorsson 18fff6a12b
Fix crash when trying to open a new tab on macOS
This fixes an issue where Alacritty would crash when trying to open a
new tab on macOS while having decorations disabled.

Co-authored-by: Christian Duerr <contact@christianduerr.com>
2024-04-20 23:11:46 +00:00
Kirill Chibisov d28868855a
Fix window being focused by default
Winit explicitly states that the window is not focused by default and
the `Focused` event will deliver the state later on.

Also start adding notable changes to alacritty_terminal in its own
CHANGELOG.

Closes #7866.
2024-04-18 22:58:15 +04:00
13 changed files with 83 additions and 64 deletions

View File

@ -5,12 +5,22 @@ The sections should follow the order `Packaging`, `Added`, `Changed`, `Fixed` an
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
Notable changes to the `alacritty_terminal` crate are documented in its
[CHANGELOG](./alacritty_terminal/CHANGELOG.md).
## 0.14.0-dev
### Changed
- Pressing `Alt` with unicode input will now add `ESC` like for ASCII input
### Fixed
- Crash when trying to create a new tab without decorations enabled
- New window being treated as focused when it's not on Wayland
- IME preview blending into text below it
- Dynamic title disabled for new windows when initial one has title as CLI option
## 0.13.2
### Added

View File

@ -91,10 +91,11 @@ If any change has been made to the `config.rs` file, it should also be documente
Changes compared to the latest Alacritty release which have a direct effect on the user (opposed to
things like code refactorings or documentation/tests) additionally need to be documented in the
`CHANGELOG.md`. The existing entries should be used as a style guideline. The change log should be
used to document changes from a user-perspective, instead of explaining the technical background
(like commit messages). More information about Alacritty's change log format can be found
[here](https://keepachangelog.com).
`CHANGELOG.md`. When a notable change is made to `alacritty_terminal`, it should be documented in
`alacritty_terminal/CHANGELOG.md` as well. The existing entries should be used as a style guideline.
The change log should be used to document changes from a user-perspective, instead of explaining the
technical background (like commit messages) More information about Alacritty's change log format can
be found [here](https://keepachangelog.com).
### Style

2
Cargo.lock generated
View File

@ -91,7 +91,7 @@ dependencies = [
[[package]]
name = "alacritty_terminal"
version = "0.22.1-dev"
version = "0.23.0-dev"
dependencies = [
"base64",
"bitflags 2.4.2",

View File

@ -12,7 +12,7 @@ rust-version = "1.70.0"
[dependencies.alacritty_terminal]
path = "../alacritty_terminal"
version = "0.22.1-dev"
version = "0.23.0-dev"
[dependencies.alacritty_config_derive]
path = "../alacritty_config_derive"

View File

@ -92,7 +92,6 @@ impl Options {
config.ipc_socket |= self.socket.is_some();
}
config.window.dynamic_title &= self.window_options.window_identity.title.is_none();
config.window.embed = self.embed.as_ref().and_then(|embed| parse_hex_or_decimal(embed));
config.debug.print_events |= self.print_events;
config.debug.log_level = max(config.debug.log_level, self.log_level());
@ -425,19 +424,6 @@ mod tests {
assert_eq!(old_dynamic_title, config.window.dynamic_title);
}
#[test]
fn dynamic_title_overridden_by_options() {
let mut config = UiConfig::default();
let title = Some(String::from("foo"));
let window_identity = WindowIdentity { title, ..WindowIdentity::default() };
let new_window_options = WindowOptions { window_identity, ..WindowOptions::default() };
let mut options = Options { window_options: new_window_options, ..Options::default() };
options.override_config(&mut config);
assert!(!config.window.dynamic_title);
}
#[test]
fn dynamic_title_not_overridden_by_config() {
let mut config = UiConfig::default();

View File

@ -263,13 +263,12 @@ fn load_imports(config: &Value, config_paths: &mut Vec<PathBuf>, recursion_limit
},
};
if !path.exists() {
info!(target: LOG_TARGET_CONFIG, "Config import not found:\n {:?}", path.display());
continue;
}
match parse_config(&path, config_paths, recursion_limit - 1) {
Ok(config) => merged = serde_utils::merge(merged, config),
Err(Error::Io(io)) if io.kind() == io::ErrorKind::NotFound => {
info!(target: LOG_TARGET_CONFIG, "Config import not found:\n {:?}", path.display());
continue;
},
Err(err) => {
error!(target: LOG_TARGET_CONFIG, "Unable to import config {:?}: {}", path, err)
},

View File

@ -217,6 +217,7 @@ pub struct ActionContext<'a, N, T> {
pub message_buffer: &'a mut MessageBuffer,
pub config: &'a UiConfig,
pub cursor_blink_timed_out: &'a mut bool,
#[cfg(target_os = "macos")]
pub event_loop: &'a EventLoopWindowTarget<Event>,
pub event_proxy: &'a EventLoopProxy<Event>,
pub scheduler: &'a mut Scheduler,
@ -1213,7 +1214,6 @@ pub struct Mouse {
pub click_state: ClickState,
pub accumulated_scroll: AccumulatedScroll,
pub cell_side: Side,
pub lines_scrolled: f32,
pub block_hint_launcher: bool,
pub hint_highlight_dirty: bool,
pub inside_text_area: bool,
@ -1234,7 +1234,6 @@ impl Default for Mouse {
hint_highlight_dirty: Default::default(),
block_hint_launcher: Default::default(),
inside_text_area: Default::default(),
lines_scrolled: Default::default(),
accumulated_scroll: Default::default(),
x: Default::default(),
y: Default::default(),
@ -1313,7 +1312,7 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> {
},
TerminalEvent::ResetTitle => {
let window_config = &self.ctx.config.window;
if window_config.dynamic_title {
if !self.ctx.preserve_title && window_config.dynamic_title {
self.ctx.display.window.set_title(window_config.identity.title.clone());
}
},
@ -1694,6 +1693,7 @@ impl Processor {
};
window_context.handle_event(
#[cfg(target_os = "macos")]
event_loop,
&proxy,
&mut clipboard,
@ -1708,6 +1708,7 @@ impl Processor {
// Dispatch event to all windows.
for window_context in self.windows.values_mut() {
window_context.handle_event(
#[cfg(target_os = "macos")]
event_loop,
&proxy,
&mut clipboard,
@ -1794,6 +1795,7 @@ impl Processor {
WinitEvent::UserEvent(event @ Event { window_id: None, .. }) => {
for window_context in self.windows.values_mut() {
window_context.handle_event(
#[cfg(target_os = "macos")]
event_loop,
&proxy,
&mut clipboard,
@ -1807,6 +1809,7 @@ impl Processor {
| WinitEvent::UserEvent(Event { window_id: Some(window_id), .. }) => {
if let Some(window_context) = self.windows.get_mut(&window_id) {
window_context.handle_event(
#[cfg(target_os = "macos")]
event_loop,
&proxy,
&mut clipboard,

View File

@ -36,6 +36,8 @@ use alacritty_terminal::vi_mode::ViMotion;
use alacritty_terminal::vte::ansi::{ClearMode, Handler};
use crate::clipboard::Clipboard;
#[cfg(target_os = "macos")]
use crate::config::window::Decorations;
use crate::config::{Action, BindingMode, MouseAction, SearchAction, UiConfig, ViAction};
use crate::display::hint::HintMatch;
use crate::display::window::Window;
@ -385,8 +387,11 @@ impl<T: EventListener> Execute<T> for Action {
Action::CreateNewWindow => ctx.create_new_window(None),
#[cfg(target_os = "macos")]
Action::CreateNewTab => {
let tabbing_id = Some(ctx.window().tabbing_id());
ctx.create_new_window(tabbing_id);
// Tabs on macOS are not possible without decorations.
if ctx.config().window.decorations != Decorations::None {
let tabbing_id = Some(ctx.window().tabbing_id());
ctx.create_new_window(tabbing_id);
}
},
#[cfg(target_os = "macos")]
Action::SelectNextTab => ctx.window().select_next_tab(),

View File

@ -205,30 +205,29 @@ impl Renderer {
size_info: &SizeInfo,
glyph_cache: &mut GlyphCache,
) {
let mut skip_next = false;
let cells = string_chars.enumerate().filter_map(|(i, character)| {
if skip_next {
skip_next = false;
return None;
}
let mut wide_char_spacer = false;
let cells = string_chars.enumerate().map(|(i, character)| {
let flags = if wide_char_spacer {
wide_char_spacer = false;
Flags::WIDE_CHAR_SPACER
} else if character.width() == Some(2) {
// The spacer is always following the wide char.
wide_char_spacer = true;
Flags::WIDE_CHAR
} else {
Flags::empty()
};
let mut flags = Flags::empty();
if character.width() == Some(2) {
flags.insert(Flags::WIDE_CHAR);
// Wide character is always followed by a spacer, so skip it.
skip_next = true;
}
Some(RenderableCell {
RenderableCell {
point: Point::new(point.line, point.column + i),
character,
extra: None,
flags: Flags::empty(),
flags,
bg_alpha: 1.0,
fg,
bg,
underline: fg,
})
}
});
self.draw_cells(size_info, glyph_cache, cells);

View File

@ -399,7 +399,7 @@ impl WindowContext {
/// Process events for this terminal window.
pub fn handle_event(
&mut self,
event_loop: &EventLoopWindowTarget<Event>,
#[cfg(target_os = "macos")] event_loop: &EventLoopWindowTarget<Event>,
event_proxy: &EventLoopProxy<Event>,
clipboard: &mut Clipboard,
scheduler: &mut Scheduler,
@ -445,6 +445,7 @@ impl WindowContext {
preserve_title: self.preserve_title,
config: &self.config,
event_proxy,
#[cfg(target_os = "macos")]
event_loop,
clipboard,
scheduler,

View File

@ -0,0 +1,15 @@
# Changelog
All notable changes to alacritty_terminal are documented in this file. The
sections should follow the order `Added`, `Changed`, `Deprecated`, `Fixed` and
`Removed`.
**Breaking changes are written in bold style.**
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 0.23.0-dev
### Changed
- **`Term` is not focused by default anymore**

View File

@ -1,6 +1,6 @@
[package]
name = "alacritty_terminal"
version = "0.22.1-dev"
version = "0.23.0-dev"
authors = ["Christian Duerr <contact@christianduerr.com>", "Joe Wilm <joe@jwilm.com>"]
license = "Apache-2.0"
description = "Library for writing terminal emulators"

View File

@ -407,13 +407,13 @@ impl<T> Term<T> {
}
}
pub fn new<D: Dimensions>(options: Config, dimensions: &D, event_proxy: T) -> Term<T> {
pub fn new<D: Dimensions>(config: Config, dimensions: &D, event_proxy: T) -> Term<T> {
let num_cols = dimensions.columns();
let num_lines = dimensions.screen_lines();
let history_size = options.scrolling_history;
let history_size = config.scrolling_history;
let grid = Grid::new(num_lines, num_cols, history_size);
let alt = Grid::new(num_lines, num_cols, 0);
let inactive_grid = Grid::new(num_lines, num_cols, 0);
let tabs = TabStops::new(grid.columns());
@ -423,24 +423,24 @@ impl<T> Term<T> {
let damage = TermDamageState::new(num_cols, num_lines);
Term {
inactive_grid,
scroll_region,
event_proxy,
damage,
config,
grid,
inactive_grid: alt,
tabs,
inactive_keyboard_mode_stack: Default::default(),
keyboard_mode_stack: Default::default(),
active_charset: Default::default(),
vi_mode_cursor: Default::default(),
tabs,
mode: Default::default(),
scroll_region,
cursor_style: Default::default(),
colors: color::Colors::default(),
cursor_style: None,
event_proxy,
is_focused: true,
title: None,
title_stack: Default::default(),
keyboard_mode_stack: Default::default(),
inactive_keyboard_mode_stack: Default::default(),
selection: None,
damage,
config: options,
is_focused: Default::default(),
selection: Default::default(),
title: Default::default(),
mode: Default::default(),
}
}