Dear Hutch,
Many thanks for all your hard work with QEditor. It is, in short, a masterpiece. I'm no good with the mouse, and have been searching for a keyboard friendly editor. The speed is truly addictive and I really enjoy the ability to customise the menus. Your new blue look is very pleasing on the eye, especially with font selection. If this little gem was packaged up as QEditor5 (with word wrap) I'm sure we would see it on the "most loved editor" lists before long.
I have searched the MASM forum to read the posts about QEditor - it really deserves its own section.
After a bit of experimentation (QE ver 4.0g - all this in just 37,192 bytes!) I have a couple of questions:-
1. CRTL-M
If I start a new instance of QE and merge files into this unsaved document with the mouse all works well.
However if I use CTRL-M in an unsaved file I am asked to save the file.
If I answer either yes or no, I loose all the contents of the unsaved file.
No gives me a blank unsaved file, yes gives me a blank named saved file.
2. Get File
The menu editor has a very useful "Get File" function, preventing filename typos.
Is there any way to expose this in the editor and the scripting engine?
I found getfolder function, but sadly no getfile.
I would like to use QE as a general text editor, because it's portable, ultrafast, rock solid and programmable. As soon as I discovered QE4 I looked back at my collection of text editors to make a wish list of functions. I have been trying to write a number of these text manipulation functions as scripts (e.g. yankline, blockup, bullet, number, cutappend). This is proving more difficult than I expected.
As many people (like me) can't write plugins, is there any chance of an extension of the scripting environment? Sorry if this seems inappropriate for the MASM forum, but this is such a good editor I could not resist. With just a few more functions the scripting engine would be capable of almost all the common editing functions.
I know you have designed the software very carefully and wisely resisted many requests for feature creep. However I'm feeling brave...
1. Passing variables to the editor specific commands:
To manipulate text in the editor it is necessary to move the cursor depending upon the number of lines or characters in a string. This would allow scripts to reselect the text, and users to press F12 to repeat the action (e.g. Move a block of text up a line at a time). Would it be possible for these functions to accept an integer variable?
e.g. newline #1 - To insert a variable number of new lines
selectline #1 - Positive and negative
setsel #1 - Positive and negative
undo #1 - Positive and negative
left #1
right #1
up #1
down #1
back #1
2. Passing variables to the string functions.
In the same way as in the previous point, it would help to send integer variables to all the string manipulation functions.
e.g. $1 = Right$ $0 #1
$1 = Mid$ $0 MyStart MyLen
3. Passing variables to the arithmetic functions
I'm struggling to add two integer variables together, sorry:-
; Add two integer variables - fails.
#1 = len Word1$
#2 = len $0
#3 = add #1 #2
msgbox #3 "Result" MB_OK
4. New string function: lines
In order to loop through lines in a block of text, or reselect that block in the editor, it would be very helpful to have a "wickedly crafted" function to count the number of lines in any string variable.
e.g. lines $0 (returns #0 with the number of lines)
5. New string function: find
In order to extract a line at a time, or any other substring, scripts need to be able to extract start/stop points to feed into the updated mid$ function. A function to return the integer position, of the first character in the search string would enable this capability. It would need to accept an integer or integer variable for which occurrence to find. A return value of 0 indicates "string occurrence not found"
e.g. find $0 lf counter ; Finds the end of the line.
find $0 "<br>" 2
find $0 $1 1
I suspect this is not efficient once in a loop, but without investing in loop constructs it is the only way to get the job done.
6. New clipboard access functions: setclip and getclip
The view clipboard function is very useful, keeping a snapshot copy. The ability to "Cut Append" and "Copy Append" would also enhance functionality. To enable this in the scripting engine:
; Cut Append
STRING MyText$
; Cut the selection
cutsel
Mytext$ = $0
; Check if there is a selection
if$ Mytext$ = ""
end
; Get the clipboard
getclip
; Set the clipboard
setclip $0 Mytext$
; setclip should be able to add in literals, converted integer variables and supported C escapes
; e.g. setclip $0 "/n/t" Loop# Mytext$
end
7. New file functions: filename and reload
To allow external applications to act upon the text in the editor we need to save it, run the applications and then reload the text. The savefile function, with no parameters saves the current file. The openfile function does not appear to have the same default. I can't find a way to access the current file name "drive:/path/name.ext", could a simple function "filename" return this string?
; Spell check
savefile
filename
run P:\MyPrograms\EDITORS\Addins\Yourspell\YourSpell.exe $0 ; read below about passing variables
reload
8. Passing variables to run and exec
At present the run/exec functions do not accept parameters after the target file. Also they don't have access to the name of the current file. This would be really helpful for many enhancements, archiving/CVS/FTP/Spellchecking.
e.g. Sync with website
; Up-load a file
savefile
filename
exec P:\bin\FTPSync\FTPSync.exe $0 /FTPSYNCDATA:.. /FULL /QUIET
9. Word wrap
To attract the wider praise it deserves QE needs word wrap. Does the added code significantly degrade the performance of QE? Even when it is switched off? TopGun is great and offers wrapping, but no font selection, no custom menus and most importantly no scripting engine.
Please accept these suggestions from an someone who admires the work already done. After 20 y of playing with software (I'm a surgeon) this gem will be on my USB stick with or without any changes.
Kind Regards
Gavin
P.S. Below is a copy of my menu.ini some of the scripts don't work properly, but you get the idea of my personal "ideal editor". I have been using Autohotkey to translate hotkeys to menu navigation for QE. I hope you share my enthusiasm, QE has the potential to be a really useful customisable general editing environment.
[&Text]
&Delete line CTRL-SHIFT-Y,{e}\scripts\YankLine.qse
-
Cut &Append CTRL-ALT-X,{e}\scripts\CutAppend.qse ; incomplete
&Copy Append CTRL-ALT-C,{e}\scripts\CopyAppend.qse ; incomplete
-
Paste &Unformatted CRTL-SHIFT-V,{e}\scripts\pasteunformatted.qse ; uses external application
-
&View Clipboard CTRL-SHIFT-S,P:\MyPrograms\EDITORS\Addins\Clipboards\clipbrd.exe ; Would love to call your clipboard snapshot code from here.
-
&Filter... CRTL-ALT-F,P:\MyPrograms\EDITORS\Addins\TextFilter\TextFilter.exe "{a}" ; posh grep
&The Wordweb... CRTL-ALT-T,P:\MyPrograms\EDITORS\Addins\Wordweb\wordweb.qsc
-
&Spell check... CRTL-ALT-S,{e}\scripts\spellcheck.qse ; uses Yourspell - incomplete
Tidy &HTML...,P:\MyPrograms\EDITORS\Addins\HTMLTidyGUI\tidyGUI.exe -f "{a}" -c P:\MyPrograms\EDITORS\addins\HTMLTidyGUI\NoWrap.ini
W&3 Validate...,P:\MyPrograms\EDITORS\Addins\W3Validate\sp\validate.bat "{a}"
-
&Wrap on CTRL-SHIFT-W,{e}\scripts\wordwrap.qse ; incomplete
Wrap &off CTRL-SHIFT-U,{e}\scripts\unwrap.qse ; incomplete
[&Block]
&Indent PgDn,{e}\plugins\indentb.dll
&Outdent PgUp,{e}\scripts\outdent.qse ; incomplete
-
Trim &Whitespace CRTL-ALT-W,{e}\plugins\rtrim.dll
-
Dupli&kate CRTL-ALT-K,{e}\scripts\duplikate.qse ; incomplete
Shift &Up CRTL-ALT-U,{e}\scripts\lineup.qse ; incomplete
Shift &Down CRTL-ALT-D,{e}\scripts\linedown.qse ; incomplete
-
&Bullet CRTL-ALT-B,{e}\scripts\bullet.qse
&Number CRTL-ALT-N,{e}\scripts\number.qse
&Renumber CRTL-ALT-R,{e}\scripts\renumber.qse ; incomplete
-
&Modify ,{e}\plugins\blockp.dll
Comment &//,{e}\plugins\cblockc.dll
Comment Semi&colon,{e}\plugins\ablockc.dll
&Strip comments,{e}\scripts\StripComments.qse ; incomplete
-
More text &functions...,{e}\plugins\addmenu.dll
[&Insert]
&File... CRTL-ALT-I,{e}\scripts\loadfile.qse
-
File &name CRTL-SHIFT-N,{a}\scripts\insertfn.qse ; incomplete
&Get a file CRTL-SHIFT-G,{a} \scripts\getafn.qse ; incomplete
-
TA&B CRTL-SHIFT-I,{a}
&Character...,charmap.exe
&HTML Colour...,{e}\cpicker.exe
-
&Time F6,{e}\scripts\insertt.qse ; incomplete
&Date F7,{e}\scripts\insertd.qse ; incomplete
[&Project]
&Run file CRTL-SHIFT-R,{e}Shellex.exe "{a}"
Re&load file CRTL-SHIFT-L,{e}qeditor.exe "{a}" ; incomplete
&Compare with...,P:\MyPrograms\EDITORS\Addins\TextDiff\TextDiff.exe "{a}" ; incomplete
&Backup file... CRTL-SHIFT-B,P:\MyPrograms\EDITORS\Addins\Vbackup\Vbackup.exe {p} zVersions /IF {a} /NS /Q
-
Open &Directory... F5,{e}Shellex.exe "{p}"
&Text Viewer... CRTL-SHIFT-O,P:\MyPrograms\EDITORS\Addins\TextView\Textview.exe "{a}"
&Search Directory... CRTL-SHIFT-G,P:\MyPrograms\EDITORS\Addins\Astrogrep\Astrogrep.exe "{p}"
-
Load Binary File As Hex,{e}\plugins\bin2hex.dll
Save Hex File As Binary,{e}\plugins\hex2bin.dll
[S&cripts]
&Run a Script SHIFT-F12,{e}\scripts\runscript.qse ; incomplete - can't call a script from a script!
Re&peat script F12,{e}\scripts\repeat.qse ; incomplete
-
Open &Directory,{e}Shellex.exe {e}\scripts
-
Insert &Text as Script,{e}\plugins\txt2qse.dll
Insert &Binary as Script,{e}\plugins\bin2qse.dll
[E&xtras]
Activate &Keys,P:\MyPrograms\DEV\AutoHotKey\AutoHotkey.exe {e}Qeditor.ahk
&Define Keys,{e}qeditor.exe {e}Qeditor.ahk
-
&Google search...,{e}prun.exe "
http://www.google.com/search?"
-
&WinSorter...,P:\MyPrograms\EDITORS\Addins\winsorter\winsorter.exe
Multiple &Clipboards..,P:\MyPrograms\EDITORS\Addins\Clipboards\Clipboards.exe
[&Desktop]
&Cascade QE,P:\MyPrograms\SHELLS\Addins\vDesktop\TileWindows.exe -c
Tile &Vertical,P:\MyPrograms\SHELLS\Addins\vDesktop\TileWindows.exe -v
Tile &Horizontal,P:\MyPrograms\SHELLS\Addins\vDesktop\TileWindows.exe -h
-
&Show desktop,{e}shellex.exe P:\MyPrograms\SHELLS\Addins\showDesktop.scf
&Multiple desktops ALT-X,P:\MyPrograms\SHELLS\Addins\vDesktop\desktops.exe /accepteula
[Help]
&Editor Help,{e}\help\qeditor.chm
Hot &Key Help CRTL-SHIFT-K,{e}Shellex.exe {e}\help\QEKeys.xls
Set F1 help file CRTL-SHIFT-H,{a}
-
Help &Directory,{e}Shellex.exe {e}\help
-
MASM Site,{e}prun.exe "
http://www.masm32.com/board/index.php"