Author Topic: "edit" command doesn't work with "~" path  (Read 9722 times)

jbhurst

  • Senior Community Member
  • Posts: 405
  • Hero Points: 33
"edit" command doesn't work with "~" path
« on: April 01, 2008, 07:36:07 PM »
Hi,

With SlickEdit 13.0.0 on Linux, I try the command e ~/.bashrc. I get a dialog box "Path not found".

This works correctly on SE 12.0.3. I don't think the beta had this problem, but I'm not 100% sure.

Regards

John Hurst
Wellington, New Zealand

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: "edit" command doesn't work with "~" path
« Reply #1 on: April 01, 2008, 09:10:15 PM »
Maybe just your 'def_unix_expansion' setting is lost. HS2

jbhurst

  • Senior Community Member
  • Posts: 405
  • Hero Points: 33
Re: "edit" command doesn't work with "~" path
« Reply #2 on: April 02, 2008, 01:36:27 AM »
Thanks for the suggestion, but def_unix_expansion doesn't seem to make any difference for me. Is that variable relevant on Linux?

Anyone else seeing this?

John Hurst
Wellington, New Zealand


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6934
  • Hero Points: 531
Re: "edit" command doesn't work with "~" path
« Reply #3 on: April 02, 2008, 03:02:40 PM »
This is a bug. I made a fix to edit() which made this bug rear it's head.

In the function: _unix_expansion()

Change:
Code: [Select]
      } else if ( ch=='~' && j == 1) {


To:
Code: [Select]
      } else if ( ch=='~' && (j == 1 || substr(cmdline,j-1,1)==' ')) {




jbhurst

  • Senior Community Member
  • Posts: 405
  • Hero Points: 33
Re: "edit" command doesn't work with "~" path
« Reply #4 on: April 02, 2008, 07:11:39 PM »
Hi Clark,

Thanks for the fix. Now it works OK from the command-line.

Funny thing, it still doesn't work from macros. I have a macro that opens my .bashrc:
Code: [Select]
_command void jh_edit_bashrc() name_info(',') {
  edit('~/.bashrc', EDIT_RESTOREPOS);
}

This used to work fine. Now with SlickEdit 13.0.0 I need to change it to
Code: [Select]
_command void jh_edit_bashrc() name_info(',') {
  edit('/home/jhurst/.bashrc', EDIT_RESTOREPOS);
}

to make it work.

Odd?

John Hurst
Wellington, New Zealand

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6934
  • Hero Points: 531
Re: "edit" command doesn't work with "~" path
« Reply #5 on: April 02, 2008, 08:16:46 PM »
Ah yes....the above code is no longer supported.  Previous versions of SlickEdit would call _unix_expansion() twice.  This caused some bugs. The new code ensures that it is only called once.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: "edit" command doesn't work with "~" path
« Reply #6 on: April 02, 2008, 08:22:33 PM »
But this should (still) work, right ?
Code: [Select]
edit(_unix_expansion ('~/.bashrc'), EDIT_RESTOREPOS);HS2

jbhurst

  • Senior Community Member
  • Posts: 405
  • Hero Points: 33
Re: "edit" command doesn't work with "~" path
« Reply #7 on: April 02, 2008, 09:11:11 PM »
I don't get it.

Code: [Select]
_command void jh_edit_bashrc() name_info(',') {
  edit('~/.bashrc', EDIT_RESTOREPOS);
}

Are you saying this code isn't supported???

Seems strange ...

John Hurst
Wellington, New Zealand

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6934
  • Hero Points: 531
Re: "edit" command doesn't work with "~" path
« Reply #8 on: April 03, 2008, 04:01:37 PM »
In gerneral, commands like edit() MUST NOT call _unix_expansion().  edit('~/whatever') won't work and should not work.  You need to explicitly call _unix_expansion like HS2 described.

Code: [Select]
edit(_unix_expansion ('~/.bashrc'), EDIT_RESTOREPOS);

Clark