T10: focus in and out reach a program under mode 1004; the window wears the program's title; a bell is logged and silent; the scrollback setting caps history and trims it live; Cmd-F finds in the scrollback with Ely's FindWidget, matches washed, Enter older, Shift-Enter newer, new output searched again
This commit is contained in:
11 files changed
+486
-35
No files matched your search
+29
-3
@@ -4,21 +4,46 @@ use anyhow::Context as _;
|
||||
use ely_gpui_component::{primitives::FocusScope, theme::ActiveTheme};
|
||||
use gpui::{
|
||||
App, AppContext, Bounds, Context, Entity, FocusHandle, Focusable, IntoElement, ParentElement,
|
||||
Render, Styled, TitlebarOptions, Window, WindowBounds, WindowHandle, WindowOptions, px, size,
|
||||
Render, Styled, Subscription, TitlebarOptions, Window, WindowBounds, WindowHandle,
|
||||
WindowOptions, px, size,
|
||||
};
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
use crate::term::mac;
|
||||
use crate::{
|
||||
settings::SettingsStore,
|
||||
term::{ICONS, Launch, MONO, TerminalView, config, input, shell::ShellIntegration, spawn},
|
||||
term::{
|
||||
ICONS, Launch, MONO, TerminalEvent, TerminalView, config, input, shell::ShellIntegration,
|
||||
spawn,
|
||||
},
|
||||
themes,
|
||||
};
|
||||
|
||||
/// The window title while the program names none.
|
||||
const TITLE: &str = "ELYTerminal";
|
||||
|
||||
/// The main window's content.
|
||||
pub struct Workspace {
|
||||
focus: FocusHandle,
|
||||
terminal: Entity<TerminalView>,
|
||||
_events: Subscription,
|
||||
}
|
||||
|
||||
impl Workspace {
|
||||
/// The window wears the terminal's title.
|
||||
fn terminal_event(
|
||||
&mut self,
|
||||
_: &Entity<TerminalView>,
|
||||
event: &TerminalEvent,
|
||||
window: &mut Window,
|
||||
_: &mut Context<Self>,
|
||||
) {
|
||||
if let TerminalEvent::Title(title) = event {
|
||||
let title = if title.is_empty() { TITLE } else { title };
|
||||
log::debug!("app: the window title is {title:?}");
|
||||
window.set_window_title(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for Workspace {
|
||||
@@ -75,7 +100,7 @@ pub fn open(launch: Launch, cx: &mut App) -> anyhow::Result<WindowHandle<Workspa
|
||||
let options = WindowOptions {
|
||||
window_bounds: Some(WindowBounds::Windowed(bounds)),
|
||||
titlebar: Some(TitlebarOptions {
|
||||
title: Some("ELYTerminal".into()),
|
||||
title: Some(TITLE.into()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
@@ -89,6 +114,7 @@ pub fn open(launch: Launch, cx: &mut App) -> anyhow::Result<WindowHandle<Workspa
|
||||
window.focus(&terminal.focus_handle(cx), cx);
|
||||
cx.new(|cx| Workspace {
|
||||
focus: cx.focus_handle(),
|
||||
_events: cx.subscribe_in(&terminal, window, Workspace::terminal_event),
|
||||
terminal,
|
||||
})
|
||||
})?;
|
||||
|
||||
Reference in new issue
Block a user