keybind: don't clobber the clipboard if the title is empty

This commit is contained in:
Jeffrey C. Ollie
2025-07-06 14:15:11 -05:00
parent a23b5328a5
commit 7884872d4e
2 changed files with 2 additions and 1 deletions

View File

@ -4445,6 +4445,7 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
.copy_title_to_clipboard => { .copy_title_to_clipboard => {
const title = self.rt_surface.getTitle() orelse return false; const title = self.rt_surface.getTitle() orelse return false;
if (title.len == 0) return false;
self.rt_surface.setClipboardString(title, .standard, false) catch |err| { self.rt_surface.setClipboardString(title, .standard, false) catch |err| {
log.err("error copying title to clipboard err={}", .{err}); log.err("error copying title to clipboard err={}", .{err});

View File

@ -282,7 +282,7 @@ pub const Action = union(enum) {
copy_url_to_clipboard, copy_url_to_clipboard,
/// Copy the terminal title to the clipboard. If the terminal title is not /// Copy the terminal title to the clipboard. If the terminal title is not
/// set this has no effect. /// set or is empty this has no effect.
copy_title_to_clipboard, copy_title_to_clipboard,
/// Increase the font size by the specified amount in points (pt). /// Increase the font size by the specified amount in points (pt).