SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: greggman on July 11, 2006, 04:03:52 AM

Title: v11 filename completion bug/suggestion
Post by: greggman 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?
Title: Re: v11 filename completion bug/suggestion
Post by: hs2 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
Title: Re: v11 filename completion bug/suggestion
Post by: greggman 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
Title: Re: v11 filename completion bug/suggestion
Post by: hs2 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
Title: Re: v11 filename completion bug/suggestion
Post by: greggman 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.
Title: Re: v11 filename completion bug/suggestion
Post by: hs2 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'
Title: Re: v11 filename completion bug/suggestion
Post by: greggman 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

(http://greggman.com/downloads/examples/v11-name-prompt01.gif)

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

(http://greggman.com/downloads/examples/v11-name-prompt02.gif)

What should happen is I should get this

(http://greggman.com/downloads/examples/v11-name-prompt03.gif)

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.

(http://greggman.com/downloads/examples/v11-name-prompt04.gif)

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

(http://greggman.com/downloads/examples/v11-name-prompt05.gif)

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


Title: Re: v11 filename completion bug/suggestion
Post by: hs2 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
Title: Re: v11 filename completion bug/suggestion
Post by: greggman 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.
Title: Re: v11 filename completion bug/suggestion
Post by: hs2 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.
Title: Re: v11 filename completion bug/suggestion
Post by: greggman 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
Title: Re: v11 filename completion bug/suggestion
Post by: hs2 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
Title: Re: v11 filename completion bug/suggestion
Post by: greggman 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
Title: Re: v11 filename completion bug/suggestion
Post by: hs2 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
Title: Re: v11 filename completion bug/suggestion
Post by: Clark 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 :-)
Title: Re: v11 filename completion bug/suggestion
Post by: hs2 on October 04, 2006, 06:22:16 PM
Good luck Clark !

HS2

PS: What are you going to do ? Just curious ...
And forget about my patch mentioned earlier. It's almost useless and was based on a misunderstanding. If I want to 'cd' I do 'cd'.
The 'better completion control' is much more interesting (for me).
Title: Re: v11 filename completion bug/suggestion
Post by: greggman on October 04, 2006, 07:22:04 PM
Thank you for checking into this.  Good Luck!  :)
Title: Re: v11 filename completion bug/suggestion
Post by: Clark on October 13, 2006, 02:10:24 PM
I have made some enhancements to V12 so that after selecting an auto-completion directory when using the edit, save_as, get, or put commands, a list of files contained in that directory is displayed.  This ended up being too many changes to put this into V11.
Title: Re: v11 filename completion bug/suggestion
Post by: hs2 on October 13, 2006, 10:26:07 PM
Sounds great Clark !
Thanks for the effort to help cmdline enthusiasts like me (and you - I think)
Looking fwd to v12 - but take your time !

HS2
Title: Re: v11 filename completion bug/suggestion
Post by: greggman on November 06, 2006, 04:33:45 PM
I have another request I hope you'll consider.

In the standard Windows XP dialog like the one shown above, as I type filenames it shows the possible completions, the list of which gets shorter and shorter as less items match.

If I press backspace and delete characters the list enlarges again. This doesn't happen in slickedit and it's pretty annoying because it means since I actually use the completions, anytime I type a wrong letter I have to delete 2 previous letters to get my completions to appear.

I run into this it feels like 1 of 3 or even 1 of 2 times at least recently.  Probably what is happening is I have 20 files all starting with "win" and I keep thinking that the file I want starts with "winb" so I type "winb" but it turns out I'm wrong and I forgot what it starts with so I backspace to "win" to get all files that start with "win" except slickedit doesn't re-do the completions like XP does. So, I have to backspace over the "n" as well and re-type it just to get the completions.

Another minor request, slickedit only shows 4 completions at a time. It would be nice if it would expand the window a little or let me set it (maybe this is one of those hidden settings?)

thank you for listening.


Title: Re: v11 filename completion bug/suggestion
Post by: Clark on November 06, 2006, 07:22:39 PM
I found some minor bugs.  Windows treats say "c:\temp\junk" as "c:\temp\junk*" and will display a list if there is more than one match.  This is the problem you are seeing.  SlickEdit doesn't do this but needs to.  I also found another bug where if you type "c:\public" where public is a directory and then hit backspace, the list really doesn't want to come back up.  I couldn't reproduce this problem on a directory with spaces.  I can't promise I'll have time to fix these before V12, but I've added them to my todo list.