Author Topic: minor defect: "Mouse selection creates clipboard" not working  (Read 5618 times)

gangji

  • Junior Community Member
  • Posts: 7
  • Hero Points: 0
I am using SlickEdit 2013 (v18.0.1.2 64-bit), and noticed that this feature is not working.
Option -> Editing -> Selection -> checkbox for "Mouse selection creates clipboard"

a minor problem to be honest, but I found it very useful.

Anyone has the same problem?

Any suggestion or workaround will be appreciated,

thanks, ???

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #1 on: July 16, 2014, 01:53:17 AM »
It's working for me on Windows 7.  You use the middle mouse button to paste.  The selection doesn't go to the slickedit clipboard until after you do the paste  - is that what the problem is?  Are you expecting to see it on the slick clipboard as soon as you select the text?

gangji

  • Junior Community Member
  • Posts: 7
  • Hero Points: 0
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #2 on: July 16, 2014, 05:30:10 PM »
Thanks, I expect to be able to paste outside SlickEdit, I can see that I can paste it in SlickEdit, but it's not available on Windows Clipboard, which used to work in v2008.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #3 on: July 16, 2014, 06:56:52 PM »
@gangji: You're right. Seems there is a regression in SE v18 (at least) not longer creating a system clipboard entry for mouse selections even with def_autoclipboard = 1.
HS2

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #4 on: July 16, 2014, 10:14:52 PM »
There is a very minor macro bug due to switching to Qt.

make the following change in clipbd.e
Code: [Select]
void _autoclipboard()
{
   if (!select_active2()) {
      return;
   }
   if (def_autoclipboard) {
#if 0
      // This code can be slow.

      //If there is a external clipboard
      if (!_isclipboard_internal()) {
         // Make a copy of it internal
         _cvtsysclipboard();
      }
#endif

      int orig_markid;
      save_selection(orig_markid);
      _copy_to_clipboard('',!__UNIX__); //ONLY LINE CHANGED
      restore_selection(orig_markid);
      _lastcbisauto=1;
   }
}

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #5 on: July 16, 2014, 10:30:04 PM »
Thanks Clark ! I've noticed the slightly changed behavior of _copy_to_clipboard but since it's native..
HS2

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #6 on: July 17, 2014, 01:57:35 AM »
This fix sort of works. I don't know yet if I can do better or if it would be better to modify the built-ins. Unlike v16 this change effects regular paste as well as mou_paste(). Some how v16 was able to better differentiate between the mouse clipboard and keyboard clipboard with in the same process.  Of course when you switch apps, there's no way to differentiate them and that's ok. I'll look into this further to see if I can duplicate what v16 did exactly. I won't know if it's possible until I look into it further. This fix is pretty good though.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #7 on: July 17, 2014, 07:45:41 AM »
Why not adding one more default arg or a dedicated _mou_copy_to_clipboard for this rather specific scenario instead of doing maybe changing, platform dep. mouse event magic in the libs. In the 1st place there shouldn't be much impact.
Anyway - I'm sure you find a suitable, robust solution :)
Good luck, HS2
« Last Edit: July 17, 2014, 07:47:31 AM by hs2 »

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #8 on: July 17, 2014, 07:24:03 PM »
Ok, totally got this working like v16 now.

Need to modify two functions in clipbd.e. I've only modified 3 lines total.

Code: [Select]
void _autoclipboard()
{
   if (!select_active2()) {
      return;
   }
   if (def_autoclipboard) {
#if 0
      // This code can be slow.

      //If there is a external clipboard
      if (!_isclipboard_internal()) {
         // Make a copy of it internal
         _cvtsysclipboard();
      }
#endif
      int old_markid=_duplicate_selection('');
      int new_markid=_duplicate_selection();
      _show_selection(new_markid);
      _copy_to_clipboard('',!__UNIX__); //MODIFIED
      _free_selection(new_markid);
      _show_selection(old_markid);
      _lastcbisauto=1;
   }
}


void _cvtautoclipboard()
{
   if (_lastcbisauto) {
      //say('_cvtautoclipboard:');
      _str cb_format=_clipboard_format(VSCF_VSTEXTINFO,true); //MODIFIED
      _str pid,cbtype,info;
      parse cb_format with 'pid='pid cbtype info;
      if (getpid()==pid) {
         //say('_cvtautoclipboard: same pid');
         _cvtsysclipboard2(0,cbtype,info,false,true); //MODIFIED
      }
   }
}

Given how few changes this took, I don't think I should change the built-ins.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #9 on: July 17, 2014, 07:53:01 PM »
Quote
I don't think I should change the built-ins
Agreed and thanks :) .. but please don't miss the merge to the main and V19 trunk ;)
HS2

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #10 on: July 17, 2014, 10:41:19 PM »
My changes are in the "trunk" and checked in now that they are done  ;D

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #11 on: August 21, 2014, 10:06:26 AM »
I found and fixed more mou_paste issues that my macro fix above doesn't correct. v19 will have these fixes as well. The above macro fix doesn't allow you to use mou_paste to paste within SlickEdit. Also, I needed to make C++ code changes for mou_paste to work in a text box and combo box.

gangji

  • Junior Community Member
  • Posts: 7
  • Hero Points: 0
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #12 on: August 21, 2014, 12:52:20 PM »
Thanks Clark. does it come as a hotfix? I can wait for next release too.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: minor defect: "Mouse selection creates clipboard" not working
« Reply #13 on: August 21, 2014, 02:59:10 PM »
Sorry, there won't be a hot fix for this.