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

[currently unsupported] [1.3,1.4] GEdit v0.4 - word processor. undo/redo. Now with screenshots!

Started by GopherAtl, 25 September 2012 - 03:06 PM
GopherAtl #1
Posted 25 September 2012 - 05:06 PM
Notice
This project is currently on extended hiatus. The code became an unmaintainable mess, and needs to be rewritten from the ground up. A new version will be implemented down the road, with a shifted focus; the original project was essentially intended to be a word processor, which could also be used to edit code; the new version will be dedicated to code, with some very slick integrated features for testing and debugging.

What started as a plan to add basic support for my print manager's features into edit has turned into a total overhaul of the standard edit program.
The printer support isn't even ready yet, but it's got some excellent features unrelated to printing that make it useful already even in earlier versions of computercraft - most notably undo/redo support! If you run into any problems, please post bugs here, it'll really help me find & fix them all!

Latest Update: Added support for my printAPI, meaning color printing through the print manager. Still some bugs to work out before I'm ready to release that, though, so no new version of gedit yet. Soon, though, will release new version of gedit, as well as server and client install programs for printman, so you'll be able to use gedit as a proper word processor. Really hoping dan's screenshot teaser on twitter means full color monitors, and not just a term.setBackgroundColor function, so I can make gedit actually display the documents in color as they will print!

Screenshots
SpoilerA document in code view, showing color codes

Same document in page view, with print codes hidden and lines wrapped at paper page width

This one's showing not-yet-released functions, the output of the same page above through the printAPI and printman

The print settings form, where tab and indent settings and number of copies are entered, and where the user can add, remove, and select a printer from those available

Current features:
Spoiler
  • Basic menu replaced with organized sub-menus, new menu commands (see below)
  • undo/redo
  • ctrl+key shortcuts!
  • multiple page view options - Code, Document, and Page view
  • Confirmations - where appropriate you are asked to confirm an action that would lose unsaved changes (exit, revert, later open)

Planned features:
SpoilerTop-priority:
  • Completing integration with my print API, to allow connecting and using managed printers over rednet as well as semi-automatic multi-color printing locally (the manual part being it'll prompt you to change inks and refeed the output back to input between color passes; the print API manages splitting the document into passes by color, so no matter how many times you switch colors, it will require only one pass per color used)
  • fixing document and page views to fully handle printer codes
  • file picker dialog - gui-based directory browser to be used by "open" and "save as" commands
Things I would like to implement later:
  • Block selection and block-based editing commands - copy, cut, paste, swap
  • find and search/replace commands
  • multi-document support

Menus and Shortcuts
SpoilerThe menus will likely be further restructured before I'm done, but in the current version they are as follows:
  • File
    • Save (ctrl-s)
    • Save As (stub, not implemented) (ctrl-a)
    • Revert (ctrl-r)
    • Open (stub, not implemented) (ctrl-o)
    • Exit (ctrl-x)
  • Edit
    • Undo (ctrl-z)
    • Redo (ctrl-y)
  • View
    • Code View (ctrl-1) - the normal edit view, no line wrapping or print-related formatting
    • Document view (ctrl-2) - full terminal-width but with line wrap
    • Page view - (ctrl-3) wraps to the width of a printed page
  • Print (not fully implemented - currently uses edit's standard print process)
    • Print (ctrl-P)
    • page settings (not yet fully implemented)
    • print preview (ctrl-v) (not implemented)
A note on the keyboard shortcuts: CC does not directly provide support for detecting ctrl+key style shortcuts, which is why in standard edit you have to tap control to toggle the menu, but release it before hitting s, e, or p to save. For navigating my menus, I have kept that behavior, so tapping ctrl opens the menu, then tapping f opens file, then s saves, etc. In addition, though, you can hold down ctrl and press another key, like you would on your real computer, to use keyboard shortcuts. Note that unlike the existing ctrl-t, ctrl-r, and ctrl-s commands, these do not requrie you to hold it for five seconds, but rather register immediately, which is why I can use ctrl-s and ctrl-r for revert without conflicting with shutdown and reboot. Last note, I have yet to test this extensively in SMP; it is possible the technique will require tweaking to avoid mistakes under high-latency conditions.

Known Issues
SpoilerCurrent public version just prints using the normal edit print behavior, meaning it uses a connected printer, only prints one color, and the outut will contain the print codes for color, page break, etc as their %-symbols, rather than substituting or removing them. Next public version is a big update which will change this, which will happen as soon as I've got the last issues resolved with my printman print server program, printAPI interface, and their respective installers.

Pastebin
gedit v0.4a qCynmWK2
sjele #2
Posted 25 September 2012 - 05:10 PM
Interesting :P/>/>

Will try it out now ;)/>/>

Does renaming file cause errors?

I got an error when i did nedit sjele :: I called program nedit

I got 281: atemped to index a nil valvue
i'm on 1.31 version of CC
GopherAtl #3
Posted 25 September 2012 - 05:37 PM
hrm, I had not tested it in 1.31, just 1.41 and later, let me take a look at that line :looks: Wait, line 281, you're sure? That's… very strange. Well, for now I guess I'll have to say cc versions 1.41 and later only (sorry, tekkit users), when I get a chance I'll try and figure out what's wrong there and, if possible and practical, make it 1.31-compatible as well.

:edit2: Hmm. Not at a computer with cc right now, but it occurs to me to ask, was sjele a new file? I'm not sure if I've tested it with creating new files at start. Looking at the pastebin code now.

:edit3: :facepalm: I see the problem, can't test solution but fixing right now. I've been testing with existing files, and all of them more than 16 lines, so I hadn't run into it, but wow, obvious bug is obvious.

:edit4: edited a new link into the top post now with a fix. Thanks for testing; please try again, I can't test myself but this ought to fix it :P/>/>
sjele #4
Posted 25 September 2012 - 05:53 PM
Will do :P/>/> Good thing you fixed it ;)/>/>
GopherAtl #5
Posted 25 September 2012 - 05:56 PM
yeah, I'm very glad you came along and tested it so quickly, I might not have caught this for a while!
sjele #6
Posted 25 September 2012 - 06:01 PM
I still get the error on 281: attempting to index a nil :

I belive the .s is causing it
GopherAtl #7
Posted 25 September 2012 - 06:10 PM
Really? Argh. Not being able to test it myself at this computer is frustrating. I'll attempt to find the problem, but in the mean time could you test it with itself? gedit gedit, or nedit nedit, whatever you named it? Want to make sure this is what I think it is and not something else completely!
GopherAtl #8
Posted 25 September 2012 - 06:39 PM
:facepalm: Unless you grabbed v0.2a directly from my pastebin page, you never actually tested the fix, because my edit to the main post to change the link didn't save. Re-edited and verified the post saved this time.
sjele #9
Posted 25 September 2012 - 07:01 PM
Haha :P/>/> Will test again ;)/>/>


Edit: Another error this time on line 1221: atempting to index a nil ? value
GopherAtl #10
Posted 25 September 2012 - 07:07 PM
oohkay, that one can only be an incompatibility issue with cc 1.31, so not something I can fix right now. :/ if that's the only issue with supporting the tekkit version of cc, I'll definitely fix it and make a compatible version though, probably later tonight and post it tomorrow.

:edit: confirmed, that's where it's building the reverse table used for keyboard shortcuts, which uses the keys api, introduced in computercraft 1.4. Looked over the changelog on the wiki, not seeing any other reason it should be incompatible, so yeah, will be an easy fix once I'm at a computer with minecraft+computercraft again later tonight.
sjele #11
Posted 25 September 2012 - 07:15 PM
Okai. :P/>/>

Hopefully all will be fixed then
GopherAtl #12
Posted 26 September 2012 - 03:47 AM
bump for hugely more stable version. Rewrote code not to use keys api, tested and it now works in my tekkit installation. Also spent several hours fixing issues with undo/redo, mainly it was having errors with changes or undo when in page view, but that's all working now.

It's ready for use, more testers would be appreciated!
sjele #13
Posted 26 September 2012 - 01:53 PM
Wonderfull. Tested many of the menu functions, Can't wait to test some more
GopherAtl #14
Posted 30 September 2012 - 08:46 PM
bump for … well, was gonna be for a new release, but testing found some critical bugs with the printAPI and printman programs. Since the new changes in gedit are almost entirely based on those programs, delaying the release of this as well. Added some screenshots, though! so… bump for mostly shameless self-promotion..:)/>/>
laurentb #15
Posted 04 March 2013 - 01:27 PM
i get this

Usage: edit <path>

nothing further happens
GopherAtl #16
Posted 04 March 2013 - 02:09 PM
thanks for the interest, but sorry to say development (and support) on this are currently suspended. Will be revisiting the idea not too far down the road, with a focus shift from word processing for printers, which was the original gedit concept, to an advanced code editor, with some nice IDE features. Until then, I'm afraid wysiwyg with the last version of gedit :/
theoriginalbit #17
Posted 04 March 2013 - 02:14 PM
i get this

Usage: edit <path>

nothing further happens
Are you typing a path to edit in? like with the program 'edit'?
GopherAtl #18
Posted 04 March 2013 - 02:20 PM
thanks, bit, heh. I haven't even tried to run gedit in months. I can't imagine why it would not still work (as well as it ever worked), but I have no idea really, as when I last worked on it, advanced computers were still brand-new!