-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
As if I were not already spoiled on multiple cursors, this will make coding so much better. :D |
No, I can't repro that issue. |
YAY!!! Thanks!! I hope this can make it into 1.0, please :) |
Is it too late to get this in 1.1? |
From my point of view, it's totally fine to merge it now. A test phase of ~7 days should be enough for testing (with various extensions). Also, the diff is actually quite small, so I don't see any problem there. |
Bumping. We want this in 1.1. :) |
@@ -123,6 +125,7 @@ define(function (require, exports, module) { | |||
|
|||
PreferencesManager.definePreference(CLOSE_BRACKETS, "boolean", false); | |||
PreferencesManager.definePreference(CLOSE_TAGS, "Object", { whenOpening: true, whenClosing: true, indentTags: [] }); | |||
PreferencesManager.definePreference(DRAG_DROP, "boolean", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new feature is enabled by default. New features are usually off by default so as to not update current behavior, but I can be swayed by public opinion. What does everyone else think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it should be enabled by default, since is not a visual feature, or something that changes any behaviour, it just enables a new action of drag and drop. Unless for some reason you were clicking and dragging, this feature shouldn't change anything, and every user that expects to be able to drag and drop text, will not need to change a preference, which are a bit hidden at this moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support enabling this default. As a user, I would expect drag-and-drop to be enabled by default. Also what @TomMalbran said.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't heard anyone disagree, so I guess it's ok for this new feature to be on by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to be on by default.
I seem to remember someone saying that dragging text within editor was not enabled because it conflicted with drag and drop of files or folders, but that seems to work ok. Does anyone know of any conflicts that may be created by this? |
When I drag text, I see a drag cursor, but I was also expecting to see a pointer cursor when hovering over selected text like ST3 and VS. Any reason that was not added? |
The file-dropping issue is simply fixed by the little event handling code added in this PR. |
Done with initial code review. It seems like there may be too many remaining questions to get this in for 1.1, so hopefully we'll get it in 1.2. |
Not showing the pointer cursor is the same thing CM does, and I think this is a CM design decision (or at least, it has to be done in CM). |
I'd prefer the cursor to change when over selected text, but I can't figure out how to do it with existing DOM. Does anyone else have any opinions about this? cc @larz0 @njx |
You should be able to do it by just making a CSS rule for the selection style that sets the |
So, I tested this with multiple Windows editors I have installed:
So it looks like this is the de-facto standard on Windows. |
Ah, that makes sense. So yeah, let's make it a Windows-specific rule. |
@njx I can't get it to work either. Setting the style on |
Ah, it might be because the selection is drawn behind the text, so doesn't get the events. Probably worth asking Marijn for suggestions on how to fix it if we want to pursue this. |
@njx I asked him, and that's what I got: I don't know, though, if it's worth using that addon. |
Seems fine to me if it doesn't degrade performance significantly. |
Even with the addon enabled I can't seem to get it to work. I managed to change the text |
@marcelgerber The problem seems to be that containing class .platform-win .CodeMirror-selectedtext {
pointer-events: auto;
cursor: default;
} |
Yeah, that worked (but the code is still kind of ugly ;) ). |
@@ -268,6 +268,11 @@ div.CodeMirror-cursors { | |||
} | |||
|
|||
.CodeMirror-matchingtag { background: @matching-bracket; } | |||
|
|||
div.CodeMirror-selected { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want this on Windows only? (e.g. .platform-win div.CodeMirror-selected
).
The interesting thing is that, even with the latest commits, I don't always see the pointer cursor. If it doesn't work, I need to restart Brackets in order to get it to work again. Also, I couldn't fix the "cursor-change-while-dragging" problem, even though I tried all the CSS pseudo classes (like In case we can't resolve these issues, I'd rather go with just showing the caret while hovering a selection, even though that's apparently not the OS default. |
@marcelgerber You might need to add an additional class to toggle the pointer, and remove it while dragging. |
I don't think that will fix the first issue. |
Are you referring to the "don't always see the pointer cursor" issue? If so, I haven't see that -- got recipe? |
I can almost reliably repro it like this:
|
I opened codemirror/codemirror5#3020 for this to go into CM directly (CM actually manages some other cursors, too, like the crosshair while holding down Alt and the Drag & Drop cursor). |
I'm ok with merging "showing the caret while hovering a selection" for now and address the rest later. If nobody disagrees, let me know when that's ready for a final review. Note that it probably should be squashed. |
49b1181
to
a8984d3
Compare
@redmunds Done & rebased. Ready for final review/merge. |
Looks good. Merging. |
@marcelgerber Reminder: add new preference here |
Good news: |
Just wanna mention that I recently updated Brackets to version 1.2 on my OS X (didn't try it on Linux yet) and had no this feature (I waited so much) enabled by default. In my preferences file there was no such preference. So I had to add it there manually and it calls |
To avoid confusion, I just edited the first post to include the actual pref name and that it's off by default ;) |
The release notes and the update notification also both make it clear you need to change a pref to enable this, and call out the pref by name... |
@marcelgerber I'm not sure whether you are aware of this issue. But drag and drop is not working with PHP files. I tried with js, html, txt, css, less and py files. All are working fine. |
@sathyamoorthi It definitely works for me, even in PHP files. Could you try it again with extensions disabled? |
@sathyamoorthi Can you file a new bug so we can track this? This PR is already closed. |
@marcelgerber Yes. It is working fine without extensions. Thx. |
Implements https://trello.com/c/io24Byhm/910-drag-and-drop-to-move-selected-text-within-editor.
Adds a new pref
dragDropText
(which is off by default)