This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
nitrogenfingers's profile picture

[Editor] WYSIwrite

Started by nitrogenfingers, 11 February 2015 - 10:41 AM
nitrogenfingers #1
Posted 11 February 2015 - 11:41 AM




What is it: WYSIwrite is a text editor for computercraft specifically designed for writing documents that will be printed out. It is a WYSIWYG editor in a similar style to Microsoft Word, Libre Office and other document writing programs; the way your document looks in the program is almost identical to how it will appear when it is printed out. WYSIwrite is deliberately feature-light and simple to use, and is aimed at those using computercraft on a server or to share with friends to get a little more utility and ease of use out of printers.

WYSIwrite is supported on advanced computers and, surprisingly, advanced pocket computers.

Screenshots:
Spoiler





Usage: The pastebin link above contains the standalone executable.
As this program is sort of designed as a companion to other programs, I've included it in a resource pack and a treasure disk, links for which I've included here:

Resource pack: http://www.mediafire...iteResource.zip
Treasure disk: https://www.mediafir...urccdd99z29c7wx

Beyond that, the code is free for repurposing and modification, such as the paginateOverflow and paginateUnderflow functions that can be used in your own programs to format your text to fit neatly into a window or page. But it's pretty messy, and I expect you could write a cleaner and more efficient function with a bit of elbow grease.

Comments and bug reports always welcome as messages or in the comments.
-NF
Edited on 14 April 2015 - 11:23 AM
InDieTasten #2
Posted 11 February 2015 - 03:08 PM
It's him again D:

Don't know whether it's intended, but your resource and treasure links direct to the same file fixed
Edited on 15 February 2015 - 09:30 AM
biggest yikes #3
Posted 13 February 2015 - 09:50 PM
Best. GUI. Ever.
Geforce Fan #4
Posted 15 February 2015 - 07:00 AM
This has been needed for a VERY long time.
Thank you.
nitrogenfingers #5
Posted 05 March 2015 - 02:06 PM
Spurred by some other stuff I added one or two little modifications and interface niceties; a more detailed print menu and a few warning messages. Makes sense for a program about printing…

I've also made edit mode available. You can get to this right now by adding tab (later it will be a menu option) and it shows spaces and newlines if you're trying to format your document nicely.

Spoiler


This isn't a terribly exciting project I know, but I might keep pecking away at it, possibly adding a few format features like justifying, bullet points, margins and other things to make this a bit more interesting.

-NF
Edited on 05 March 2015 - 01:17 PM
GopherAtl #6
Posted 05 March 2015 - 02:28 PM
This isn't a terribly exciting project I know, but I might keep pecking away at it, possibly adding a few format features like justifying, bullet points, margins and other things to make this a bit more interesting.

it may be a niche program, but for those people wanting to use cc printers to make in-game books, it's a very useful one! Beats the heck out of the guesswork involved in trying to lay out pages in a normal editor, and spares you the waste of paper, ink, and time involved in testing said page layouts.
LDDestroier #7
Posted 05 March 2015 - 02:34 PM
This looks really cool! Does it have anything that Ink doesn't though?
GopherAtl #8
Posted 05 March 2015 - 02:53 PM
This looks really cool! Does it have anything that Ink doesn't though?

Well, lets see. I just installed the latest release (non-beta) version of OneOS so I could compare.
Ranty results inside….
Spoilerless than a minute of just attempting to type into Ink and I run into multiple bugs. The cursor position doesn't update except when you're actually modifying text, arrows and clicking to move it don't update it's position.

Sometimes the cursor seems to just go away completely.

enter to start a new line at the end of the file doesn't update the cursor position, or scroll the view, even when the cursor moves on to the next page.

And clicking into the 2nd page to set the cursor position doesn't seem to work properly, putting the cursor at 1,1 on page 1 instead.

And then sometimes it just spazzes out completely, drawing the cursor in the wrong place even when editing text, drawing the cursor completely off the page, etc.

Does not having those rather significant bugs count as having something Ink doesn't?

How about "not requiring an entire complex operating system?"

:edit: Sorry for going all attitude here, it just… this sort of thing is a pet peeve of mine. You cannot judge a program, much less compare two programs, based on screenshots and posted feature lists. You have to actually use them. Even my minimal attempt to use ink reveals it has bugs that make it completely unusable. My few minutes with WYSIwrite revealed no bugs.
Edited on 05 March 2015 - 02:01 PM
nitrogenfingers #9
Posted 05 March 2015 - 02:54 PM
<snip>
Cheers Gopher :)/> I kind of hope it will see more use as a treasure disk, where it's probably more useful.

This looks really cool! Does it have anything that Ink doesn't though?
I'm actually not familiar with Ink, and given I've tried to keep this pretty feature light I doubt it :P/>

Edit: Ohh that's really embarrasing, they look identical! I was not familiar with the program before I started writing it….
Edited on 05 March 2015 - 02:06 PM
bear5567 #10
Posted 05 March 2015 - 07:04 PM
now if only someone could make a program like this for quick fancy monitor sign making
DannySMc #11
Posted 09 March 2015 - 11:45 AM
- snip -

This is true, Ink has so many issues, including performance and the fact the cursor doesn't always update when you click it, it also doesn't like the enter key and doesn't always work, this program I have to say is clean as clean could be, maybe add it and make it something as a text editor where you can highlight text and a little more? But this is awesome.
nitrogenfingers #12
Posted 09 March 2015 - 03:30 PM
Thanks :)/> I did an awful lot of unit testing to get it workable; took about 10 times as long to debug the functions as it did to write them. WYSIwrite has instilled the fear of the underflow paginate in me…

I've got a few features planned;
- Page breaks, so you can break your page
- Section breaks and nl-section conversion so formatting can be changed from one section to the next
- Left, right and center alignment within sections
- Bullet points with indenting
- Color highlighting stored in-line (and support for printer when a printer peripheral comes out)
- A file format to preserve all this stuff, as well as a way to convert between that and plaintext
nitrogenfingers #13
Posted 13 March 2015 - 05:11 AM
Well that was easy…
Spoiler

Sadly everything else on my list is not so easy. Fs doesn't recognize form feeds as newlines so I'm having to put in a thousand and one exceptions to get page breaks working smoothly and nowhere near so far. Maybe in a few more days…
cdel #14
Posted 13 March 2015 - 11:59 AM
Well that was easy…
Spoiler

Sadly everything else on my list is not so easy. Fs doesn't recognize form feeds as newlines so I'm having to put in a thousand and one exceptions to get page breaks working smoothly and nowhere near so far. Maybe in a few more days…

Looks good!
_removed #15
Posted 15 March 2015 - 11:08 PM
Always pleased wih what you produce NF, because it is always functional and 99.99% have no bugs!
willwac #16
Posted 22 March 2015 - 07:39 PM
- Page breaks, so you can break your page
*Takes axe to paper*
On a more serious note, this looks very cool!
nitrogenfingers #17
Posted 14 April 2015 - 01:30 PM
Another update here, I've made listed it above as "latest" because bug tracking is a bit difficult with this iteration and this one isn't stable.

http://pastebin.com/RSyhCjqv

A few features added to this version with more to come:
- You can 'test' the alignment options here, center right and left available. Right doesn't work well (I have to hide the right margin) so comments welcome.
- Page breaks, which are pretty buggy and have had a lot of issues with pagination.
- Undo and redo. It's not quickly accessible sadly but does have effectively infinite range and a little trick to mean you don't need to do it too often
- A recover feature, that will restore your last version of the document if there's a program crash. This is saved as a hidden file on root.

Comments welcome as always :)/>. I'm considering adding a prefs file as I don't like saving those hidden files but that'd itself probably have to be a hidden file or something similar, so if anyone has any suggestions on this that'd be great too.

-NF
Edited on 14 April 2015 - 11:34 AM
DannySMc #18
Posted 14 April 2015 - 01:36 PM
Another update here, I've made listed it above as "latest" because bug tracking is a bit difficult with this iteration and this one isn't stable.

http://pastebin.com/RSyhCjqv

A few features added to this version with more to come:
- You can 'test' the alignment options here, center right and left available. Right doesn't work well (I have to hide the right margin) so comments welcome.
- Page breaks, which are pretty buggy and have had a lot of issues with pagination.
- Undo and redo. It's not quickly accessible sadly but does have effectively infinite range and a little trick to mean you don't need to do it too often
- A recover feature, that will restore your last version of the document if there's a program crash. This is saved as a hidden file on root.

Comments welcome as always :)/>/>. I'm considering adding a prefs file as I don't like saving those hidden files but that'd itself probably have to be a hidden file or something similar, so if anyone has any suggestions on this that'd be great too.

-NF

Nice update, I like, I would say though maybe add some way of making some text aligned and some not? and a huge feature that would be awesome is text highlighting and being able to highlight text and simply delete it etc, that would be awesome but nice update!
nitrogenfingers #19
Posted 14 April 2015 - 01:39 PM
Yep first thing planned once I've got this one bug-fixed will be section breaks; that'll allow alignment differences, coloured text etc.
DannySMc #20
Posted 14 April 2015 - 02:00 PM
Yep first thing planned once I've got this one bug-fixed will be section breaks; that'll allow alignment differences, coloured text etc.
Awesome can't wait.
Konlab #21
Posted 03 October 2015 - 08:00 PM
Can this open txt formats?
If it can, then will it save them to txt format?
nitrogenfingers #22
Posted 04 October 2015 - 08:26 AM
You can test this yourself pretty easily with any text editor, but yes WYSIwrite reads and saves files presently in a plain text format, and plain text only.

Later versions (if and when I get around to publishing them) may make use of a custom format, or a feature subset of RTF, but for the moment all WYSIwrite documents are compliant to txt.