Repository navigation
mac: the completion popup's chrome follows the appearance - #300
Merged
Merged
Conversation
Owner report: in light mode the documentation pane under the completion list is dark, so its text is hard to read. CALayer takes CGColors, which carry no appearance -- they are resolved once, against whatever appearance is current when assigned. The panel is built before it is attached to a window, so windowBackgroundColor and separatorColor were resolved against the application's appearance at init and then never changed. Text colours were always right, because NSTextField keeps the dynamic NSColor and resolves it at draw time -- which is exactly why the pane ended up dark-background with light-mode text. PopupChrome re-resolves both colours inside effectiveAppearance.performAsCurrentDrawingAppearance, and observes effectiveAppearance so a light/dark switch while the panel exists is picked up too. NOT YET BUILT OR TESTED: written on Linux; the session's usage window is at 94% of its cap, so the Mac build and suite run are deferred. Do not merge before and pass and the pane is eyeballed in both modes. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar
marked this pull request as ready for review
September 14, 2026 04:09
This was referenced Sep 14, 2026
d-q222
added a commit
that referenced
this pull request
Sep 14, 2026
…itch (GH#280, probe) The regression tests #280 asks for. Each opens a document into a fresh editor with no document switch, then asserts that (a) the text carries syntax-colour temporary attributes, (b) typing \se through keyDown requests the list once and a real completion session opens, and (c) the typed command is coloured. Three hostings: - the bare SourceEditorView with the document present before mount; - the bare SourceEditorView with the document opened after mount; - the whole ContentView at the app's 1200x640 minimum size. All three pass on main 9bd4b02, so the owner's report does NOT reproduce under hosted conditions. Since the reported 8a5ac44 build, only 0f8ba91 (#300, popup appearance) has touched the editor sources. Ruled out by reading the code: view identity (EditorPane has no .id), the empty visible-window paint (window(for:) paints everything without a window), and diagnostic marks clearing the colours (MarkPainter removes only underline/tooltip keys). What remains differs between these tests and the bundled app: a key/active window, an attached producer delivering compile results, launch-time session/seed paths, and preferences such as Vim keybindings. Findings and questions are on #280. Implementation-Agent: daniel-vpclaude (Claude Code, Claude Pro plan) Commit-Executor: daniel-vpclaude, direct git (Cursor-limit fallback) Co-authored-by: d-q222 <[email protected]> Claude-Session: https://claude.ai/code/session_012iWhnaQddU1UTMh6ZssGBJ
GoKubar
pushed a commit
that referenced
this pull request
Sep 14, 2026
…280) (#309) * mac tests: first-focus colouring and completion without a document switch (GH#280, probe) The regression tests #280 asks for. Each opens a document into a fresh editor with no document switch, then asserts that (a) the text carries syntax-colour temporary attributes, (b) typing \se through keyDown requests the list once and a real completion session opens, and (c) the typed command is coloured. Three hostings: - the bare SourceEditorView with the document present before mount; - the bare SourceEditorView with the document opened after mount; - the whole ContentView at the app's 1200x640 minimum size. All three pass on main 9bd4b02, so the owner's report does NOT reproduce under hosted conditions. Since the reported 8a5ac44 build, only 0f8ba91 (#300, popup appearance) has touched the editor sources. Ruled out by reading the code: view identity (EditorPane has no .id), the empty visible-window paint (window(for:) paints everything without a window), and diagnostic marks clearing the colours (MarkPainter removes only underline/tooltip keys). What remains differs between these tests and the bundled app: a key/active window, an attached producer delivering compile results, launch-time session/seed paths, and preferences such as Vim keybindings. Findings and questions are on #280. Implementation-Agent: daniel-vpclaude (Claude Code, Claude Pro plan) Commit-Executor: daniel-vpclaude, direct git (Cursor-limit fallback) Co-authored-by: d-q222 <[email protected]> Claude-Session: https://claude.ai/code/session_012iWhnaQddU1UTMh6ZssGBJ * mac editor: text typed at the edge of the painted window is coloured (GH#280) Measured cause. SyntaxPainter tracks `painted` ranges, the text whose temporary colours match the highlighter, and an edit's flush repaints only `painted ∩ dirty`. Its range arithmetic treated an edit that starts exactly at a painted range's end, or ends exactly at its start, as outside the range. Text typed at either edge was therefore never inside `painted` and never coloured. It only turned colour when something else repainted: a scroll, or a document switch, whose text reset repaints the window. That is the owner's "eventually comes" and "click another file and back". The startup document shows it directly. In the whole ContentView hosted like the app, with the caret at the end of the fixture text, typing " \se" left painted == [{0, 16}] over a 20-character text with 0 colour runs, while the highlighter held 1 run for \se. Fix: `shifted` joins edits that touch a range, using strict comparisons. The existing union branch already yields the right range for touching insertions and deletions; the new unit test pins eight cases. Tests (EditorFirstFocusTests): - testPaintedRangeAbsorbsEditsAtItsEdges and testStartupDocumentInContentViewIsColouredAndCompletes FAIL without this change and pass with it (verified by reverting only the source file); - the three earlier first-focus probes still pass. The completion half of the report did not reproduce: the list opens on first focus in every hosting. The owner's non-activating launch (window never key) is still to be checked in the real app. Implementation-Agent: daniel-vpclaude (Claude Code, Claude Pro plan) Commit-Executor: daniel-vpclaude, direct git (Cursor-limit fallback) Co-authored-by: d-q222 <[email protected]> Claude-Session: https://claude.ai/code/session_012iWhnaQddU1UTMh6ZssGBJ * mac tests: local focus probe for GH#280 (click + typing through window event dispatch) Skipped unless FLASHTEX_FOCUS_PROBE=1 because it takes keyboard focus. It hosts the whole ContentView in a window that was only ordered back, as in the owner's non-activating launch, then sends a real mouse click and real keyDown events through NSWindow.sendEvent. With #309 on this branch, the click gives the editor first responder (the window is still not key), the keys insert, typing \se opens a session, the CompletionPopup child window is visible, and the command is coloured. So completion on first focus does not reproduce through the real event path either. Left to check: app activation from an open -g launch, which a test process cannot emulate. Implementation-Agent: daniel-vpclaude (Claude Code, Claude Pro plan) Commit-Executor: daniel-vpclaude, direct git (Cursor-limit fallback) Co-authored-by: d-q222 <[email protected]> Claude-Session: https://claude.ai/code/session_012iWhnaQddU1UTMh6ZssGBJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Owner report: in light mode the documentation pane under the completion list is dark, so the highlighted entry's description is hard to read (screenshot in session).
Cause.
CALayertakesCGColors, and aCGColorcarries no appearance — it is resolved once, against whatever appearance is current when it is assigned. The panel is constructed before it is attached to a window, sowindowBackgroundColorandseparatorColorwere resolved against the application's appearance ininitand then never re-resolved. Text colours were always correct, becauseNSTextFieldholds the dynamicNSColorand resolves it at draw time — which is precisely why the result was a dark pane with light-mode text rather than a uniformly dark panel.Fix.
PopupChromere-resolves both colours insideeffectiveAppearance.performAsCurrentDrawingAppearance, and observeseffectiveAppearanceso a light/dark switch while the panel is alive is picked up too.Written on Linux, which cannot build Swift. The session's usage window is at 94% of its cap, so the Mac build and suite run were deferred rather than risk a lockout. Do not merge until:
swift buildis clean;swift test --skip NearbyInterfaceTests --skip NearbyLANInterfaceTestsmatches a control run of the same base (compare failing sets, not counts);I would rather hand over an unverified fix with its reasoning than a verified guess.