You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clicking on the blank (unlinked) area of a code lens line should focus and move the cursor #7749
VSCode Version:
Version 1.3.0-insider (1.3.0-insider) 57c833a
OS Version:
OS X El Capitan 10.11.5
Steps to Reproduce:
Click on the non-link area of a code lens line
Observe that nothing at all happens
Would really like it to at a minimum to focus the editor (if not already focused), but we really love it if it move the cursor to the previous line. I find myself VERY often clicking on that area to start typing above it and nothing happens.
I'm assuming (maybe) that this wouldn't be a difficult change -- so if someone had the time to point me in the vague direction, I would be happy to attempt to open a PR for this. :)
if (browser.isIE11orEarlier) {
// IE does not want to focus when coming in from the browser's address bar
if ((<any>e.browserEvent).fromElement) {
e.preventDefault();
this.viewHelper.focusTextArea();
} else {
// TODO@Alex -> cancel this if focus is lost
setTimeout(() => {
this.viewHelper.focusTextArea();
});
}
} else {
e.preventDefault();
this.viewHelper.focusTextArea();
}
} else if (targetIsViewZone) {
let viewZoneData = <editorBrowser.IViewZoneData>t.detail;
if (this.viewHelper.shouldSuppressMouseDownOnViewZone(viewZoneData.viewZoneId)) {
e.preventDefault();
}
}
The reason focusing is complicated is because IE has some weirdness around redirecting focus when coming from the URL bar and doing a mouse down. And the shouldSuppressMouseDownOnViewZone already is a good indicator that the view zone does not want to handle mouse events.
Activity
eamodio commentedon Jun 16, 2016
I'm assuming (maybe) that this wouldn't be a difficult change -- so if someone had the time to point me in the vague direction, I would be happy to attempt to open a PR for this. :)
alexdima commentedon Jun 17, 2016
Eric Amodio (@eamodio) PR welcome! :)
It is in https://github.com/Microsoft/vscode/blob/master/src/vs/editor/browser/controller/mouseHandler.ts#L272
I would extract the code that does the focus:
to a closure called
focusinside the method.Then, at https://github.com/Microsoft/vscode/blob/master/src/vs/editor/browser/controller/mouseHandler.ts#L296 you can call
focus()and thene.preventDefault():The reason focusing is complicated is because IE has some weirdness around redirecting focus when coming from the URL bar and doing a mouse down. And the
shouldSuppressMouseDownOnViewZonealready is a good indicator that the view zone does not want to handle mouse events.Fixes microsoft#7749 - Focus on CodeLens click
Fixes microsoft#7749 - Resolves the layer break
Merge pull request #9249 from eamodio/code-lens-focus
Fixes microsoft#7749 - Focus on CodeLens click
Fixes microsoft#7749 - Resolves the layer break
Merge pull request microsoft#9249 from eamodio/code-lens-focus