Open clandrew opened 4 years ago
Issue persists after update to July 2020 (version 1.48)
Looked at it more, I think I understand the issue now. There's a problem with how it treats window focus. If the selected text is blue (using default coloring scheme), I can copy it using Ctrl+C . However, if the selected text is grey (using default coloring scheme), I can not copy it.
Both are used as selection colors, but "Blue" is more focused than "Grey"
The big plot twist: Clicking anywhere in the context menu changes your selection from "Blue" to "Grey"
Showing some copying behavior
Only happens to me when using the custom title bar (which is the default on Windows)
This seems correct behavior when doubleClickToSwitchToEditor setting is on.
The cursor jumps into wrong line in the source markdown file when you click a word at the end of the long long sentence. For example, double clicking the last word of the sentence in the gif animation clandrew posted, will move the cursor to the line 4 of the markdown file.
This is because getEditorLineNumberForPageOffset
function calculates line number by interior division of clicked position using previous/next code-line bounds.
I think this bug can be solved by simply calculating the nearest line of clicked position with function like
export function getNearestEditorLineNumberOfPageOffset(offset: number): number {
const { previous, next } = getLineElementsAtPageOffset(offset);
if (!next) {
return previous.line;
}
const previousBounds = getElementBounds(previous);
const previousBottom = previousBounds.top + previousBounds.height + window.scrollY;
const nextTop = getElementBounds(next).top + window.scrollY;
if ((offset - previousBottom) <= (nextTop - offset)) {
return previous.line;
} else {
return next.line;
}
}
Is it OK to make a PR to fix this?
@turara I have that setting turned on but still repro the problem (selecting text in Preview then clicking Edit->Copy causes only a blank line to be copied)
@clandrew Hmm. On my macOS, clicking Edit menu dose not steal focus 🤔
I think if you have that setting turned off, at least the following problem is solved.
Select a word by doubleclicking then Ctrl+C == Just the word is shown as selected (in grey), the whole paragraph is copied
@turara Ok yeah that's interesting if true, could help narrow things down. I have half a mind to factor the paragraph copying into a separate bug. In the beginning it seemed related to the Edit->Copy menu item problem but now I'm beginning to think it is not.
Also seeing this issue.
MacOS: 11.1 VS Code: 1.52.1
Still broken on 1.56.2
I renamed this bug to better reflect what was going on. The work-around suggested by turara concerns a different problem I mentioned in passing which is unrelated to the bug.
still broken (1.58.2) Any plan to fix this?
Issue Type: Bug
Expected: text from VSCode appears Actual: Only a blank space is pasted
VS Code version: Code 1.47.3 (91899dcef7b8110878ea59626991a18c8a6a1b3e, 2020-07-23T13:12:49.994Z) OS version: Windows_NT x64 10.0.20185