- Notifications
You must be signed in to change notification settings - Fork10
Text editor for the CP/M operating system and related computers: Amstrad PCW, CPC, Kaypro, Spectrum...
License
MiguelVis/te
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
v1.73 / 20 Nov 2021 for CP/M
(c) 2015-2021 Miguel Garcia / FloppySoftware
Thete
text editor is small, humble and useful.
It edits the full text in memory, so your system must leave enoughfree TPA for the text, afterte
is loaded and running.
It's screen oriented, and can be easily adapted to a lot of computers.
It's written in the C language, and there are ports for variousoperating systems: CP/M, DOS, Windows and GNU/Linux.
I useMESCC to compile it for CP/Mand the Z80 cpu.
It's simple (for the PCW adaptation; see below for the name of the restof available adaptations):
te_pcw [filename]
Examples:
te_pcw - To start an empty document.te_pcw todo.txt - To edit the document 'todo.txt'.
You should rename the adaptation of your choice to simplyte
, becausesome CCP implementations (including the standard from CP/M), do not likethe character_
in filenames.
Depending of thete
adaptation, you could see a layout similar to:
te: TODO.TXT --- | Lin:0012/0029/0512 Col:08/76 Len:07 !.......!.......!.......!.......!.......!.......!.......!.......!... 1|This is my TO-DO list for today: 2| - Wake up. 3| - Make coffee. 4| - Have a shower. 5| - Get dressed. 6| - Go work and: 7| 1. Revise email. 8| 2. Call Peter. 9| 3. Meet the boss. 10| 4. Plan tomorrow. 11| - Have lunch with Sarah. 12| - ... 13| 14| 15| 16| 17| 18| 19| 20| 21|------------------------------------------------------------------------ESC = menu
On the first screen line, you will see something like:
te: TODO.TXT - The file name of the document your are editing.
And something like:
--- | Lin:0015/0042/0512 Col:32/90 Len:36
The very first field, can have one of the following values:
--- Means the clipboard is empty.CLP Means the clipboard has data.
The numbers following 'Lin' are:
0015 - The line number you are editing right now.0042 - The current total number of lines.0512 - The maximum number of lines.
The numbers following 'Col' are:
32 - The column number on which you are.90 - The number of screen columns.
And, finally, the number following 'Len' is:
36 - The length of the current line.
On the last screen line, you will see program messages and questions.
You can enter to the menu, by pressing theESCAPE
key, as shownin the messages line:
ESC = menu
Note that the exact name of yourESCAPE
key may differ, depending ofthe program configuration.
The options are:
New - To start a new documentOpen - To open a documentSave - To save the current documentsave As - To save the current document under another filename.Insert - To insert a text file into the current position.Help - To show the help screen.aBout te - To show some te information.eXit te - To quit the program.
You can select an option by pressing the character in uppercase.
To leave the menu, you must pressESCAPE
.
If you select one of the optionsNew
,Open
oreXit
, and there areany changes that are not saved yet, te will ask you for confirmationbefore proceed.
If you start a new document, theSave
option will redirect to you tothesave As
option.
The help screen will show the keyboard configuration (or key bindingsif you prefer), which depends of the program configuration.
For example, in the case of TE_WS100 (25x80 VT100 and WordStar keys) youcould see something like this:
Up ^E | Down ^X | Indent ^ILeft ^S | Right ^D | NewLine ^MBegin ^QS | End ^QD | Escape ^[Top ^QR | Bottom ^QC | Macro ^QMPgUp ^C | PgDown ^R |WordLeft ^A | WordRight ^F |DelLeft ^H | DelRight ^G |BlockStart ^KB | BlockEnd ^KK | BlockUnset ^KUCut ^Y | Copy ^O | Paste ^WDelete ^KY | ClearClip ^T |Find ^QF | FindNext ^L | GoLine ^J
The clipboard contents is not cleared after file operations (new, open,save...). That makes possible to share text between files.
But it's a good practice to clear the clipboard when you don't need itanymore, to free some memory.
As you can see in the help screen of example, there are some keybindings to perform actions when you are editing the file.
The exact keys you must press to do an action, depend on the configurationyou are running, but the meanings are the same:
- Up, Down, Left, Right: to move the cursor one character at a time.
- Begin, End: to move the cursor to the begin or the end of thecurrent line.
- Top, Bottom: to move the cursor to the begin or the end of thecurrent file.
- PgUp, PgDown: to move the cursor to the previous or next page.
- WordLeft, WordRight: to move the cursor to the previous or next word.
- DelLeft, DelRight: to delete the previous or next character.
- Find, FindNext: to find a string or repeat the search.
- GoLine: to go to a line number.
- BlockStart: to mark the start of a block of lines.
- BlockEnd: to mark the end of a block of lines.
- BlockUnset: to unselect a block of lines.
- Cut, Copy, Paste, Delete: to cut, copy, paste or delete a lineor block of lines.
- ClearClip: to clear the clipboard data.
- Macro: to run a macro.
- Indent: to insert spaces as indentation. Same as Tab.
- NewLine: to insert a break or empty line. Same as Cr, Enter, Introor Return.
- Escape: to exit the menu or cancel an action. Same as Esc.
Take into account that some actions could not be available in all teadaptations to save memory space. These actions are: WordLeft, WordRight,Find, FindNext, GoLine, BlockStart, BlockEnd, BlockUnset and Macro.
If you miss one or more of the mentioned actions, you can edit the exactfile of the te adaptation and recompile it to include them.
If the text editor is configured with the C language type auto-completionoption enabled, the input of some characters will cause the automatic inputof some other:
[ --> ]{ --> }( --> )" --> "' --> '/* --> */
The text editor supports automatic indentation of lines, accordingto the indentation of the previous one.
The indentation is done by inserting the same number of spaces ofthe previous line - ie:
This paragraph is indented, according to the first line. More indentation here.
The text editor supports automatic lists, when the first non blankcharacter of the previous line is one of the "bullets" accordingto the configuration.
As automatic indentation is supported, automatic multi level listsare possible - ie:
- Item #1- Item #2 * Item #2a * Item #2b > Item #2b-1> Item #2b-2- Item #3
Macros are a powerful way to perform repetitive tasks at editing level.
For example, you could create a macro with your signature to include itin every letter you write.
Or, being a programmer, you could create a gdoc block macro to documentyour own C functions.
Macros are not affected by default by auto-completion, auto-indentationor lists.
Each time you want to run a macro, just press the corresponding keyfor the Macro action, enter the filename you choose when you saved itto disk, and press the key for the NewLine action. That's all.
The default filetype for macro files is ".M".
The filetype is only required when it's different. So, if you havesaved a macro file asJOIN.M
, you could just enterJOIN
:
JOIN.M you could enter JOIN.M or just JOINJOIN.MAC you must enter JOIN.MAC
There are some special symbols you can use in your macros:
{# comment} comments, they are ignored{Up} {Down} {Left} {Right} move the cursor one character at a time{Begin} {End} go to the begin / end of the current line{Top} {Bottom} go to the begin / end of the current file{NewLine} insert a break or empty line{Indent} insert spaces as indentation{DelLeft} {DelRight} delete the character at the left / right{Cut} {Copy} {Delete} operation over a line or block of lines{Paste} paste the clipboard contents{ClearClip} clear the clipboard data{BlockStart} {BlockEnd} mark the start / end of a block of lines{FileName} insert the current filename{AutoIndent} enable / disable automatic indentation{AutoList} enable / disable automatic list
The symbol names are case insensitive - ie:{ClearClip}
and{clearclip}
are the same.
Additionally, you can repeat a symbol as in:
{up:12}
Auto indentation or auto list can be enabled by just using the symbolname or setting a repeat number of1
:
{AutoList}{AutoList:1}
They can be disabled setting a repeat number of0
:
{AutoIndent:0}
Take into account that line endings in the macro are not translatedto NewLine actions. Use{NewLine}
for that.
If you need to insert the{
or}
characters in the text of themacro, just write them as\{
and\}
.
For example, a macro to insert a banner at the top of the document,could be written as:
{# this is a macro example}{top}{newline}{up}=============={newline}FloppySoftware{newline}=============={newline}
Some macro files are included as examples:
HEADER.M Above example.JOINUP.M Join current line with the previous one.JOINDOWN.M Join current line with the next one.
There are some macros for the C language:
CFILE.M File documentation block for GDOC.CFUN.M Function documentation block for GDOC.CDO.M Snippet for "do / while".CFOR.M Snippet for "for".CIF.M Snippet for "if".CIFELSE.M Snippet for "if / else".CSWITCH.M Snippet for "switch".CWHILE.M Snippet for "while".
Each time a file is saved, te does a backup of the previous filecontents if it exists.
It is renamed aste.bkp
.
The program adaptation is done by editing a small source code file.
In this file, you must specify some configuration values accordingto your preferences and / or system, and complete a few Clanguage functions to clear the screen, etc.
As there are some adaptations already done, it's possible that yourmachine is already included between them.
If not, don't worry, you can start from a similar adaptation.
See the source code files for more information.
Current CP/M adaptations are:
te_pcw
: Amstrad PCW and CP/M Plus (31x90 VT52 like terminal).te_cpc3
: Amstrad CPC and CP/M Plus (24x80 VT52 like terminal).te_spec
: Spectrum +3 and CP/M Plus (23x51 VT52 like terminal).te_mur
: K. Murakami's CP/M emulator (25x80 VT100/Ansi).te_tak
: Takeda Toshiya's CP/M emulator (25x80 VT100/Ansi).te_ws100
: Generic 25x80 VT100 and WordStar keys.te_kp
: Kaypro II, 4 and 10 (24x80 ADM-3A like terminal),contributed by Stephen S. Mitchell (thanks!).te_px8
: Epson PX-8 "Geneva".te_ansi
: Generic 25x80 ANSI terminal, including (translated) keyboardescape sequences.te_apple
: Apple II with SoftCard, a24x80 SOROC IQ 120 / 140 terminaland WordStar keys.te_c128
: Commodore 128 and CP/M Plus (25x80 ADM-31/3A like terminal).te_sam
: SAM Coupe and Pro-Dos (24x80 VT52 like terminal).
Adaptations for other OS are (they are not distributed yet):
- Windows 32 bit (25x80), compiled with Pelles Cand its 'conio.h' library.
- DOS (25x80), compiled with Turbo C, andits 'conio.h' library.
- GNU/Linux (24x80), compiled with GCC and ncurses.
TheTECF
configuration tool is supplied in order to adjustsomeTE
generic options to your taste, if needed (its useis totally optional):
TECF v1.21 / 13 Nov 2021 - (c) 2021 Miguel Garcia / FloppySoftwareTE configuration tool.Usage: tecf action arguments...Actions: patch COM file from CF file: patch [[filename[.COM]] [filename[.CF]]] dump CF values from COM file: dump [filename[.COM]] [> filename.CF] print key codes: key
You can configure TE by using thepatch
action - ie:
tecf patch te.com myconf.cf
The standard file types (COM
,CF
) and filename (TE
) are optionals,so you could patchte.com
withte.cf
just with the command:
tecf patch
Take into account that the disk has to be enough space for a temporaryfile with the exact size as TE.
You can see the current configuration of TE by usingthedump
action - ie:
tecf dump
To save the configuration in a file just add a redirection (atecf
feature thanks toMESCC
):
tecf dump > myconf.cf
The standard file type (COM
) and filename (TE
) are optionals.
If you don't know the character/s assigned to a key, thekey
actionwill help you:
tecf key
For example:
TECF v1.21 / 13 Nov 2021 - (c) 2021 Miguel Garcia / FloppySoftwareTE configuration tool.Press any key to get its code/s (SPACE = exit):Hex Dec Ctl Chr--- --- --- ---61 97 a04 4 ^D0D 13 ^M08 8 ^HE0 22453 83 S0D 13 ^M
ACF
configuration file is just a text file with some key / valuepairs, in a very similar way ofINI
andconf
files in othersystems.
Just a few rules:
- comments start with the
#
character. - empty lines are ignored.
- strings can be surrounded by the
"
character.
See myCF
andCF READER
projects for more information.
Each adaptation is supplied and patched with an initial configurationfile that includes key bindings, etc.
You should create your own configuration files if needed.
The current supported options are the following (seeTE.CF
):
# ========================================# TE configuration file# ----------------------------------------# IMPORTANT! This file is for TECF, the TE# configuration tool.# ========================================# Configuration name#te.confName = "My own configuration"# Screen height: 8..255 or auto for CP/M 3#screen.rows = 25# Screen width: 64..255 or auto for CP/M 3#screen.columns = 80# Character for normal position in ruler#screen.rulerChar = "."# Character for tab stop position in ruler#screen.rulerTabChar = "!"# Character for vertical draws -- ie: help columns#screen.vertChar = "|"# Character for horizontal draws -- ie: status line#screen.horizChar = "-"# Character between line numbers and textscreen.lineNumbersChar = " "# How many lines can edit: 256..4096 -- each# empty line occupies 2 bytes of RAMeditor.maxLines = 512# How many columns (spaces) are a TAB: 1..16editor.tabSize = 4# Show line numbers: true / falseeditor.lineNumbers = true# C language type completion: [], {}, (), "", '', /**/editor.c_language = true# Automatically indent a new line as the previous oneeditor.autoIndent = true# Automatically start a list when the first non blank# character in a line is one of "listBullets" -- max.# 7 characters in longeditor.autoList = trueeditor.listBullets = "-*>"# Some keynames used in the UI#keyname.newLine = "ENTER"#keyname.escape = "ESC"# Key bindings, legal definitions are:# ^A -> Ctrl-A -> one control char.# ^A^X -> Ctrl-A, Ctrl-X -> two control chars.# ^AX -> Ctrl-A, X -> one control char., one char.## Legal control characters are:# ^A..^Z ^[ ^\ ^] ^^ ^_ -> 1..31# ^? -> 127#key.up = ""#key.down = ""#key.left = ""#key.right = ""#key.begin = ""#key.end = ""#key.top = ""#key.bottom = ""#key.pgUp = ""#key.pgDown = ""#key.indent = ""#key.newLine = ""#key.escape = ""#key.delRight = ""#key.delLeft = ""#key.cut = ""#key.copy = ""#key.paste = ""#key.delete = ""#key.clearClip = ""#key.find = ""#key.findNext = ""#key.goLine = ""#key.wordLeft = ""#key.wordRight = ""#key.blockStart = ""#key.blockEnd = ""#key.blockUnset = ""#key.macro = ""
The text editor is supplied withTETX
a text tool in order to help you to processtext files.
TETX v1.01 / 20 Nov 2021 - (c) 2021 Miguel Garcia / FloppySoftwareTE text tool.Usage: tetx [-options...] [fname...] [> fname]Options: -e Skip empty lines. -l Convert to lowercase. -n Print line numbers. -t[N] Convert tab to spaces (default = 4). -u Convert to uppercase. -wN Max. width of lines (32..255). -s Trim spaces on the right.Examples: tetx -ne mydoc.txt tetx -t4u -n letter1.txt letter2.txt > letters.txt
The-n
option will print the line number before each line:
25 This is a text line, 26 and this is another one.
The-t
option will convert tab characters to spaces,there is a tab each N columns:
+ + + + + + + +This line does not have a tab.But this one has one.And this one has two.A tabhere.
The-w
option will split lines longer than N characters:
This is a line longer than 32 characters.
The commandtetx -w32
will process the line as:
This is a line longer than 32 characters.
You can combine options as-w32nu
or-w32n -u
:
1 THIS IS A TEXT WITH LINE N 2 UMBERS. IT HAS A MAXIMUM W 3 IDTH OF 32 CHARACTERS AND 4 IT HAS BEEN CONVERTED TO U 5 PPERCASE.
The output is written tostdout
(the console). So, youmust use output redirection to a file, in order to savethe result:
tetx -w32nu draft.txt > final.txt
You can omit the input filename, in order to read the inputfromstdin
(the console):
tetx -w32nu > letter.txt
Or you can combine two or more files (-
meansstdin
):
tetx -w32nu header.txt body.txt footer.txt > letter.txttetx -w32nu header.txt - footer.txt > letter.txt
This program is freeware, and it's licensed under the GNU GPL license.
See the filecopying.txt
for more details.
Of course, this text file has been created and edited with te.