[Codex Desktop][macOS] Starting a backward selection past end-of-line intermittently omits the final 1–2 characters
What version of the Codex App are you using (From “About Codex” dialog)?
Version 26.803.41515
What subscription do you have?
Pro
What platform is your computer?
Darwin 23.4.0 arm64 arm
What issue are you seeing?
This occurs in the rightmost source-code pane / file viewer in Codex Desktop, where the contents of the selected file are displayed.
When selecting multiple lines of text in that pane, the selection intermittently omits the final 1–2 characters of the last line.
For example, if the final line is:
WHERE department IS NOT NULL;
and I start the selection well to the right of the end of that line and drag upward to select several lines, Codex will sometimes select:
WHERE department IS NOT NULL
or:
WHERE department IS NOT NUL
instead of including the complete line.
The behavior is intermittent. Repeating essentially the same selection gesture can produce the correct result, omit the final semicolon, or omit the final L;.
I have attached a screen recording demonstrating the issue.
What steps can reproduce the bug?
https://github.com/user-attachments/assets/51a2e4c9-f2ac-46ca-b9ed-44dde1e3aafe
1 Open a file in Codex Desktop so its contents are displayed in the rightmost source-code pane. I originally noticed this while viewing a SQL database migration file.
2 Find several consecutive lines of text.
3 Place the mouse cursor clearly in the whitespace to the right of the end of the last line.
4 Click and hold, then drag upward to select that line and the preceding lines.
5 Repeat the selection several times.
Approximately half the time in my testing, the selection endpoint is placed 1–2 characters before the actual end of the line, despite the mouse-down beginning well beyond the end of the text.
A representative line from my test is:
WHERE department IS NOT NULL;
Observed selection endpoints include:
WHERE department IS NOT NULL; ← correct
WHERE department IS NOT NULL|; ← final character omitted
WHERE department IS NOT NUL|L; ← final two characters omitted
The attached video shows the cursor beginning substantially to the right of the line, which rules out accidentally starting the drag one or two characters too early.
This does not appear related to session ID, token usage, or context-window usage; it occurs while interacting with the source-code viewer/editor UI.
What is the expected behavior?
If the mouse-down occurs in whitespace beyond the end of a line, the selection anchor should resolve to the end of that line.
For example, starting the selection to the right of:
WHERE department IS NOT NULL;
should always include the complete NULL;.
Repeating the same selection gesture should not intermittently move the selection endpoint one or two characters to the left.
Additional information
The issue appears specifically related to translating the mouse position near/beyond the end of a rendered line into the corresponding text position.
The behavior is nondeterministic: with essentially identical gestures, I have observed the selection end at the true end of the line, one character early, and two characters early.
I initially wondered whether I was simply beginning the drag slightly too early. I therefore repeated the test while positioning the mouse far into the whitespace to the right of the line and stopping there before beginning the drag. The attached recording shows that the issue still occurs under those conditions.
The full-file source viewer appears to use CodeMirror. If so, this may be related to mouse-coordinate → document-position hit testing near the end of a line, although I have not independently reproduced the issue in standalone CodeMirror and cannot say whether the bug is in Codex's integration or upstream.
1 Comment
This looks like a contained hit-testing bug in the source viewer rather than a broad app issue. I think it is worth isolating the line-end coordinate mapping and keeping the fix narrow so the backward selection always resolves to the actual end of the line when the drag starts in trailing whitespace.