If I understand, you mean automatic word wrap that inserts an actual line feed marker in the buffer. That might actually be possible to do.
In my first attempt I had word wrap that was calculated from the top of the paragraph without inserting any line feed markers. That became complicated.
An alternative is to use some other control char to mark automatic word wrap. If I remember correctly, WordStar used such an internal marker. The advantage is that you can strip the word wrap marker when saving to file.
Yes, inserting an actual return character.
The VDE approach (the MS-DOS shareware text editor, which originated as a CP/M editor ... back in the early 90's my AWK IDE was VDE and LIST) was that word wrap returns did not REPLACE the space, they were inserted AFTER the space, so the sequence "<space><return>" could be treated as a soft return, and return after any NON space character was a hard return (on the CX16, this would include SHIFT-SPACE, which is the non-break space $A0).
So you could set a new line length, select a set of lines, and the "rewrap" function would adjust the word wrap to suit for lines ending in soft returns, and leave lines ending in hard returns alone.
So, for instance, if you have a block comment and you decide you want to change it from 80 characters wide to 60 characters wide to make it easier to read, you can, without messing up any hard returned line oriented source code that you are commenting.
However you do insert mode, you can postpone rewrapping until the insert is over, to avoid rewrapping bogging down responsive of the insertion ... and then you only have to rewrap through to the first hard return.
Text editor
Posted: Fri Sep 18, 2020 6:00 pm
by Stefan
Hi all.
I have just published version 0.0.4 of my text editor.
New in this version:
More bug fixes. Most of memory handler redesigned. The program is now more stable.
The program tracks if a document has been changed and asks you to save before any operation that would discard those changes (closing the program, opening a new document, creating a new document).
Other general user interface improvements.
Function to display memory usage implemented (press ESC and then m). Displayed as number of blocks free, inspired by the 1541. One block is 251 bytes of actual text data.
I also made a short video demonstrating some of the features. Look carefully, and you may spot a mistake in my C programming.
Have a nice weekend!
Text editor
Posted: Sat Sep 19, 2020 8:07 am
by Stefan
@BruceMcFI experimented a little with automatic word wrap.
As you said earlier, it's quite easy to monitor the length of a line as each char is typed in, and wrap at the previous word boundary by inserting a line feed marker.
That will be very close to GNU Nano's long line wrapping feature, which you enable by pressing ESC and then L.
It's at bit more complicated if you delete text in the middle of a line. Word processors recalculate the word wrap if this happens, and move words from the beginning of the line below to the end of the currently edited line as soon as each word will fit.
GNU Nano's long line wrapping feature works in a more simple way, and it will not recalculate the word wrap when you delete text.
If I do this, I'm thinking about going the GNU Nano way with word wrap. Would that be alright?
Text editor
Posted: Sat Sep 19, 2020 3:11 pm
by BruceMcF
16 hours ago, Stefan said:
@BruceMcFI experimented a little with automatic word wrap.
As you said earlier, it's quite easy to monitor the length of a line as each char is typed in, and wrap at the previous word boundary by inserting a line feed marker.
That will be very close to GNU Nano's long line wrapping feature, which you enable by pressing ESC and then L.
It's at bit more complicated if you delete text in the middle of a line. Word processors recalculate the word wrap if this happens, and move words from the beginning of the line below to the end of the currently edited line as soon as each word will fit.
GNU Nano's long line wrapping feature works in a more simple way, and it will not recalculate the word wrap when you delete text.
If I do this, I'm thinking about going the GNU Nano way with word wrap. Would that be alright?
That is very much how VDE worked ... there was wrapping as you type, and then after deletes/inserts made things ragged, a block select "rewrap" operation. Just waiting until the person doing the editing wants to see how it looks wrapped works fine. The key is inserting the wrap return after the space so rewrap knows which returns are soft returns.
Text editor
Posted: Fri Oct 02, 2020 6:16 pm
by Stefan
X16 Edit v 0.1.0 is released, and available in the downloads section.
New features:
- Copy, cut and paste
- Search and replace
- Go to line number
- Auto indent
- Tab key behavior improved
- Memory usage function shows correct value, as returned by Kernal function MEMTOP
- And of coarse, some minor bug fixes
This version suppports almost all features I originally planned for.
Roadmap to version 1.0:
I will try to include a simplified automatic word wrap and support for PETSCII mode.
Apart from that I will focus on cleaning up and making the code more efficient and beatiful, fixing bugs, and making the user interface nicer.
If you try the program, please let me know if you encounter bugs. Please, also let me know if the user interface language could be made clearer or better. English is after all a foreign language to me.
Have a great weekend!
Text editor
Posted: Fri Oct 02, 2020 10:05 pm
by desertfish
Wow, that looks good! I really should try it out someday, it's shaping up to be a very cool editor. However I do all my text editing outside of the X16 itself for now... I'll try to remember that this editor exists though for when I want to edit something on the machine itself!
Text editor
Posted: Sat Oct 03, 2020 2:47 am
by BruceMcF
8 hours ago, Stefan said:
X16 Edit v 0.1.0 is released, and available in the downloads section.
New features:
- Copy, cut and paste
- Search and replace
- Go to line number
- Auto indent
- Tab key behavior improved
- Memory usage function shows correct value, as returned by Kernal function MEMTOP
- And of coarse, some minor bug fixes
This version suppports almost all features I originally planned for.
Roadmap to version 1.0:
I will try to include a simplified automatic word wrap and support for PETSCII mode.
Most excellent. I will have a try of the new version sometime this weekend, as it is a holiday weekend (National Week Holiday) in Beijing, but this sounds like most everything I need from a general system text editor for Forth scripts.
Text editor
Posted: Wed Oct 07, 2020 5:04 pm
by Stefan
Released version 0.1.1 with support for both PETSCII charset and the ISO charset.
On startup, the program now also detects the current charset and uses that.
Thanks to @SlithyMatt for his tip above in this thread on how to do that.
Text editor
Posted: Sun Oct 11, 2020 12:52 pm
by Stefan
I've started working on a simple word wrap function.
It's very rudimentary: If you type a letter at the set right margin, it will wrap at the previous blank space.
It will not wrap or rewrap text in any of these cases:
If you insert text at the beginning of the line, even if the length of the line goes beyond the set margin
If you delete a line feed marker
Is it good enough?
Enclosed also a short video demonstrating what I'm talking about.
Text editor
Posted: Wed Oct 14, 2020 4:59 am
by Cyber
How the wrapped text is saved to file? Does it just insert a "new line" where the wrap happened?