IDE: paste with mouse targeting

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Grunz
User
User
Posts: 59
Joined: Sat Nov 12, 2011 7:21 pm

IDE: paste with mouse targeting

Post by Grunz »

Hello, I might be the only person in the world who wants this,
but I really would like to have the editor insert the text pasted by middle mouse button
at the text cursor position instead of where the mouse cursor is.
Ideally, this behaviour would be adjustable in the preferences.
This is a Linux only problem I guess .. no way to paste anything with the mouse under windows.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: IDE: paste with mouse targeting

Post by IdeasVacuum »

no way to paste anything with the mouse under windows
Right mouse click paste doesn't count?
Depending on your mouse driver, you should be able to set the middle button to mimic any keyboard key combo (Ctrl V for Windows). I would be very surprised if you couldn't do that on Linux too. It's really an OS thing, nothing to do with the PB IDE itself.
Last edited by IdeasVacuum on Sun May 04, 2014 11:07 pm, edited 1 time in total.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: IDE: paste with mouse targeting

Post by Tenaja »

Grunz wrote:Hello, I might be the only person in the world who wants this,
but I really would like to have the editor insert the text pasted by middle mouse button
at the text cursor position instead of where the mouse cursor is.
Ideally, this behaviour would be adjustable in the preferences.
This is a Linux only problem I guess .. no way to paste anything with the mouse under windows.
I don't know that the Linux equiv. is, but if you were on Windows, I know AutoHotKey could do it. I remapped the left Shift-Key to be a middle button on a mini kb/trackball. Just remap that middle mouse button to ctrl-v (or shift-ins) for your app.

...and tells us which script engine you use!
Grunz
User
User
Posts: 59
Joined: Sat Nov 12, 2011 7:21 pm

Re: IDE: paste with mouse targeting

Post by Grunz »

It doesn't work like this.
The paste via middle mouse button is default behaviour under X-windows since forever.
It is not a result of mapping things to mouse buttons.
Under X, usually all applications where one might paste something, you can do that with middle click.
For example Firefox text input filed which I'm using to write this, or the PB IDE.
Though it might be possible to map Ctrl+v to a mouse key, the middle click is supposed to paste the marked text
and NOT the content of the clipboard. Instead, they ask the X server what string is to be pasted.
What the application does with this string is for itself to decide.
This pasting method existed before any clipboard even existed under X.
So this is a Unix only issue.

In a standard terminal, one can not use ctrl+c for "copy" as it has to reach the terminal itself.
So getting anything into the clipboard from there is very clunky.

To paste at mouse cursor position seems to be the standard - all applications I found - (unless they are pure terminal types and don't know anything about mice) - do that. It's driving me nuts.

As I said: I might be the only person in the world who'd rather use the text cursor position...
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: IDE: paste with mouse targeting

Post by IdeasVacuum »

...well, your original post really left out some important information Grunz! I think Tenaja's suggestion is viable, but if you had a mouse with a smart enough driver it would do it in a similar way- for example, the devices made by 3dconnexion (mostly for use with 3D CAD-CAM) can be programmed for that type of thing.......

Under the hood it is the matter of a script:
1) From currently active window, collect highlighted text (temp store in memory)
2) On middle-click, paste text at caret position

What if you were copying and pasting from one app to another? That's more complicated - wouldn't it mean that the text selected would always have to be stored on-the-fly? That's more difficult for an auto-it type script. It does sound like mouse driver territory, but on Windows I think it's possible to 'hook' the mouse on Windows and have a PB app do the job.

So, back to the PB IDE. Are you saying that you only want this capability for use in the PB IDE and that you are only copy-pasting within the IDE, not from another app or web page?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Grunz
User
User
Posts: 59
Joined: Sat Nov 12, 2011 7:21 pm

Re: IDE: paste with mouse targeting

Post by Grunz »

I want to - and I am pasting from other applications like text terminals and web browsers.
And it does all work already... the selected text area is exported to the X window system automatically by every application I can think of.
So one can select in one window and then switch to some other and paste with middle mouse click.
Just where the text end up is bugging me.
For a global solution, I would required some hook-in to hide the mouse click from all applications and instead feed them with the text by emulating keystrokes.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: IDE: paste with mouse targeting

Post by Tenaja »

A scripting engine with the power of AHK can do it.

I would doubt Fred will do it, out of the interest of consistency. Not that I think it is a bad idea, but imagine developing for multiple platforms, and every OS has an entirely different behavior with mouse clicks and shortcut keys...
Post Reply