[Bug]: Nearby text cursor widget doesn't show on different display monitor · Issue #651 · intitni/CopilotForXcode · GitHub
Skip to content

[Bug]: Nearby text cursor widget doesn't show on different display monitor #651

Closed

Description

@shatodj

Before Reporting

  • I have checked FAQ, and there is no solution to my issue
  • I have searched the existing issues, and there is no existing issue for my issue

What happened?

A bug happened!

In case you move Xcode to another monitor, you'll not be able to see the widget anymore when "nearby text cursor" is set. It is working again when Xcode is moved to the main monitor.

How to reproduce the bug.

  • Move the Xcode to the other monitor then the main one

Relevant log output

macOS version

15.7.1 (24G231)

Xcode version

26.1.1

Copilot for Xcode version

0.37.0

Activity

  1. intitni commented on Nov 28, 2025

    @intitni
    Owner

    Thanks for reporting. Are you running Xcode in fullscreen? I can reproduce it when the Xcode window is fullscreen. What was the previous version you are using?

  2. shatodj commented on Nov 28, 2025

    @shatodj
    Author

    I can reproduce it on both fullscreen and not fullscreen, but everything is OK when Xcode is moved to the main monitor. It is also reproducible in Xcode 16.4.

  3. shatodj commented on Nov 28, 2025

    @shatodj
    Author

    Maybe this will also be helpful for you ;)

    Image
  4. intitni commented on Nov 28, 2025

    @intitni
    Owner

    The reason behind this issue is that the screen frame’s origin is set at the bottom left corner, while the windows start from the top left corner. Unfortunately, my display setup doesn’t seem to be revealing this case.

  5. intitni commented on Nov 28, 2025

    @intitni
    Owner

    Does this version work for you? https://github.com/intitni/CopilotForXcode/releases/download/0.37.0/Copilot.for.Xcode_test.zip

    The Xcode chat panel overlay has the same issue and I am still working on it.

  6. shatodj commented on Nov 28, 2025

    @shatodj
    Author

    Unfortunately it is not working for me. Same issue.

  7. intitni commented on Nov 28, 2025

    @intitni
    Owner

    Interesting.. Do you mind running the following code in a Swift Playground and show me the output? Make sure the playground platform is set to macOS.

    import AppKit
    import Foundation
    
    public extension NSScreen {
        var screenID: CGDirectDisplayID? {
            deviceDescription[.init("NSScreenNumber")] as? CGDirectDisplayID
        }
        
        var isPrimary: Bool {
            let id = screenID
            return id == CGMainDisplayID()
        }
    
        static var primaryScreen: NSScreen? {
            NSScreen.screens.first(where: \.isPrimary)
        }
    }
    
    print("""
    Screens: \(NSScreen.screens.map { screen in
        let id = screen.screenID.map { String($0) } ?? "unknown"
        let primaryMark = screen.isPrimary ? "(primary)" : ""
        return "- Screen ID: \(id) \(primaryMark), Frame: \(screen.frame)"
    }.joined(separator: "\n"))    
    """)
    
    if let screen = NSScreen.primaryScreen {
        let primaryMark = screen.isPrimary ? "(primary)" : ""
        print("Main Screen ID: \(screen.screenID ?? 0) \(primaryMark), Frame: \(screen.frame)")
    } else {
        print("No primary screen found.")
    }
  8. intitni commented on Nov 28, 2025

    @intitni
    Owner

    If you have time, please also give this version a try https://github.com/intitni/CopilotForXcode/releases/download/0.37.0/Copilot.for.Xcode_test2.zip

    This time, turn on the debug menu here

    Image

    And then turn on the overlay debug from the menu

    Image

    You should then see a green overlay on top of Xcode. Let me know if you can see them in all displays.

  9. shatodj commented on Nov 28, 2025

    @shatodj
    Author

    I can't see the green overlay for my current arrangement

    Image

    .. but I can see it for these:

    Image Image Image

    Also this one works with the main screen above:

    Image

    I'm strugeling with the Playground with AppKit.. not able to send you the output 🤦‍♂️

  10. shatodj commented on Nov 28, 2025

    @shatodj
    Author

    nah.. sorry.. the last one is not working eighter..

  11. intitni commented on Nov 28, 2025

    @intitni
    Owner

    That's weird.. I tried a similar arrangement and it was working for me.

    We will need to print some logs. Please use this version https://github.com/intitni/CopilotForXcode/releases/download/0.37.0/Copilot.for.Xcode_test3.zip

    Open Console.app, select the device you are using and click start streaming. Then paste to the search field subsystem:com.intii.CopilotForXcode and category:Debug one at a time. Try to move the window to different displays and type.

    You will see 5 types of logs:

    1. logs starting with "OverlayPanel", you will see what frame the overlay is setting to. (the first value starts from the bottom left)
    2. logs starting with "Focused windowFrame". When you see it, it mean the editor and the corresponding display is probably correctly detected.
    3. logs starting with "No focused editor". When you see it, it means either the editor or the corresponding display is not detected.
    4. logs starting with "Updating window locations", you will see what the frames are assigned to the widgets. Please pay attention to "Suggestion Panel Frame". Does it have a value? Is it inside the correct display? (origin from bottom left)
    5. logs starting with "Screen frames" shows you all the screen frames. (origin from bottom left). Usually the main screen has an origin zero.
  12. shatodj commented on Nov 28, 2025

    @shatodj
    Author

    So it started working for me with the recent version (probably also with the first test build you've sent me). I have to completely remove old Copilot For Xcode app and use just this one. I think it used the old bridge service.. Now I can see the dialog.

    Image

    Thank you very much for the fix! 👍

  13. intitni commented on Nov 28, 2025

    @intitni
    Owner

    Great! Releasing it soon!

  14. intitni commented on Nov 28, 2025

    @intitni
    Owner

    Fixed in 0.37.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions