-
Notifications
You must be signed in to change notification settings - Fork 11
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 copy and paste #36
Comments
This is an interesting UI issue, and it would be good to experiment with it. It's not 100% clear what the right answer is, so we need to keep an open mind. The easy case is if someone selects plain old text within a language box: at the moment, we copy that as text, and the user can't really spot whether it was copied as a tree or text. A somewhat easy case is if someone selects all of a language box (but nothing either side of it): it seems intuitively clear that we should copy the tree structure, so that it can be pasted back in and "remember the tree structure". [We can simplify this to "copy the language box terminal" which just so happens to have a tree structure inside it.] Then we get to some hard cases. What happens if we select half a language box? At such a point, we can't easily copy a tree, because the user selected a partial tree. One way is to continue doing what we currently do: squish stuff into text and paste things in later as text. Similarly, imagine if I have something like This suggests to me that perhaps the fully right answer is to allow a) copying partial trees b) copying tokens with partial contents. But I'm not entirely sure this is the fully right answer. And I think even a half-way solution might be a bit better than what we currently have. |
Agreed. My suggestion would be to always try to copy some (partial) subtree if possible and fall back to copying terminals otherwise. Another thing we need to remember is that we still should put the copied area as normal text into the clipboard so it can be pasted into other programs. So Eco needs to have an internal clipboard that can copy and paste whole trees and the OS clipboard which contains a textual representation. |
I agree completely that we still have to copy plain text to the Unix clipboard. Notice one thing I said though: copying terminals isn't completely obvious, because sometimes users select text that is only part of a terminal. What should the type of such a copied terminal be? I have absolutely no idea... |
The type would be none and then the incremental lexer will take care of finding a type if possible. E.g. half of |
OK, that sounds sensible to me. |
TODO:
* when pasting language boxes, only create new language box if target position is in another language, otherwise paste nodes/subtrees only. Problem: Languages that allow languageboxes with the same language as the parent |
@ptersilie this one looks like it might be worth keeping? |
Copy and paste currently takes a sequence of selected nodes and converts them to text before pasting. It would be preferable to copy and paste the nodes directly. Care needs to be taken with language boxes.
/cc @ltratt @ptersilie
The text was updated successfully, but these errors were encountered: