New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for Issue 42 #134
Fix for Issue 42 #134
Conversation
Wow this is massive. I don't really like the 'isMeta' flag on the change event. Why is this required? I'd prefer the 'move' function to be on the edit_session to keep the document as simple as possible. This might not be possible though if we can't find a nice solution for the 'isMeta'. |
two small issues
|
Fabian: the In the grand scheme of things, perhaps the solution here is not the ideal one. However, I think it's far beyond the purpose of this bug, of this patch, to make bigger improvements to the undo manager. Maybe you want to file a follow-up issue that specifically asks for improvements to the UndoManager. nightwing: thanks for testing the patch! I'll fix the issues you found. |
nightwing: you do manage to drop text on itself? Please give me a screencast or a list of exact steps to reproduce. I cannot reproduce the bug. I actually have code already in place that does check if you are dropping the selection in the same place, or if you put the drag cursor within the selection - it cancels the drag if you do this, and nothing bad happens: selection stays the same, cursor stops moving. |
Pushed a fix for making the selection draggable after triple click. Thanks nightwing! |
|
||
var selection = editor.getSelectionRange(); | ||
if (selection.contains(dragCursor.row, dragCursor.column)) | ||
return; |
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 should clear selection and move cusor to dragCursor
otherwise cursor is displayed inside selection instead of boundary
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.
That's on purpose. I believe I prefer this behavior, instead of loosing the selection. The user can use this to ... cancel the drag if he decides against dragging (if he suddenly changes his mind). It's like with clicking on buttons: you hold mouse down.... move out of the button to cancel the click. Here it's the opposite.
If Fabian wants, I can do that - I can clear the selection and move cursor to dragCursor location.
if mouse released when dragcursor is inside selection blinking cursor continues to remain inside selection |
Ah, right. That's on purpose. I thought of that and said ... well, perhaps the user wants to cancel the drag operation but not lose the selection. Fabian, what do you think? |
Hi Mihai, I have just tested this feature and I really like it. Just some remarks:
|
|
I don't want to break the current selection interaction. I just checked how apple is doing it. They also use the delay to distinguish between selecting and moving text. If the selected text is not too big it might be cool to attach it semi transparent below the mouse cursor (optional). http://www.screencast.com/users/fjakobs/folders/Jing/media/20ba9e53-a2a7-4602-8c62-53c0a0c6e5de |
there's no delay in dreamweaver (pc). but I suppose there are benefits either way. |
How about a technical and behavioral "compromise": if the user clicks on the margins of the selection (left or right) then we don't consider he wants a drag at all. No delays, nothing. We specifically change inSelection to be false when the mousedown event happens at the selection start/end points. Does this sound good for you? At least it does for me as a user and as the implementor, hehe. :) If you really want the delay-based approach, I can do it. No problem - I don't mind, I am just explaining my reasoning here: I think it's too complex for what we really want.
Also, thanks for your feedback! |
I really want the delay since this is what I think feels most natural. This is how I would implement it:
I'd create a separate function for each state. We will have to experiment what the best values for "delay" and "offest" are. I have tested the undo manager changes with your brach and it worked fine even without the meta events. |
Oky, thanks for your reply. Will look into implementing that behavior then. Great to hear you tested the undo manager changes with my branch. Thanks! |
So, I tested the undo manager changes with my local rebased branch for issue 42: things work fine. Good work dude! So, the 'move' event is no longer needed. |
The above is not very clear. The code below is what I understand from the given prose:
What if both distance and delay conditions are satisfied? Or did I miss understood something? |
Pushed the code which implements the desired delay. I don't like it much. :D
Fabian: please test and let me know what changes you want. I also added |
I agree that the behavior is a little awkward but you were almost there :-). I did some tweaks to your branch and I'm now fairly happy with the result. Basically you were missing the initialization of the drag selection. https://github.com/ajaxorg/ace/tree/issue-42 If you are also happy with it as well I will merge it to master. One thing I recognized is that while dragging I should be able to abort the drag by hitting escape. Though this will not hold me back from merging it to master. It is already in a state where I want to have it in master. |
Code's not working as desired, yet. Work in progress. :)
…, and removed the 'move' change event, which is no longer needed given the fixes in UndoManager.
I have fixed the triple click issue now as well. And pulled the issue-42 branch to master. Let me know if you are happy with the way it works. |
Thanks dude! Glad to see this pulled into the main Ace repo. |
Completed work on fixing Issue 42.
Comments are welcome. Please let me know if any changes are needed. Thanks!