Skip to content

Commit

Permalink
Merge upstream: v0.12.0 → v0.12.2 (#2)
Browse files Browse the repository at this point in the history
* Fix `;` character in URI OSC 8 payload

The special character `;` can be not URL-encoded, thus it'll add
extra parameter in the payload. Handle it joining extra parameters
with the `;` as a separator.

* Fix selection rotation on the last line

This fixes an issue with terminal resizes when the selection is on the
last line. Alacritty would fail to rotate lines and keep the selection
in the same line index whenever the terminal line count was grown or
shrunk.

This issue occurred due to the range passed to the selection's rotate
function still being based on the old terminal size, which caused the
initial or target state of the rotation to be outside of the terminal
bounds.

Closes alacritty#6698.

* Bump winit to 0.28.4

Fixes alacritty#6817.

* Add `ALACRITTY_EXTRA_LOG_TARGETS` env variable

This should help with troubleshooting the dependency crates like winit.

* Bump winit to 0.28.5

The 0.28.4 was yanked.

* Alacritty version 0.12.1-rc1

* Fix very long startup time on some Wayland systems

This is not a real fix for the issue given that dbus method sctk-adwaita
is using will being called anyway. The proper fix will be available
with the winit's 0.29.0 release.

Right now the delay reduced from around 20 seconds to 100ms on a
systems with broken xdg-desktop-portal setup.

* Update glutin to 0.30.8 and winit to 0.28.6

Fixes alacritty#6920.
Fixes alacritty#6824.

* Alacritty version 0.12.1-rc2

* Bump `actions/checkout` to v3

Fix Node 12 deprecation warnings in action runs.

* Fix upload from CI on windows

* Alacritty version v0.12.1

* Fix hyperlink preview for 2 lines terminal (alacritty#6953)

The intention was to show it, however it was hidden due to wrong
comparisson check.

* Fix crash on ScaleFactorChange on Windows

Windows is known to send zero sizes from winit in Risezed and now
in ScaleFactorChanged events. They were handled in Resized, but
not in ScaleFactorChanged.

Fixes alacritty#6949.

* Fix freeze with some drivers when using GLX

Fixes alacritty#6972.

* Fix the crash when shrinking scrolled terminal

display_offset was adjusted unconditionally, thus it could go
beyound the history limits, so clamp it to history like we do
in grow_colums.

Fixes alacritty#6862.

* Update wix on the release CI

Fixes alacritty#6939.

* Alacritty version v0.12.2-rc1

* Alacritty version v0.12.2

---------

Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
Co-authored-by: Christian Duerr <contact@christianduerr.com>
Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
  • Loading branch information
4 people committed Jul 13, 2023
1 parent f3e1faa commit 7a92dea
Show file tree
Hide file tree
Showing 25 changed files with 174 additions and 137 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Stable
run: cargo test
- name: Oldstable
Expand All @@ -28,7 +28,7 @@ jobs:
check-macos-arm:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install target
run: rustup update && rustup target add aarch64-apple-darwin
- name: Build
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: macos-11

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install ARM target
run: rustup update && rustup target add aarch64-apple-darwin
- name: Test
Expand All @@ -35,7 +35,7 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Test
run: cargo test --release
- name: Build
Expand All @@ -46,14 +46,12 @@ jobs:
./.github/workflows/upload_asset.sh \
./Alacritty-${GITHUB_REF##*/}-portable.exe $GITHUB_TOKEN
- name: Install WiX
run: nuget install WiX
run: dotnet tool install --global wix --version 4.0.1
- name: Crate msi installer
run: |
./WiX.*/tools/candle.exe -nologo -arch "x64" -ext WixUIExtension -ext WixUtilExtension \
-out "./alacritty.wixobj" "alacritty/windows/wix/alacritty.wxs"
./WiX.*/tools/light.exe -nologo -ext WixUIExtension -ext WixUtilExtension \
-out "./Alacritty-${GITHUB_REF##*/}-installer.msi" -sice:ICE61 -sice:ICE91 \
"./alacritty.wixobj"
wix extension add WixToolset.UI.wixext WixToolset.Util.wixext
wix build -arch "x64" -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext \
-out "./Alacritty-${GITHUB_REF##*/}-installer.msi" "alacritty/windows/wix/alacritty.wxs"
- name: Upload msi installer
run: |
./.github/workflows/upload_asset.sh \
Expand All @@ -63,7 +61,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get install cmake pkg-config libfreetype6-dev libfontconfig1-dev \
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/upload_asset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ echo "Git tag: $tag"
echo "Checking for existing release..."
upload_url=$(\
curl \
--http1.1 \
-H "Authorization: Bearer $bearer" \
"https://api.github.com/repos/$repo/releases" \
2> /dev/null \
Expand All @@ -48,6 +49,7 @@ if [ -z "$upload_url" ]; then
# Create new release.
response=$(
curl -f \
--http1.1 \
-X POST \
-H "Authorization: Bearer $bearer" \
-d "{\"tag_name\":\"$tag\",\"draft\":true}" \
Expand Down Expand Up @@ -79,6 +81,7 @@ fi
file_name=${file_path##*/}
echo "Uploading asset $file_name to $upload_url..."
curl -f \
--http1.1 \
-X POST \
-H "Authorization: Bearer $bearer" \
-H "Content-Type: application/octet-stream" \
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ 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/).

## 0.12.2

### Fixed

- Hyperlink preview not being shown when the terminal has exactly 2 lines
- Crash on Windows when changing display scale factor
- Freeze with some drivers when using GLX
- Crash when shrinking the terminal scrolled into the history

## 0.12.1

### Fixed

- Very long startup times on Wayland systems with broken xdg-portal setup.
- Error on startup with `GLX` when using old mesa platforms
- Character `;` inside the `URI` in `OSC 8` sequence breaking the URI
- Selection on last line not updating correctly on resize
- Keyboard input not working on macOS with some IMEs like Fig.io

## 0.12.0

### Added
Expand Down
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions alacritty/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alacritty"
version = "0.12.0"
version = "0.12.2"
authors = ["Christian Duerr <contact@christianduerr.com>", "Joe Wilm <joe@jwilm.com>"]
license = "Apache-2.0"
description = "A fast, cross-platform, OpenGL terminal emulator"
Expand All @@ -11,7 +11,7 @@ rust-version = "1.60.0"

[dependencies.alacritty_terminal]
path = "../alacritty_terminal"
version = "0.18.0"
version = "0.19.1"
default-features = false

[dependencies.alacritty_config_derive]
Expand Down
2 changes: 1 addition & 1 deletion alacritty/src/display/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ pub struct RenderableCellExtra {
}

impl RenderableCell {
fn new<'a>(content: &mut RenderableContent<'a>, cell: Indexed<&Cell>) -> Self {
fn new(content: &mut RenderableContent<'_>, cell: Indexed<&Cell>) -> Self {
// Lookup RGB values.
let mut fg = Self::compute_fg_rgb(content, cell.fg, cell.flags);
let mut bg = Self::compute_bg_rgb(content, cell.bg);
Expand Down
4 changes: 2 additions & 2 deletions alacritty/src/display/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,8 @@ mod tests {
let mut term = mock_term("000\r\n111");
term.goto(Line(0), Column(0));

let hyperlink_foo = Hyperlink::new(Some("1"), "foo");
let hyperlink_bar = Hyperlink::new(Some("2"), "bar");
let hyperlink_foo = Hyperlink::new(Some("1"), String::from("foo"));
let hyperlink_bar = Hyperlink::new(Some("2"), String::from("bar"));

// Create 2 hyperlinks on the first line.
term.set_hyperlink(Some(hyperlink_foo.clone()));
Expand Down
23 changes: 9 additions & 14 deletions alacritty/src/display/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,10 @@ impl Display {
});
}

// XXX: this function must not call to any `OpenGL` related tasks. Renderer updates are
// performed in [`Self::process_renderer_update`] right befor drawing.
//
/// Process update events.
///
/// XXX: this function must not call to any `OpenGL` related tasks. Only logical update
/// of the state is being performed here. Rendering update takes part right before the
/// actual rendering.
pub fn handle_update<T>(
&mut self,
terminal: &mut Term<T>,
Expand Down Expand Up @@ -666,14 +665,11 @@ impl Display {
self.size_info = new_size;
}

// NOTE: Renderer updates are split off, since platforms like Wayland require resize and other
// OpenGL operations to be performed right before rendering. Otherwise they could lock the
// back buffer and render with the previous state. This also solves flickering during resizes.
//
/// Update the state of the renderer.
///
/// NOTE: The update to the renderer is split from the display update on purpose, since
/// on some platforms, like Wayland, resize and other OpenGL operations must be performed
/// right before rendering, otherwise they could lock the back buffer resulting in
/// rendering with the buffer of old size.
///
/// This also resolves any flickering, since the resize is now synced with frame callbacks.
pub fn process_renderer_update(&mut self) {
let renderer_update = match self.pending_renderer_update.take() {
Some(renderer_update) => renderer_update,
Expand Down Expand Up @@ -1205,10 +1201,9 @@ impl Display {
// The maximum amount of protected lines including the ones we'll show preview on.
let max_protected_lines = uris.len() * 2;

// Lines we shouldn't shouldn't show preview on, because it'll obscure the highlighted
// hint.
// Lines we shouldn't show preview on, because it'll obscure the highlighted hint.
let mut protected_lines = Vec::with_capacity(max_protected_lines);
if self.size_info.screen_lines() >= max_protected_lines {
if self.size_info.screen_lines() > max_protected_lines {
// Prefer to show preview even when it'll likely obscure the highlighted hint, when
// there's no place left for it.
protected_lines.push(self.hint_mouse_point.map(|point| point.line));
Expand Down
16 changes: 11 additions & 5 deletions alacritty/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
// We remove `\x1b` to ensure it's impossible for the pasted text to write the bracketed
// paste end escape `\x1b[201~` and `\x03` since some shells incorrectly terminate
// bracketed paste on its receival.
let filtered = text.replace('\x1b', "").replace('\x03', "");
let filtered = text.replace(['\x1b', '\x03'], "");
self.write_to_pty(filtered.into_bytes());

self.write_to_pty(&b"\x1b[201~"[..]);
Expand Down Expand Up @@ -1179,16 +1179,22 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> {
match event {
WinitEvent::UserEvent(Event { payload, .. }) => match payload {
EventType::ScaleFactorChanged(scale_factor, (width, height)) => {
self.ctx.window().scale_factor = scale_factor;

let display_update_pending = &mut self.ctx.display.pending_update;

// Push current font to update its scale factor.
let font = self.ctx.config.font.clone();
display_update_pending.set_font(font.with_size(*self.ctx.font_size));

// Resize to event's dimensions, since no resize event is emitted on Wayland.
display_update_pending.set_dimensions(PhysicalSize::new(width, height));

self.ctx.window().scale_factor = scale_factor;
// Ignore resize events to zero in any dimension, to avoid issues with Winit
// and the ConPTY. A 0x0 resize will also occur when the window is minimized
// on Windows.
if width != 0 && height != 0 {
// Resize to event's dimensions, since no resize event is emitted on
// Wayland.
display_update_pending.set_dimensions(PhysicalSize::new(width, height));
}
},
EventType::Frame => {
self.ctx.display.window.has_frame.store(true, Ordering::Relaxed);
Expand Down
14 changes: 13 additions & 1 deletion alacritty/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::time::Instant;
use std::{env, process};

use log::{self, Level, LevelFilter};
use once_cell::sync::Lazy;
use winit::event_loop::EventLoopProxy;

use alacritty_terminal::config::LOG_TARGET_CONFIG;
Expand All @@ -27,6 +28,17 @@ pub const LOG_TARGET_IPC_CONFIG: &str = "alacritty_log_ipc_config";
/// Name for the environment variable containing the log file's path.
const ALACRITTY_LOG_ENV: &str = "ALACRITTY_LOG";

/// Name for the environment varibale containing extra logging targets.
///
/// The targets are semicolon separated.
const ALACRITTY_EXTRA_LOG_TARGETS_ENV: &str = "ALACRITTY_EXTRA_LOG_TARGETS";

/// User configurable extra log targets to include.
static EXTRA_LOG_TARGETS: Lazy<Vec<String>> = Lazy::new(|| {
env::var(ALACRITTY_EXTRA_LOG_TARGETS_ENV)
.map_or(Vec::new(), |targets| targets.split(';').map(ToString::to_string).collect())
});

/// List of targets which will be logged by Alacritty.
const ALLOWED_TARGETS: &[&str] = &[
LOG_TARGET_IPC_CONFIG,
Expand Down Expand Up @@ -167,7 +179,7 @@ fn create_log_message(record: &log::Record<'_>, target: &str, start: Instant) ->
fn is_allowed_target(level: Level, target: &str) -> bool {
match (level, log::max_level()) {
(Level::Error, LevelFilter::Trace) | (Level::Warn, LevelFilter::Trace) => true,
_ => ALLOWED_TARGETS.contains(&target),
_ => ALLOWED_TARGETS.contains(&target) || EXTRA_LOG_TARGETS.iter().any(|t| t == target),
}
}

Expand Down
5 changes: 2 additions & 3 deletions alacritty/src/renderer/text/builtin_font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,8 @@ impl Canvas {
let v_line_bounds = (v_line_bounds.0 as usize, v_line_bounds.1 as usize);
let max_transparancy = 0.5;

for (radius_y, radius_x) in (h_line_bounds.0..h_line_bounds.1)
.into_iter()
.zip((v_line_bounds.0..v_line_bounds.1).into_iter())
for (radius_y, radius_x) in
(h_line_bounds.0..h_line_bounds.1).zip(v_line_bounds.0..v_line_bounds.1)
{
let radius_x = radius_x as f32;
let radius_y = radius_y as f32;
Expand Down
Loading

0 comments on commit 7a92dea

Please sign in to comment.