WordTsar – A Wordstar clone


This is another large release. This is the first stable release with a complete UTF-8 based backend. I’m still calling it pre-alpha because I’ve only really run it on Linux (quite extensively).

In this Release:

  • UTF-8 Backend (see below for tech details)
  • New RTF loader (less complete, but more robust)
  • New DOCX loader (incomplete, but not bad)

Bug Fixes:

  • Yeah, a lot of corner-cases from moving to UTF-8
  • Actual UTF-8 data entry from keyboard has not been tested, just copy from web to WordTsar.
  • I reset the build number for this release. Don’t ask me why, I can’t remember.

Tech Details

Every version of WordTsar has been using a gapbuffer for it’s underlying document buffer. Adding UTF-8 support added created issues with the single buffer issue. We now use a plain buffer per paragraph, and have seen some slow downs because of it. We’ve added caching that should get around that.

Carat movement is all grapheme based. If a grapheme is made up of multiple codepoints, deleting will remove the entire grapheme.

The File save and load routines don’t fully understand UTF-8 yet. Wordstar file save and load most likely never will.

I’m a Canadian English writer. All of this UTF-8 stuff needs more testing than I was able to give it.

I’ve used and am using this version extensively on Windows and Linix. There has been minimal testing under MacOS.

In this Release:

  • Fixed Ticket 18 (MacOS)
  • Fixed Ticket 17 (MacOS)
  • Fixed Ticket 15 (MacOS)
  • Fixed Ticket 16
  • Added full justification of text .ojon

Known Issues:

  • ^KP not implemented, use ^OP
  • .pt command can only be used once per document
  • See Ticket System at Sourceforge

This is the first release of WordTsar using Qt instead of wxWidgets.

The release is for Windows, Linux, and MacOS.

There are no new features.

MacOS does not have a flashing carat.

I’ve been developing various pieces of software in wxWidgets (back when it was called wxWindows!) for a long time. But recently, I’ve made the switch to Qt.

WordTsar under wxWidgets was stable, and I used it to write quite a few novels (http://geraldbrandt.com), so why the switch? Well, it seems that I always had to do something just a little different based on what platform the software was running on. Don’t get me wrong, 99.9% of the code was cross platform and worked well, but there always seemed to be corner cases.

Qt version, Windows and Linux

The last straw for me was when I tried to get WordTsar running under MacOS. I tweaked here and there. Keyboard input was a pain, but then it was under Qt as well. It was just easier under Qt because I’d already fixed the issue under wxWidgets. So, what was it that I couldn’t get working?

wxTimers.

I use timers to update WordTsar’s status bar, do word counting, and flash the carat. None of it worked under MacOS. Again, I tweaked here and tweaked there, but I just couldn’t get timers to work. Really, timers are a pretty basic function. They should Just Work.

About two years back, I did a test port to Qt to help me find an elusive bug. I moved over just enough code to help track down the bug, and stopped. This time around, I didn’t.

QT Version – MacOS

WordTsar is now 100% Qt based, with all the functionality of version 0.1 Release 1977. Well, almost. The Linux version of WordTsar had spell check working, using Hunspell. Non of the other ports did. I’ve decided to leave spell check out since I want to do it in a more cross-platform way.

What differences will you see with the Qt port? Some of the dialogs look different. Yup, that’s pretty much it.

Well, except for one thing.

Speed.

The Qt version is SIGNIFICANTLY faster than the wxWidgets version. Why? Two things in particular:

  1. Measuring of text under Qt just flies. Under Linux, measuring the widths of 605,814 characters took roughly 1800 ms. With the code optimized to measure strings instead of characters, I got that down to 460 ms. Under Qt, which can only measure individual character widths* the speed is 138 ms. That is a massive speed improvement.
  2. QString vs wxString is the second big increase. I do a lot of parsing of strings using .Mid(), .BeforeFirst(), .Left(), etc. I do no in string indexing (i.e. string[x]). Parsing WordTsar dot commands (string heavy) on a 111,000 word novel took 1060 ms under wxWidgets. With Qt, that process took 348 ms. I was planning to optimize the dot command routines to speed things up, and I still will (via some form of caching), but I can postpone that work now.

What this all comes out to, is under wxWidgets, laying out a 111,000 word document took 1670 ms. Not bad, really. Under Qt, the same process takes 576 ms. That’s a very noticeable difference.

I’ll be testing the Qt version over the next week by editing a 92,000 word novel and bringing that up to 100,000 words or so. Not a bad stress test. If all works out, there will be a WordTsar 0.2 Release xxxx happening next week for Linux, Windows, and MacOS.

* wxWidgets has GetPartialTextExtents() which, when passed in a string, will return an array of character widths. Qt has no such function. You can get the width of an entire string, but not the characters in that string. So, with Qt, I must measure each character.

I’ve used and am using this version extensively on Windows and Linux.

OSX version is being worked on.

Windows and Linux versions only.

In this Release:

Fixed Ticket 11
Fixed ticket 12
Added RTF export for subscript, superscript, and strikethrough
Added RTF export of columns
Changed RTF right margin to use /ri and not /margr
Added RTF export headers and footers
Added RTF export save hyphenation
Added RTF export margin settings
Added RTF export of indexes
Added RTF export of kerning on or off
Added RTF export save top, bottom, and paragraph margins
Added RTF export save page offset ((for odd and even pages, we use .poo to set RTF gutter (RTF only allows one setting))
Added RTF export save tabs
Added RTF paragraph alignment
Corrected Wordstar .mb usage
Fixed Windows scrollwheel use
Corrected RTF export unicode character support
Sped up RTF saving
Removed use of fontcache
Fixed wrong display of pagebreak at top of window
Fixed layout speed, especially under Linux
Corrected Linux layout to better match Word and LibreOffice

Features

Nothing on the WordTsar side really.
Improved RTF export
Faster Layout

Bugs Fixed

Ticket 11 and 12

Known Issues

RTF support for many dot commands is not implemented (see implemented.xlsx)
^KP not implemented, use ^OP
.pt command can only be used once per document, all others are ignored. (wxWidgets doesn't let you change paper type on the fly)
OSX keyboard input does not work
See Ticket System