Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/capture/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,14 +608,13 @@ pub fn build_action_display(
..Default::default()
}.with_label("Tab: drag here"),
Action::Typing { text } => {
let preview = if text.len() > 20 { &text[..20] } else { text };
let (sx, sy) = hint.unwrap_or((0.0, 0.0));
ActionDisplayItem {
kind: ActionDisplayKind::Typing,
screen_x: sx,
screen_y: sy,
..Default::default()
}.with_label(&format!("Tab: type '{}'", preview))
}.with_label(&format!("Tab: type '{}'", text))
}
Action::Press { key } => {
let (sx, sy) = hint.unwrap_or((0.0, 0.0));
Expand Down
21 changes: 11 additions & 10 deletions src/ui/action_overlay_darwin.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
static const CGFloat kLabelOffset = 26.0; // below the ring

// Ghost text
static const CGFloat kGhostFontSize = 14.0; // match typical UI font size
static const CGFloat kGhostMonoSize = 13.0; // for terminal contexts
static const CGFloat kGhostOpacity = 0.34; // VS Code Copilot standard
static const CGFloat kGhostMonoSize = 15.0; // for terminal contexts
static const CGFloat kTabChipH = 16.0;
static const CGFloat kTabChipPadX = 6.0;
static const CGFloat kTabChipCorner = 4.0;
Expand Down Expand Up @@ -195,27 +193,30 @@ static void add_ghost_text(CGFloat screen_x, CGFloat screen_y, NSString *text) {
CGFloat scale = NSScreen.mainScreen.backingScaleFactor;

// Use system monospace font (most predictions are in terminals/code editors)
NSFont *ghostFont = [NSFont monospacedSystemFontOfSize:kGhostMonoSize weight:NSFontWeightRegular];
NSFont *ghostFont = [NSFont monospacedSystemFontOfSize:kGhostMonoSize weight:NSFontWeightMedium];

// Measure ghost text width
NSDictionary *attrs = @{NSFontAttributeName: ghostFont};
CGSize measured = [text sizeWithAttributes:attrs];
CGFloat ghostW = ceil(measured.width) + 12;

// Ghost text layer
CATextLayer *ghost = [CATextLayer layer];
ghost.string = text;
ghost.font = (__bridge CFTypeRef)ghostFont;
ghost.fontSize = kGhostMonoSize;
ghost.foregroundColor = [NSColor colorWithWhite:1.0 alpha:kGhostOpacity].CGColor;
ghost.foregroundColor = [NSColor colorWithWhite:0.5 alpha:1.0].CGColor;
ghost.contentsScale = scale;
ghost.alignmentMode = kCAAlignmentLeft;
ghost.wrapped = NO;
ghost.truncationMode = kCATruncationNone;

// Position at cursor — slight vertical offset to align with typical text baselines
CGFloat textH = kGhostMonoSize + 4;
CGFloat textH = ceil(kGhostMonoSize + 6);
ghost.frame = CGRectMake(
screen_x,
flipped_y - textH + 2, // nudge up to align with baseline
measured.width + 4,
ghostW,
textH);

[g_content_view.layer addSublayer:ghost];
Expand All @@ -226,7 +227,7 @@ static void add_ghost_text(CGFloat screen_x, CGFloat screen_y, NSString *text) {
NSString *chipStr = @"\u21E5 Tab"; // ⇥ Tab
CGSize chipTextMeasured = [chipStr sizeWithAttributes:@{NSFontAttributeName: chipFont}];
CGFloat chipW = chipTextMeasured.width + kTabChipPadX * 2;
CGFloat chipX = screen_x + measured.width + kTabChipGap;
CGFloat chipX = screen_x + ghostW + kTabChipGap;
CGFloat chipY = flipped_y - kTabChipH + 2;

// Chip background
Expand All @@ -235,7 +236,7 @@ static void add_ghost_text(CGFloat screen_x, CGFloat screen_y, NSString *text) {
CAShapeLayer *chipBg = [CAShapeLayer layer];
chipBg.path = chipPath;
chipBg.frame = CGRectMake(chipX, chipY, chipW, kTabChipH);
chipBg.fillColor = [NSColor colorWithWhite:1.0 alpha:0.10].CGColor;
chipBg.fillColor = [NSColor colorWithWhite:0.5 alpha:0.15].CGColor;
chipBg.strokeColor = NULL;
CGPathRelease(chipPath);
[g_content_view.layer addSublayer:chipBg];
Expand All @@ -245,7 +246,7 @@ static void add_ghost_text(CGFloat screen_x, CGFloat screen_y, NSString *text) {
chipText.string = chipStr;
chipText.font = (__bridge CFTypeRef)chipFont;
chipText.fontSize = chipTextSize;
chipText.foregroundColor = [NSColor colorWithWhite:1.0 alpha:0.45].CGColor;
chipText.foregroundColor = [NSColor colorWithWhite:0.5 alpha:0.6].CGColor;
chipText.contentsScale = scale;
chipText.alignmentMode = kCAAlignmentCenter;
chipText.frame = CGRectMake(
Expand Down