Author Topic: Problem with shift home, shift end on Mac / OSX  (Read 3238 times)

SimonHF

  • Community Member
  • Posts: 43
  • Hero Points: 0
Problem with shift home, shift end on Mac / OSX
« on: September 12, 2014, 05:12:00 PM »
I am using Keyboard Maestro to remap the shift end key to Control Shift Right. This makes regular Mac apps behave like Windows/Linux apps and high-light text until the end of the line. However, it breaks SlickEdit because Control Shift Right on SlickEdit only high lights the next word. I have also remapped ctrl shift right to Option Shift Right which works fine in SlickEdit and other Mac apps. How can I change the SlickEdit Key Bindings to make Control Shift Right behave like shift End?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6680
  • Hero Points: 513
Re: Problem with shift home, shift end on Mac / OSX
« Reply #1 on: September 12, 2014, 09:49:07 PM »
There's no way to change this without modifying macro code. Although, making the change is pretty obvious. From the SlickEdit command line, type "fp cua_select". This will display the source for this command. The shift+selection keys are all bound to this command. There's some switch statements in there. Copy this macro to a local writable directory, change the name to "mycua.e", and delete everything but what's needed to compile the "cua_select" function. I repeat, don't keep source for functions that you don't intend to replace since this will cause more upgrade issues.

Search for "s-c-right". there should be a couple of hits.

Just replace:

Code: [Select]
_macro_call('next_word');
next_word();

with:
Code: [Select]
_macro_call('end_line');
end_line();

After you modify "mycua.e",  type "load" from the SlickEdit command line to load the new version. Your cua_selection function will replace the existing version.

Now for the bad new. Making changes in system macros, can be dangerous. So don't expect upgrading to always work. The code for cua_select has changed a bit in v19 due to the new multiple cursors/selections support. You will have to redo all your changes against the new cua_selection function source.

On a positive note, I don't expect any changes to the cua_selection function in v20 unless a bug is found or there's some sort of performance issue.

SimonHF

  • Community Member
  • Posts: 43
  • Hero Points: 0
Re: Problem with shift home, shift end on Mac / OSX
« Reply #2 on: September 12, 2014, 10:09:10 PM »
Excellent! It worked! :-) And I added in the s-c-left case too using begin_line. And the whole exercise makes me feel like a SlickEdit developer now :-) Thanks!

SimonHF

  • Community Member
  • Posts: 43
  • Hero Points: 0
Re: Problem with shift home, shift end on Mac / OSX
« Reply #3 on: September 19, 2014, 05:06:20 PM »
Hmmmm... this was working perfectly but now it has mysteriously stopped working. If I go back to mycua.e file then typing giberish and running load fails as expected. However, no matter what I put into the s-c-left and s-c-right else statements, it always ends up doing prev_word() and next_word(). This happens even if I comment out all the code in the else statement! What could be going wrong?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6680
  • Hero Points: 513
Re: Problem with shift home, shift end on Mac / OSX
« Reply #4 on: September 19, 2014, 09:07:55 PM »
Post your mycua.e. We will check it.

SimonHF

  • Community Member
  • Posts: 43
  • Hero Points: 0
Re: Problem with shift home, shift end on Mac / OSX
« Reply #5 on: September 19, 2014, 11:39:04 PM »
Please find the file attached. Looking forward to your comments.

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 36
Re: Problem with shift home, shift end on Mac / OSX
« Reply #6 on: September 22, 2014, 03:39:02 PM »
Your file looks fine, and works as expected for me.  If you remove the gibberish and reload the macro, does it work again?