v0.3.1 - June 2009
+ new command: SEL_LOADFROM
+ new command: SEL_SETTEXT, SEL_SETTEXT+
+ new variable: $(OUTPUT), $(OUTPUTL), $(OUTPUT1), see NPE_CONSOLE V+
+ several small improvements
OK, looks like I finally have a success with it. The directory/file name auto-completion have been implemented as a separate class with forward (Tab) and backward (Shift+Tab) searching directions. Also I've implemented backward (Shift+Tab) listing of Console's command and variables. The last thing required more time as its implementation is one of the worsest in the plugin :) However, the final code does not look very terrible ;)
Thx a lot for still improving it ! As for me it's currently your plugin, which makes NP++ leave most of all editors behind. Imo it's a must-have mainly when you're working with 'make' or 'scons'. I simply never liked emacs or similar for that kind of stuff.
Still there's one thing which I miss badly in your console window - and that is the TAB function of the real windows console ! When quickly slipping through the subfolders just by using the TAB key.. you know what I mean :-)
So this is what I did. I worked out the function to correctly behave with pathes when hitting the TAB key. Worked ok for me. And now I started to implement it into your ConsoleDlg::OnNotify. Maybe you like the idea.. I would share the code part, as soon as I'm done. But you don't have to screw your current TAB key function ! Why not add another checkbox in the settings for choosing between these 2 functions ? :--) I'm sure many would like it a lot, cuz it gets a lot closer to the real console.
Another thing I added for myself: I added some code to replace the first char of an entered line with "CMD /C ", when it's a ">". When the entered line consists of only 1 char (also ">"), then it gets replaced with a "CMD /Q /K"... you surely see the use of such 'shortcut' :)
> behave with pathes when hitting the TAB key
It's an interesting idea. Something I was thinking about, but did not implement. Please let me know when it will be done. Such function may optionally work BEFORE the existing one - i.e. first search for matching file names in current folder and in the folders listed in %PATH%, then search for matching folder names if the current command is "cd" and, finally, search for matching NppExec's commands (the existing behaviour).
> When the entered line consists of only 1 char (also ">"),
> then it gets replaced with a "CMD /Q /K"
This could be implemented as additional components listed in "NppExec_TechInfo.txt". Here is what I mean: we can add a support of "aliases" inside "NppExec.ini" which would allow to use these "aliases" instead of often used commands. For example, something like this:
; '>' instead of 'cmd /q /k'
Alias_Prefix_0 = > :: cmd /q /k
; 'c/' instead of 'cmd /c'
Alias_Prefix_1 = c/ :: cmd /c
; 'v+' instead of 'npe_console v+ --'
Alias_Prefix_2 = v+ :: npe_console v+ --
; 'v-' instead of 'npe_console v- --'
Alias_Prefix_3 = v- :: npe_console v- --
your suggestion about the support of 'aliases' sounds cool !
Regarding the TAB stuff.. I'm on my way. Never really got into C types,
so it still might take a while (damn string/char types lol) :\
But I'll let you know in any case.
Here's a compiled one of the current state:
Pls, if anybody with higher windows console experience could have a try ?
Because I don't know whether I missed something.. regarding 'path-browsing' via
TAB key I mean !
What I've added so far (to the TAB key functionality):
-if files are found (in the target's dir), then it loops through them
-if nothing found, the old TAB functionality gets fired (auto-complete, history)
-if 'CD' command in front, then loops only DIRs of course
-you can move to any position with mouse or cursor keys and TAB again - it won't delete
the rest of a long commandline, like the windows console does ;)
Watch out and compare to special cases of the windows console: file-/directorynames starting with a '.' !
For instance if you got 3 directories: '.SomeDir', 'SomeDir' and 'SomeDir2'
Then you type 'So' and hit TAB. The directory starting with a '.' comes up too !
I saw that only _accidently_ in the windows console. Does anybody know other
special behaviour like this ??!
Would be great if someone could test it out :)
sry again lol :\
Looks very good.
However, it crashes when pressing TAB right after some console child process was started (while it is running) or right after the child process was finished.
For example (1):
1) press TAB several times
2) type "cmd" and press Enter
3) (cmd is running) press TAB - NppExec crashes
Another example (2):
1) type "cmd" and press Enter
2) (cmd is running) press TAB several times
3) type "exit" and press Enter
4) (cmd was finished) press TAB - NppExec crashes
You're right. I noticed that later on.
I simply didn't capture the return key to update stuff afterwards.
Anyway I think it's quite stable now and this time I've included the source for you:
I can already hear you cursing while looking at the source :O Everything's packed into one header file, cuz I didn't know where/how to implement it best. There are 3 places in the "DlgConsole.cpp" where I added some lines only. I commented these places at the top of the header file for you. Actually only 2 places for the TAB stuff, but meanwhile I added also deleting whole current commandline by hitting ESC key.. like in windows console again.
There are some (maybe many?) dirty places in the code.. like calling "Edit.SendMsg(...)" in the 'OnNotify' itself. Maybe you know better solutions of course.. I tried my best in the end.
I was in a rush with comments and everything right now, cuz I will be offline for 2 weeks now.
So good luck + thanks for checking it out
I hope it helped a little
I forgot to mention some things:
- I also added TAB functionality in 'CMD' mode. But it expects a 'usual' command prompt in order to read the current path ! In the beginning I even tried reading out the PEB of the child process lol. I was hoping to get the current directory string from there, but the problem was, that it never gets updated at runtime.. dooh !
- I was not sure how/if to implement the stuff you suggested about including searching in
%PATH% for the tabbing ? It might be confusing when you start tabbing and it lists simply
everything it finds. Current directory items + all %PATH% items :?
And again I forgot something :|
a) It doesn't jump into TAB code, if something's selected.. I assume that's ok
b) It doesn't jump into TAB code, if WRAP mode is on. Cuz it might crash then. So don't start thinking why I doesn't work for you - you prolly enabled text wrapping in the console window !!
That's a pity somehow. Well I'm used to enable wrap mode all the time, but we can't have it all, right ? I think that would be another nightmare to implement it for wrapped lines 8-o
ok now.. be back in 2 weeks