================================================================================
CONTENTS
================================================================================
OVERVIEW
TE is an optimized by exe size, memory footprint and system resources text editor.
Technically speaking, it is a 17 KB (17,408 bytes) text editor with optimized Windows resources management, written entirely in assembly (MASM).
TE is a research project with results published as a freeware Notepad replacement. Enjoy at you own risk!
================================================================================
INSTALL AND UNINSTALL
Extract all of the files in the archive (te-1.5.7.zip) into the desired folder.
Included files
1. 'TE.exe' - Main program. 2. 'TE.exe.manifest' - Manifest file to support Windows XP Visual Styles. 3. 'NOTEPAD_SET.BAT' - Script used by 'Set TE as Notepad.bat'. 4. 'NOTEPAD_RESET.BAT' - Script to discard changes made by next script. 5. 'TE2NOTEPAD.BAT' - Script to replace MS Notepad with TE. 6. 'Toggle-Notepad.BAT' - Fast switch from Notepad to TE and back (toggle). 7. 'readme.txt' - This file.
Uninstall
As default TE does not create any registry entries or temporary files, and therefore can be uninstalled by simply deleting the extracted files. If you select 'Save State on Exit' option state information will be written under
HKEY_CURRENT_USER\Software\Zenkov\TE
registry entry. To remove state information simply uncheck 'Save State on Exit' option and all registry entries will be removed.
================================================================================
DESIGN GOALS
1. Frugal memory consumption (considerably less than Notepad) 2. Small exe footprint (less than Notepad) 3. Optimized usage of system handles and objects 4. Support for all Notepad features 5. Additional features I have always missed with the Notepad 6. Optimized for Windows NT 4.0 and above 7. Does not use richedit control
Design goals explained
1. Frugal memory consumption (considerably less than Notepad)
We all know that no matter how much memory a computer has, it is never enough. However, the vast majority of modern Windows applications waste physical memory with no mercy at all. Application developers rely on a Windows memory manager, hoping it will figure out the best possible scenario for their applications. It will not. There are ways to tune a Windows application to be a more intelligent on memory consumption. TE will use memory consumption technologies I have been developing for quite some time. I call them 'Memory on demand', and they will be implemented in stages the same way as a car tuning staging mechanism.
2. Small exe footprint (less than Notepad)
Contrary to common belief, the exe footprint is not as important as intelligent memory management. Yes a smaller program loads faster to a Windows virtual memory system, but really how much faster will a 25 KB program load compared to a 50 KB on a 7200 RPM hard drive? Not much, but an additional 25 KB of code can provide additional functionality somebody really misses. Still there is no excuse to call 600KB editors a "small Notepad replacement". They are just to heavy to be a as nimble and light as Notepad. To pretend they are not so fat they employ techniques like tray icon and such making look like they are instantly available by sucking system resources on idle. I decided to have Notepad footprint as TE boundary, this way it is guaranteed to be light and fast. In order to add as much functionality as possible into as few kilobytes as possible, I wrote TE in pure assembly, and I will keep it this way.
3. Optimized usage of system handles and objects
USER and GDI objects, handlers etc. are finite system resources. Granted Windows XP is a dramatic departure from Windows 95 as far as number of resources available for user. I like eye candy interfaces and they cost resources and I am fine with that. What I do not like is then sloppy applications are eating my resources for no good reason at all. Why for example gmail tray app opens more than 270 handles even on idle? Microsoft Word uses less. And WinWord? is a huge app compare to gnotify. I wish all application would give end users a choice: do you want eye candy or you want bare bones functionality? TE would never spend your resources unless you want it to. For example I like toolbars, I use mouse a lot, so TE with enabled toolbar will use extra GDI objects. However if you run it without toolbar no GDI overhead would be there. In fact if you run TE with no toolbar and Notepad side by side you will see that TE actually uses less resources compare to Notepad! In order to achieve it TE uses only plain Windows API, no MFC, .NET or anything like that plus I have to do a careful resources planning. Check goal #7 for more information on the subject.
4. Support for all Notepad features
If I limit TE to the Notepad footprint, then TE must include all of Notepad's features. I think this is fair. The idea is to gain functionality not to truncate it trying to save some resources. If current version of TE does not support Unicode it would some time in the feature.
5. Additional features I have always missed with the Notepad
Is Notepad missing something? You bet! Will I write all the possible features I can possibly implement? I am afraid not. This is where I am hoping to get feedback from Notepad users like you. I still do not know how much functionality I can squeeze into Notepad footprint. Right now TE is 17KB in size, so I have some room to grow.
6. Optimized for Windows NT and above
How about people running Windows 95, 98, or ME? Well, I will at least try to make TE run there, but I am not going to spend much time optimizing anything. Sorry, I have to pick my targets.
7. Does not use richedit control
Yep, I know if I use the richedit2 (or better the richedit3), I will get a ton of functionality almost for free. Color highlighting, search/replace, printing, URL highlighting, and no 64 KB memory limit even on Win95 are built into the richedit control. However there is a price to pay for all that functionality. Richedit control always uses more system resources compare to Edit control, so any Richedit based editor will always use more memory, GDI objects etc. Edit control allows Notepad to use as small amount of system resources as possible and it is the main reason why TE would not use richedit control.
================================================================================
IMPLEMENTATION (FEATURES) TABLE
Notepad on Windows XP vs. TE 1.5.7:
+
+
+
+ | Menu | Notepad XP | TE 1.5.7 | +
+
+
+ | File | New | * | * | | File | New window | | * | | File | Open | * | * | | File | Save | * | * | | File | Save as | * | * | | File | Page setup | * | * | | File | Print | * | * | +
+
+
+ | Edit | Undo | * | * | | Edit | Redo | | * | | Edit | Cut | * | * | | Edit | Copy | * | * | | Edit | Paste | * | * | | Edit | Delete | * | * | | Edit | Find | * | * | | Edit | Find Next | * | * | | Edit | Find Previous | | * | | Edit | Replace | * | * | | Edit | Goto | * | * | | Edit | Select all | * | * | | Edit | Time/date | * | * | +
+
+
+ | Opt. | Wordwrap | * | * | | Opt. | Stay on top | | * | | Opt. | Font dialog | * | * | | Opt. | Background color dialog | | todo | | Opt. | Statusbar on/off | * | * | | Opt. | Toolbar on/off | | * | +
+
+
+
+
+
+
+ | User interface | Notepad XP | TE 1.5.7 | +
+
+
+ | Toolbar | | * | | Toolbar | mouse over hints | | * | | Statusbar | * | * | | Statusbar | line | * | * | | Statusbar | column | * | * | | Statusbar | text size | | * | | Title | full path | | * | | Title | no path | * | | | Title | modified hint (*) | | * | | Save/restore state | * | * | | Auto disabled menu items | * | * | | MRU (most recently used) list | | todo | | External updates notification | | todo | | Auto indent | | todo | | Variable TAB spacing | | todo | +
+
+
+
+
+
+
+ | Printing | Notepad XP | TE 1.5.7 | +
+
+
+ | Page setup dialog | * | * | | Print dialog | * | * | | Print abort dialog | * | * | | Print selection only | | todo | | Custom Header/Footer? | * | * | | Print progress | * | * | | Print (/p) command line option | * | * | | PrintTo? (/pt) command line option | * | * | +
+
+
+
+
+
+
+ | File types | Notepad XP | TE 1.5.7 | +
+
+
+ | ASCI PC (CR/LF) | * | * | | ASCI UNIX (LF) | | todo | | ASCI MAC (CR) | | todo | | UNICODE | * | todo | | UNICODE big endian | * | todo | | UTF-8 | * | todo | | Binary | * | * | +
+
+
+
+
+
+
+ | Additional keyboard support | Notepad XP | TE 1.5.7 | +
+
+
+ | Scroll vertically (Ctrl+Up/Dn?) | | * | | Scroll horizontally (Alt+Lft/Rgt?) | | * | +
+
+
+
+
+ | Additional features | Notepad XP | TE 1.5.7 | +
+
+
+ | Unlimited Text Size (1) | * | * | | Open files using drag and drop | * | * | | Windows XP Visual Styles | * | * | | 'Match whole word only' mode | | * | | 'Continue search from top' dialog | | * | | Search text top -> bottom | * | * | | Search text top <- bottom | * | * | | .LOG support | * | * | | Read only mode | | todo | +
+
+
+ | (1) On Windows NT, 2000, XP, Server 2003 | +
+
================================================================================
BENCHMARKS
Resource consumption test results:
+
+
+
+ | Exe/memory footprint | Notepad XP | TE 1.5.7 | +
+
+
+ | Exe footprint (bytes) | 66,048 | 39,939 | | Exe footprint compressed (bytes) | 47,616 | 17,408 | +
+
+
+ | Memory | New document (KB) | 3,592 | 1,400 | | Memory | 1 KB document (KB) | 4,244 | 1,456 | | Memory | 10 KB document (KB) | 4,276 | 1,472 | | Memory | 100 KB document (KB) | 4,452 | 1,500 | | Memory | 1000 KB document (KB) | 6,336 | 1,512 | | Memory | 10000 KB document (KB) | 25,204 | 1,536 | +
+
+
+ | Resources usage (new empty document open) | +
+
+
+ | Peak mem usage (KB) | 3,964 | 3,864 | | VM Size (KB) | 1,216 | 1,184 | | Handles | 38 | 37 | | USER Objects | 21 | 19 | | GDI Objects | 32 | 28 | +
+
+
+ | Resources usage (this readme.txt open) | +
+
+
+ | Peak mem usage (KB) | 4,344 | 3,896 | | VM Size (KB) | 1,344 | 1,272 | | Handles | 43 | 37 | | USER Objects | 21 | 19 | | GDI Objects | 32 | 28 | +
+
+
+ | Exe compressor: UPX 1.24 | | Memory tuning : 'Memory on demand' Stage I | | UI features : Toolbar and statusbar disabled | | Testing hardware & OS: | | Toshiba Satellite, Pentium 4-Mobile 2 GHz, 1024 RAM | | Windows XP Home | +
+
================================================================================
REVISION HISTORY
Aug 14, 2007 ver. 1.5.7
- Optimized by size many functions to make footprint smaller. 1.5.7 has more code, but the same footprint as 1.5.6. - Made fully compatible with Windows Vista. - Fixed: Drag & drop would not detect an overwrite of an existing document. - Fixed: Printing of document would always be with font size 10. - Fixed: Font PointSize? would not save in registry. - Fixed scripts for easy replacement of MS Notepad with TE. Now they support Windows Vista.
Oct 30, 2006 ver. 1.5.6
- Added: Printing of custom page header and footer. (supported: &f, &F, &d, &D, &t, &T, &p, &p+, &c, &r, &l, &&) - Added: New 'Page Setup' dialog. - Fixed: Ctrl+P shortcut would not print unsaved file. - Fixed: 'Page Setup' properties would not save in registry.
May 02, 2006 ver. 1.5.5
- Added: show wait cursor during long word-wrap operations. - Fixed: crash after loading a corrupted registry state. - Fixed: after making the toolbar visible, word-wrap & topmost buttons would not show their enabled state (down).
Apr 25, 2006 ver. 1.5.4
- Added shortcut info to the toolbar hints. - Rearranged menu accelerators to match Notepad. - Added Ctrl+H shortcut in addition to Ctrl+R for replace. - Added shortcut for 'Stay on Top' action (Shift+Ctrl+T). - Fixed dialog window: 'Continue search from top?' It was possible to get multiple windows by pressing 'Find Next'. more than once. - Added search direction ('Up','Down') in 'Find' dialog box. - Added 'Find Previous' menu item as well as shortcut (Shift+F3) to search text in reverse order. - Improved search speed by 15%. - Dramatically reduced memory reallocations during search to impose less stress on Windows memory manager. - Added showing of wait cursor for long operations. - Fixed window repainting after opening large files. - Fixed scripts for easy replacement of MS Notepad with TE. Now they support Windows 2003 server and Windows XP SP2. - Added script for a fast Notepad to TE and back switching.
Dec 29, 2004 ver. 1.5.3
- Implemented 'printto' verb ('/pt' command line option) - Added keyboard shortcut for 'Save As...' action (Shift+Ctrl+S) - Changed 'Word Wrap' action shortcut from F9 to Ctrl+W - Changed 'New Window' action shortcut from Ctrl+W to Shift+Ctrl+N - Implemented auto disabling of 'Edit' menu items - Fixed calculation of line/column cursor position (negative column #) - Optimized status bar repainting
Dec 20, 2004 ver. 1.5.2
- Implemented 'print' verb ('/p' command line option) - Improved printing error handling
Dec 16, 2004 ver. 1.5.1
- Fixed loading of files using short syntax, like "te text.txt"
Dec 10, 2004 ver. 1.5.0
- Fixed broken printing functionality (total rewrite of the printing code) - Added work around Microsoft EM_GETHANDLE bug (Common Controls ver. 6.X). - Added scripts for easy replacement of MS Notepad with TE.
May 25, 2004 ver. 1.4.6
- Fixed opening of files previously opened with FILE_SHARE_WRITE flag - Added message if try to modify locked file. - Added message if try to modify read-only file.
May 24, 2004 ver. 1.4.5
- Fixed loosing of file name if Cancel 'Save As' or 'Open' dialogs
May 16, 2004 ver. 1.4.4
- Improved handling of parameters with and without quotes
May 14, 2004 ver. 1.4.3
- Fixed openning of files with no path.
May 13, 2004 ver. 1.4.2
- Fixed crash if try to open locked file. - Fixed small memory leak on drag and drop
May 10, 2004 ver. 1.4.1
- Fixed passing long file names without quotes - Expanded 32K limit on Windows 95 to 65K
Nov 21, 2003 ver. 1.4
- Added Options | Save State on Exit - Added Options | Font... - Added View | Toolbar - Added View | Status Bar - Optimized window repainting - Added keyboard vertical scrolling (Ctrl + Up/Down?) - Added keyboard horizontal scrolling (Alt + Left/Right?) - Changed Toolbar style and alignment to make it look better on XP - Fixed zero bytes file error
Oct 20, 2003 Ver. 1.3
- Added .LOG support - Added Edit | Date/Time? - Added Goto line dialog
Oct 05, 2003 Ver. 1.2
- Added Search and Replace functionality - 'Memory on demand' Stage I
Aug 08, 2003 Ver. 1.1
- Added printing functionality
Jun 18, 2003 Ver. 1.0
- Initial release
================================================================================
KNOWN ISSUES
When used with Common Controls ver. 6.X ('TE.exe.manifest' present) change in font script does not take effect. Windows Notepad exhibits the same problem. As a work around you can rename 'TE.exe.manifest' to '_TE.exe.manifest' for example, forcing usage of older Common Controls. This problem has been confirmed under Windows XP and Windows 2003 Server.
Second work around would be setting 'Language for non-Unicode programs' (Regional and Language Options) to match a font script in TE. In my case I set it to 'Russian' and font script to 'Cyrillic'.
================================================================================
SPECIAL THANKS
Jeffrey Tavares - for finding many bugs and excellent feedback
================================================================================
PRODUCT INFORMATION ON THE WEB
Tiny Editor (TE) on the Internet:
http://www.zenkov.com
================================================================================
CONTACT INFORMATION
Comments, suggestions, and bug reports are always appreciated:
mailto://igor@zenkov.com
================================================================================
Copyright (C) 2003-2007 Igor P. Zenkov All rights reserved.