diff --git a/src/capture/action.rs b/src/capture/action.rs index e20bf6d..2ef729a 100644 --- a/src/capture/action.rs +++ b/src/capture/action.rs @@ -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)); diff --git a/src/ui/action_overlay_darwin.m b/src/ui/action_overlay_darwin.m index c08de6d..30702c4 100644 --- a/src/ui/action_overlay_darwin.m +++ b/src/ui/action_overlay_darwin.m @@ -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; @@ -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]; @@ -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 @@ -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]; @@ -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(