mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
core: surface confirm close logic updated to handle semantic prompts
This commit is contained in:
@ -529,18 +529,18 @@ pub fn deinit(self: *Surface) void {
|
|||||||
/// close process, which should ultimately deinitialize this surface.
|
/// close process, which should ultimately deinitialize this surface.
|
||||||
pub fn close(self: *Surface) void {
|
pub fn close(self: *Surface) void {
|
||||||
const process_alive = process_alive: {
|
const process_alive = process_alive: {
|
||||||
// Inform close() if it should hold open the surface or not. If the child
|
// If the child has exited then our process is certainly not alive.
|
||||||
// exited, we don't want to
|
// We check this first to avoid the locking overhead below.
|
||||||
var process_alive = !self.child_exited;
|
if (self.child_exited) break :process_alive false;
|
||||||
|
|
||||||
// However, if we are configured to not hold open surfaces explicitly,
|
// If we are configured to not hold open surfaces explicitly, just
|
||||||
// just tell close to not hold them open by saying there are no alive
|
// always say there is nothing alive.
|
||||||
// processes
|
if (!self.config.confirm_close_surface) break :process_alive false;
|
||||||
if (!self.config.confirm_close_surface) {
|
|
||||||
process_alive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
break :process_alive process_alive;
|
// We have to talk to the terminal.
|
||||||
|
self.renderer_state.mutex.lock();
|
||||||
|
defer self.renderer_state.mutex.unlock();
|
||||||
|
break :process_alive !self.io.terminal.cursorIsAtPrompt();
|
||||||
};
|
};
|
||||||
|
|
||||||
self.rt_surface.close(process_alive);
|
self.rt_surface.close(process_alive);
|
||||||
|
@ -1401,6 +1401,7 @@ pub fn setScrollingRegion(self: *Terminal, top: usize, bottom: usize) void {
|
|||||||
/// (OSC 133) only allow setting this for wherever the current active cursor
|
/// (OSC 133) only allow setting this for wherever the current active cursor
|
||||||
/// is located.
|
/// is located.
|
||||||
pub fn markSemanticPrompt(self: *Terminal, p: SemanticPrompt) void {
|
pub fn markSemanticPrompt(self: *Terminal, p: SemanticPrompt) void {
|
||||||
|
log.warn("semantic_prompt: {}", .{p});
|
||||||
const row = self.screen.getRow(.{ .active = self.screen.cursor.y });
|
const row = self.screen.getRow(.{ .active = self.screen.cursor.y });
|
||||||
row.setSemanticPrompt(switch (p) {
|
row.setSemanticPrompt(switch (p) {
|
||||||
.prompt => .prompt,
|
.prompt => .prompt,
|
||||||
|
Reference in New Issue
Block a user