Open supertobi opened 13 years ago
I would like to support it. Anyone with a Linux development box wants to give it a shot?
I'm currently working on embedding Ace and it bothers me a lot not to have this functionality.
I'm willing to give it a shot, and to help developing, etc
I basically can't function in RStudio because of this one thing. Other than that, I love it to death.
Anyone want to point me at the appropriate place in the code, I will give it a whack as time permits. The RStudio guys kindly pointed me over here when I asked (in so many words) 'WTF?' so I guess that means it's up to me (or someone) to fix it in Ace. Seems like a fair trade what with RStudio and Ace being free and open...
@ttriche, same here (and why I'm watching this issue ;)
Let me know if you find your way and how to solve that.
Try commenting out event.preventDefault on mouse clicks and see if it makes copy and paste work.
On Saturday, August 20, 2011, tttp < reply@reply.github.com> wrote:
@ttriche, same here (and why I'm watching this issue ;)
Let me know if you find your way and how to solve that.
Reply to this email directly or view it on GitHub: https://github.com/ajaxorg/ace/issues/175#issuecomment-1860734
@ttriche have you tested?
Trying to figure out where in RStudio to do this. Otherwise I'll have to pull down Ace itself. Will look again, thanks for the reminder (and thanks @fjakobs for the suggestion)
On Thu, Aug 25, 2011 at 2:37 PM, tttp < reply@reply.github.com>wrote:
@ttriche have you tested?
Reply to this email directly or view it on GitHub: https://github.com/ajaxorg/ace/issues/175#issuecomment-1904260
If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is. John von Neumannhttp://www-groups.dcs.st-and.ac.uk/~history/Biographies/Von_Neumann.html
I think the culprit is in
However, I'm not sure which mouse event not to suppress. Also, I'm going to have to rebuild the entire thing afterwards, which while not that big a deal, will almost certainly cause some problems the first time around. So if I can avoid fucking this up I'll be happier about it :-)
@fjakobs any suggestions? Beyond your already-very-helpful ones that is. Thanks much for your assistance and your editor!
On Thu, Aug 25, 2011 at 2:45 PM, Tim Triche, Jr. tim.triche@gmail.comwrote:
Trying to figure out where in RStudio to do this. Otherwise I'll have to pull down Ace itself. Will look again, thanks for the reminder (and thanks @fjakobs for the suggestion)
On Thu, Aug 25, 2011 at 2:37 PM, tttp < reply@reply.github.com>wrote:
@ttriche have you tested?
Reply to this email directly or view it on GitHub: https://github.com/ajaxorg/ace/issues/175#issuecomment-1904260
If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is. John von Neumannhttp://www-groups.dcs.st-and.ac.uk/~history/Biographies/Von_Neumann.html
If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is. John von Neumannhttp://www-groups.dcs.st-and.ac.uk/~history/Biographies/Von_Neumann.html
You could try to disable the mouse handler in https://github.com/ajaxorg/ace/blob/master/lib/ace/editor.js#L70 completely to see if it works at all.
this isn't possible to fix in browser since browser doesn't provide any means for accessing primary clipboard, but it will be very easy for rstudio to add support for this see https://github.com/MikeRatcliffe/Acebug/commit/af64219198f9406b679a733f4fab934789a0029a#L0R521 for an example of firefox addon doing it
Would be awesome to see this working in Rstudio! Which otherwise is great thing.
On Chrome, you can listen to paste events on non-input element (CodeMirror listens on its outer div), and respond to them by quickly re-focusing the hidden textarea. That makes middle-click paste work. If you display the selection in the hidden textarea, and select it, Chrome also puts in on the middle-mouse clipboard. (But there are also reasons not to do this all the time -- it's slow for big documents.)
On other browsers, I don't know of any way to get this to work.
I tried Ace on a virtualized Ubuntu and the middle mouse button paste works. There's only one curious problem: the textarea gets shifted around.
For example, when pasting with the middle mouse button, the textarea goes to the side:
The textarea should always be right next to the cursor:
.
Does middle-mouse-button paste do something different? Regular paste in Linux works.
I can't middle-clck -> paste at all in ace in Firefox 18.0 on Ubuntu 12.10
@karelfiser I'll try with Firefox when I get a chance. With Chrome it works--can you test that, just to be sure?
Feels the same in Chromium 22.0.1229.94. And in both you can paste in what you put into middle-mouse clipboard from outside (e.g. text editor).
@karelfiser Actually I can get it to paste in Firefox 18, too. I have to sometimes double click, but it works.
Personally, I think the only Ace error here is the shifting <textarea>
calculation. I would be more inclined to believe that everything else is vendor or OS problems. I don't use Linux so I really don't know. When I go to other text areas on the web, it seems like the middle mouse button paste is rather slow to insert.
Ok, so the reason the text box is off is the calculation here:
var rect = host.container.getBoundingClientRect();
var move = function(e) {
text.style.left = e.clientX - rect.left - 2 + "px";
text.style.top = e.clientY - rect.top - 2 + "px";
};
move(e);
Either getBoundingClientRect
or e.clientX / clientY
are being calculated incorrectly with only the middle mouse button paste. I am not sure how to dig deeper. This code executes only on Linux middle mouse button paste-- @nightwing do you have any ideas on when else it is called?
textarea shifting isn't really a bug, both for contextmenu and middle click it is moved to the mouse to capture click event https://github.com/ajaxorg/ace/blob/master/lib/ace/mouse/default_handlers.js#L81 unfortunately new firefox versions do not paste anything if mousedown wasn't in the textarea (that's why only double click works) for copying from the editor, we need to put selected text into textarea and select it, like CodeMirror does, but that works only on chrome
My most frequent need is to copy from a part of the code to another in the same editor. I can't do it in an ace edit box, but it works perfectly in a plain html textarea. I have already discarded many IDEs just for this inability, and this keeps me away of Cloud9 and other products using ace.
Looks like this thread has been going on for two years now. What's the status? Everything else (even Eclipse) on my Linux box can copy/paste using the mouse only, as Nature intended.
nothing new here?
Will this or won't this be implemented in Ace?
Same question.
I have the same problem, I found a "hacky" workaround though that works for the time being :smile:
in our specific code (but I'm sure you will find a proper place for it)
editor.middleClick = false;
editor.on("mousedown", function (e) {
if (e.domEvent.which == 2) { // middle click
editor.middleClick = true;
var tempText = editor.getSelectedText();
if (e.$pos) {
editor.session.insert(e.$pos, tempText);
}
window.setTimeout(function () {
editor.middleClick = false;
if (e.$pos) {
editor.moveCursorTo(e.$pos.row, e.$pos.column + tempText.length);
}
}, 200);
}
});
and here https://github.com/ajaxorg/ace/blob/master/lib/ace/keyboard/textinput.js#L266
var handleClipboardData = function(e, data) {
if (typeof host.middleClick != "undefined" && host.middleClick){
return host.getSelectedText() || " ";
}
....
I know it's not the best but it works ;)
@nightwing Can this be used? (cut/copy support introduced in Firefox 41)
https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand
True X-Mouse works really well. Set it to run on startup.
so now i need to install Windows on an x11 machine for an x11 functionality?
Might be interesting too: codemirror/CodeMirror#931
Seems there is a Firefox bug with the middle mouse click.
Any updates on this?
The current version of ace (can be tested https://ace.c9.io/) uses the mechanism used by Codemirror, so for short selections (<500 characters) copying and pasting with middle click works on chrome.
The firefox issue is marked as fixed but it is not fixed, so we can't do much for it.
I have also opened a feature request to w3c/clipboard-apis spec to add a new api for setting the value of primary clipboard.
In firefox pasting with middle mouse click works now too. My problem is selecting. I played around with javascript today and it seems that nothing selected by firefox is passed on to the linux window manager. So the middle paste always pastes what you selected last with the window manager, not something you selected by javascript.
For firefox, if it can help to make it work easier, there is the option in about:config to paste using middleclick. Maybe it is more stable?
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
I'm missing copy and past with the middle mouse button like it is usual on Linux systems.
Most Linux distros are configured the click of a middle mouse button as paste operation. All you have to do is select text, move your most to another window and hit the middle mouse button. If you have a scroll wheel, just press on it to past the text. If you see only two buttons, just hit both button simultaneously i.e. you can emulate a third, "middle" button by pressing both mouse buttons simultaneously.
@gissues:{"order":86.33540372670814,"status":"backlog"}