-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[linux] Middle-clicking file to close it adds $ at cursor position #7216
Comments
Also, if the first file has unsaved changes, the file will close as expected and |
I can reproduce it in a vanilla CodeMirror demo page in the Chrome browser. So I just filed an issue codemirror/codemirror5#2384. |
Interesting - I can't repro it, neither in Brackets nor in the CM demo. |
This is Linux only issue. |
@RaymondLim CodeMirror shouldn't even receive this event, if I'm not mistaken? Since it's part of the Brackets UI that is being clicked. As a side note, I couldn't reproduce in the markdown demo. |
@bfrohs You need to click into the CM input text field, not in other UI. |
@RaymondLim yes, I'm aware. I couldn't get
|
Interesting! Marijn cannot reproduce the $ insertion as you. So there must be something different in the Chrome browsers. Regarding the two issues they are essentially the same one. When you middle-click on the filename, you're actually interacting with a DOM node and the mouse event should not be propagated to other nodes. But in this case it is propagated to the DOM node of the editor instance for the other document that becomes active after closing the first file. |
@RaymondLim I'm a little confused by that statement about the event propagation. The working set list is not in the same DOM subtree as the CM instance, so there's no reason why a mouse event should bubble from one to the other. |
@peterflynn I'm just guessing what might happen since both side bar and editor have the common DOM node of "main-view". It seems to me that the event is not cleared by the tree node which closes the second file and then the editor gets the event. |
There aren't many cases where CM listens to things above its own DOM hierarchy, where the event would bubble up to. And of course the event isn't going to traverse back down another branch to get to CM's own DOM nodes... @bfrohs It's possible to use dev tools to see who's getting the mouse events when you middle-click. Can you try this?
Also, just to make sure: does this also happen if you reload with Debug > Reload Without Extensions? |
Interestingly enough, there aren't any listeners for And yes, it still happens after reloading without extensions (first thing I tried). |
The |
@bfrohs What about a |
@peterflynn There are several |
@bfrohs In case you're not aware of, Marijn already fixed it in codemirror/codemirror5@475b2be and we will get the fix with next CM update in Brackets. Regarding middle click it is a feature in Linux to do the pasting. |
@RaymondLim Middle-clicking a filename in the sidebar shouldn't be able to focus the CodeMirror instance in order to paste though. |
@bfrohs It depends on how middle-clicking is supported in Brackets. In the working set the focus is set to the next document as part of closing the current one you middle-click on. And for the project tree I'm not aware of any middle-click support, but it can be part of jstree implementation that triggers a node selection on any mouse click. |
@RaymondLim @peterflynn It looks like this is an issue in Chrome where middle-click paste works inside of a timeout (unlike in Firefox). Take this fiddle for a spin:
Expected: Textarea should be selected and contents should be the same. Actual: Textarea is selected and contents are changed. This could be worked around by moving actions (esp. the "middle-click file close" action) to
|
@RaymondLim It looks like this might have been fixed in CM: codemirror/codemirror5@357e941 |
Confirmed that recent update to CM fixes the issue of pasting $ sign. Closing. |
Re-opening as 'tracking' since we're still not shipping a build that contains this fix -- the fix in CM landed 6/23 and the CM we're shipping in both 0.41 and 0.42 is only updated up to 5/28 or so. (We had to revert our CM update in 0.42 at the last minute due to a rendering bug -- see #8554). |
Fixed and closed. |
I'm still experiencing the problem where middle-clicking a file in the 'Working files' list will insert the last selection (from any application) into the next open file. As far as I am aware, this is caused by the same issue as the phantom Did this fix not make it into 43? |
@joepie91 I'm coming across the issue still as well. Tried to point out that there were two issues at play in the comments, and then mentioned the CodeMirror fix wouldn't fix this. This comment should help to fix. |
@joepie91 If you're running from git, make sure you're doing |
@bfrohs and @joepie91 Yes, I can reproduce it with a selection in the clipboard, but no longer with the @dangoor How do you handle middle click events in the sidebar in your pull request #9015? I'm not 100% sure that we handled it onmousedown, but @bfrohs said our old jstree is handling onmousedown. Is it possible for you to use click events instead of mousedown? |
@peterflynn I am currently not running from git, but from the package in the aforementioned repository, which appears to be based on the Debian packages. @RaymondLim I can't reproduce it with |
@RaymondLim I have not touched the working set. |
Steps to reproduce
Expected results
First file should close.
Actual results
First file closes and
$
is added to beginning of second file.Notes
The text was updated successfully, but these errors were encountered: