Author Topic: v11 filename completion bug/suggestion  (Read 16366 times)

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
v11 filename completion bug/suggestion
« on: July 11, 2006, 04:03:52 AM »
I use slickedit with commandline filename prompts. As of version 11 this feature now has a automatic popup completion list. Very cool. (previous versions would popup a list when pressing tab).

Anyway, in the new version, I pick Alt-E for edit (brief mode) and select a folder from the list and press enter, instead of going into the folder (useful) it tries to edit the folder as a file and gets an "access denied". (not useful nor intuitive).

I'm sure it's a simple macro fix. What do you think?

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: v11 filename completion bug/suggestion
« Reply #1 on: July 11, 2006, 07:15:31 AM »
Try TAB / <cursor>to cycle thru the list and SPACE to select.
In my opinion it's fine that ENTER immediately 'uses' the selected entry.
HS2

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
Re: v11 filename completion bug/suggestion
« Reply #2 on: August 11, 2006, 04:15:01 AM »
I think it's fine that enter immediately uses the selected entry.

What's not fine HOW it USES the selected entry when you select a folder.

Select a file and it immediately loads that file (perfect)
Select a folder and it immediately gives you an access denied error because it tried to load the folder as a file (not useful).

Instead if when you press enter on a folder it entered the folder immediately it would then actually be useful and still do something immediately when pressing enter
« Last Edit: August 11, 2006, 04:17:53 AM by greggman »

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: v11 filename completion bug/suggestion
« Reply #3 on: August 11, 2006, 09:16:46 AM »
Ok - now I got it.
And I agree - that would be one of these slick features I like too:
'edit' a dir 'changes' to it - cool !

I thought that can't that difficult and I made this small patch to make it work (@see the // HS2: comment)
Unfortunately it seems that there is no support for checking a path if it's a (local) directory.
The 'isdirectory' is just path-string handling :(
No guarantee that it doesn't break other stuff, but I did some testing and it seems quite ok.
('edit' already contains a lot of automagic stuff.)
However, this patch even doesn't break the 'auto-checkout' feature.

@see vc.e - window_edit2() [line 3211 for Slick v11.01]
Code: [Select]
static int window_edit2(_str filename)
{
   typeless status=edit_file(filename);
   if (! status) {
      int was_hidden=p_buf_flags&VSBUFFLAG_HIDDEN;
      p_buf_flags=p_buf_flags&~(VSBUFFLAG_HIDDEN|VSBUFFLAG_DELETE_BUFFER_ON_CLOSE);
      if (was_hidden) {
         call_list('_cbmdibuffer_unhidden_');
      }
   } else {
      // HS2: finally assume a dir and try to change to it
      status = cd (isdirectory(just_name(filename),'1'), '');
   }
   return(status);
}

If you like it, make a backup of 'vc.e', apply the patch, 'load' and enjoy.
And this file wiill be overwritten installing the next Slick release...

HS2
« Last Edit: August 11, 2006, 09:23:50 AM by hs2 »

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
Re: v11 filename completion bug/suggestion
« Reply #4 on: August 25, 2006, 12:27:38 PM »
thank you for creating that solution. It's great

I really hope that SlickEdit would make that part of the offical release. The way it by default where selecting a directory just gives an error message is arguably broken.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: v11 filename completion bug/suggestion
« Reply #5 on: October 03, 2006, 03:45:10 PM »
Hi greggman,

small update for the 'edit directory' patch (v11.02).
Creating a new file was causing an ugly error message ...
vc.e
Code: [Select]
static int window_edit2(_str filename)
{
   typeless status=edit_file(filename);
   if (! status) {
      int was_hidden=p_buf_flags&VSBUFFLAG_HIDDEN;
      p_buf_flags=p_buf_flags&~(VSBUFFLAG_HIDDEN|VSBUFFLAG_DELETE_BUFFER_ON_CLOSE);
      if (was_hidden) {
         call_list('_cbmdibuffer_unhidden_');
      }
   } else if ( status != NEW_FILE_RC ) {
      // HS2: added -> finally assume a dir and try change to it
      status = cd (isdirectory(just_name(filename),'1'), '');
   }
   return(status);
}

Regards,

HS2

BTW: Did you know ... that:
Code: [Select]
set-var def_unix_expansion 1
also works quite well for on Windows ?
It expands env. vars. e.g. doing 'e $TEMP/scrap.txt'
or w/ the patch above 'e $TEMP' changes to the TEMP dir.
As you can see you've to use the UNIX style of environment variables. But it's anyway easier to type...
Note that for quoting '$' (using it part of the filename) you've to do it like this:
'e $TEMP/\\\$scrap.txt'

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
Re: v11 filename completion bug/suggestion
« Reply #6 on: October 03, 2006, 06:55:56 PM »
thanks HS2 but that's not really a solution that helps me.

I don't need it to CD to the folder (I never CD from my base project folder), I need it to enter the folder in the prompt and bring up the list of files inside that folder.

In other words. I run the "e()" command in command prompt mode and I get prompted. I type "d:\w" and I see this



I select the "d:work" and press enter and this is what I get :-(



What should happen is I should get this



Note that I'm not asking from something out of the ordinary. I'm asking for it to work exactly how Windows itself works.

Here's the exact same process in every File dialog in Windows.



I typed "d:\w" then pressed the cursor down key to select "d:\work". I press enter and I get this



I don't get "Access Denied" like I do in v11.



hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: v11 filename completion bug/suggestion
« Reply #7 on: October 03, 2006, 07:44:49 PM »
Ok - now I got it ...

I played around a bit and ... (oh dear) ... we just have to use <SPACE> to 'select and continue matching' !
Use <ENTER> only on the final selection.

HS2

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
Re: v11 filename completion bug/suggestion
« Reply #8 on: October 03, 2006, 08:53:45 PM »
That's not the point. The point is the STANDARD as defined by Windows is to press Enter. Since I do this 100 times a day in every other program the one time it's different in Slickedit is a cause for frustration upon frustration.

1) If I learn to press space in slickedit I'll start making the mistake of pressing it somewhere else

2) Pressing space is WRONG.  Take my example. Assume there is a folder called "D:\work". Try to type "D:\Work file.cpp". You can't! This is a bug in Slickedit which I've actually run into.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: v11 filename completion bug/suggestion
« Reply #9 on: October 03, 2006, 09:18:55 PM »
Yes - you are (partially) right. Standard should be standard anywhere - this would be an ideal world ;)
On the flipside the Slick command line completion has no real equivalent.

Last resort: Use 'gui-open' / 'File->Open' - Slick's enhanced std. 'File open' dialog...

HS2

BTW: 2) works for me - but that's not important.

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
Re: v11 filename completion bug/suggestion
« Reply #10 on: October 04, 2006, 02:19:02 AM »
How did you get 2 to work for you?

When I type "D:\work<space>" slickedit automatically enters the my work folder and "d:\work\" is automatically entered into the prompt. Even if I press backspace and press space again it will convert to "d:\work\". It is impossible for me to enter "d:\work file.cpp". 

Make sure "d:\work" does exist and "d:\work file.cpp" does NOT exist. In other words I'm trying to create a new file.

> Last resort: Use 'gui-open' / 'File->Open' - Slick's enhanced std. 'File open' dialog...

I shouldn't have to work around bugs in slickedit. The bugs should be fixed
« Last Edit: October 04, 2006, 02:22:05 AM by greggman »

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: v11 filename completion bug/suggestion
« Reply #11 on: October 04, 2006, 06:27:19 AM »
Ok - you wanted to create a new file ...

1. filenames/dirs w/ SPACEs should be quoted anyway, but you surely know that ;)
2. <SHIFT-SPACE> 'quotes' (actually it's bound to 'keyin-space') <SPACE> and a ' ' char is entered into filenames/dirs on cmdline.
This is particularly useful when prompt is in filenname/dir completion mode.
And at least on Windows <SPACE> is the std. key to select items in such lists. I think that's the simple reason for <SHIFT-SPACE>.

Your example should look like that:
e "d:\work<SHIFT-SPACE> file.cpp
You don't need the closing " here except you want to add more files.

HS2

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
Re: v11 filename completion bug/suggestion
« Reply #12 on: October 04, 2006, 07:36:40 AM »
Thanks but telling me I have to change the way I type is not an answer. Try it in v1 to v10 and this problem didn't happen. It's a bug in v11

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: v11 filename completion bug/suggestion
« Reply #13 on: October 04, 2006, 08:13:35 AM »
I don't want to give any advise to you greggman. You are the most experienced Slick user I know ...

BTW: This kind of cmdline completion appeared in v11, right ? I cannot rember...
But I think it's better than the good old 'Select a Command parameter' list-box.

@Slickteam:
Maybe it's better to handle <SPACE> as 'SPACE' if the completion list is not displayed e.g. by cancelling it using <ESC>.
Completion could be re-activated by <TAB>. But this conflicts with the legacy 'Select a Command parameter' list-box ???
So maybe another shortcut (<CTRL-TAB> ?) as 'toggle-completion' in conjunction with an 'auto-complete on command line' configuration option could be a solution.
This would allow to intentionally activate completion if really needed.
Sometimes completion is a a bit too persevering (also for me)...

HS2
« Last Edit: October 04, 2006, 08:46:26 AM by hs2 »

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6867
  • Hero Points: 528
Re: v11 filename completion bug/suggestion
« Reply #14 on: October 04, 2006, 05:26:05 PM »
Given that you can't edit a directory, this should be handled differently.  Changing directory is not the solution though.  I'll take a look at this one.  This could be tricky so I won't promise anything.  Wish me luck :-)