Most Text Editors Get Tabs Wrong

Why do PC based text editors get tabs wrong?

I’ve been getting back into COBOL and writing a book on GnuCOBOL. This lead me to writing a book on Emacs. For no more people than they have, they’ve done an amazing job. This lead me to poking around for the correct editor, preferably one that could be close to a full blown IDE.

I know. During my VAX/VMS days I happily used EDT, dropped to the command line to compile, then ran the executable under the VMS Debugger. All in a hardwired terminal. When we got LSE where I could compile and fix errors in the editor it was fantastic.

When I’m on a PC, I want something close to an IDE. It’s a psychological thing and no, I don’t feel like going through therapy. I have the same psychological thing about driving. When I’m in the city of Chicago I will walk for miles once I have a place to park my car. When I’m in the suburbs I’ll drive if it is more than a block. This can happen on the same day.

Visual SlickEdit Pro

This lead me to try many different editors. I tried Visual SlickEdit Pro. At $299 or whatever dollars for a single OS installation, man does it suck. I spent half an hour trying to get it to compile and debug GnuCOBOL and couldn’t make it work. The only reason I was interested in the Pro version was it claimed debugger support. I uninstalled the free trial within two hours of getting it.

Quick COBOL failures

Sublime Text kind of let me down as well. I still own it, but it was kind of rough when it came to COBOL. Actually the real downfall was the Debugger package required creation of a “project.” I wasn’t ready to bite the bullet of yet another “project file” syntax. Notepadqq had great color syntax if and only if you were using the original 80-colum fixed format. KDevelop has had people begging for a COBOL plug-in for years but no takers. The Eclipse COBOL plug-in is apparently abandoned.

VSCodium

Someone pointed me to VSCodium. This had some issues, but it looks nice when you are writing fixed format COBOL.

VSCodium with fixed format COBOL

Not so much when using free format COBOL.

VSCodium with free format COBOL

The one thing it got right is the TAB key. Your first TAB puts you into Area-A (column 8, just over the second gray vertical line). Your second TAB puts you into Area-B (column 12). The first two gray vertical lines mark the comment/continuation column. I guess technically the first one marks the end of the line number column range.

UltraEdit

All of this lead me to try justifying once again paying $99/year for UltraEdit. I have a love/hate relationship with UE. There are things I really like. There are far too many things half-assed. That is one of the many reasons I don’t currently pay $99/year to them.

If I’m paying for an editor I shouldn’t have to hack a hidden script somewhere to change the C++ coding style. When the Linux version is treated like an ugly red headed step child chained in the basement, I don’t feel compelled to fork over the cash either. Professionals don’t use Microsoft products.

Oh yeah, debugger support. That only works in UltraEdit Studio. Oh yeah, UltraEdit Studio only runs on Windows.

UltraEdit free format COBOL
UltraEdit fixed format COBOL

Tabs are inexcusable

The syntax highlighting wasn’t bad. What was inexcusable was the tab. Sublime Text, UltraEdit, notepadqq, and KATE all get this wrong. The vast majority of PC text editors get it wrong. Emacs gets it right. Emacs also supports GDB on Linux. I can put the following two lines in my .emacs file and tabs work exactly as they should.

(setq-default intent-tabs-mode nil)
(setq default-tab-width 4)

Sitting in an empty file in Emacs with those in my init file, my cursor is at column 1. Hit the tab key and my cursor is in column 4. Exactly as it should be. COBOL programmers adapted to this years ago when we were forced to use non-COBOL specific coding tools. Today’s kids never used a manual typewriter. They have no idea how tabs are supposed to work, so they guess.

I hate linking to images. The sites go down and you get an empty spot. If terminals-wiki.org ever comes back up you should see the images.

I no longer have either my VT-100 or VT-220 so cannot take a shot myself. Given that we will first go here.

tab-setup-screen.png (136.13KiB)

Well, I found one of the shots, just not the one I was looking for.

Now we have to think why COBOL’s Area-A starts in column 8.

COBOL coding sheet image
COBOL coding sheet

Hopefully your browser will let you zoom that image to full screen. Yes, that is a picture of COBOL coding sheets I’ve saved since junior college. We bought these tablets by the pack. We had to hand write every line of COBOL, get it proofed, then we were allowed to type it in.

 

Typewriters set the standard for tabs

On both manual and electric typewriters, well, IBM and Smith Corona which were the two biggest brands of the “modern” typewriters once we got rid of the Underwood that didn’t even have all of the keys, the first physical tab stop put the next printable character at column 8. Wow! Someone had a good one of these!

The carriage/platen stop was always placed one character travel beyond the type guide. There was a gear with a toothed rail controlling all of this. Keypunch machines and paper terminals maintained this convention in large part because the early models of both were little more than customized typewriters.

VT terminals saved the day

COBOL programmers fortunate enough to have a VT-52, 100, or later were overjoyed. Not only did it allow you to manually set the tab stops, it came with two setups, A and B. A, the default power-on setup, was almost always left to factory tabs of 8. This was so if mere mortals needed to use it they could. Setup B was normally used by COBOL programmers. The first tab stop of 8 was left in place but an extra tab stop was placed at 12. If you worked at a shop that had a “final comment” standard, you added a tab stop which put your cursor in column 73.

PC based editors suck at tabs

What happens with UltraEdit and most ill designed PC editors is they simply insert 4 spaces. Sitting in column 1, you hit tab and you land in column 5 when you have tab-width set to 4. The second tab lands you in column 9. You can do the math from there.

The ultimate test is rather simple. Pull down GnuCOBOL. Use UltraEdit or your favorite text editor with soft tabs set to 4. Type in a simple “Hello World” COBOL program using the tabs you say are correct and the 80-column “fixed” card format pasted above. Compile the program. It should fail miserably because Area-A starts in the wrong place. When text editors implement tab stops correctly, this doesn’t happen.

cobc -x -fixed -std=cobol85 COB001.COB

There was a method to the madness. Today’s kids just didn’t bother to learn it. Thank God for Emacs!

Related posts:

The Best Part of Low End

KWrite and KATE

Thank You For Your Future Abandonware

Few things honk me off quite as much as abandonware, especially when something good is abandoned. Microsoft could abandon everything they make and I would not care, none of it is a quality product. Other things really hurt.

You are reading this because there was yet another Qt question on the Qt mailing list from yet another person creating yet another glorified text editor/crippled word processor. I think this one was supposed to support markup language. I cautioned them against creating future abandonware and pointed them to existing Qt based word processors some of which had already been abandoned and had most of the features they wanted. After building it all they would have needed to do was add support for their special syntax.

Given the fact they were working in C++ and Qt I first pointed them to KATE. This editor has been around a long time and recently made the hop from Linux to Windows. Most importantly, if you scroll just shy of halfway down that page it tells you how to build just KTextEditor, the editor component used by KWrite and KDevelop. It’s probably also used on a hundred other lesser known or private projects. Why re-invent the wheel if all you need is a couple of tweaks to the KTextEditor?

Nah, they didn’t go for that. NIH (Not Invented Here) syndrome in full bloom.

This got me thinking about all of the other text editor and word processor abandonware I’ve encountered over the years. KWord was a serviceable word processor. It was abandoned for the ghastly Calligra Words project. All mention of KWord is slowly being purged from the Internet. You can still find a snapshot of the KOffice source code here which includes KWords.

Adding insult to injury, Oasis was a Qt based word processor which began as a Qt example program. Basically, Oasis was about 2-4 years ahead of where the poster’s editor currently was. There are literally thousands of these things out there.

That brings us to one of the most painful abandonware cases ever.

It’s amazing IBM can make money given how clueless management is

I will skip over the massive OS/2 abandonware issue, well, at least most of it. Lotus SmartSuite was and still is a particularly painful part of the abandonment. Some of these pictures are going to seem really grainy. When you install Lotus SmartSuite on Windows 10 or really any Windows after 98, the fonts it installs are old. They are from a time when SVGA was the bleeding edge of screen resolution and the bulk of the world simply ran VGA. I didn’t feel like lowering the video capabilities of the VM. One adorable quirk the product had was the “floating file cabinet.” A thin little bar you could move around on the screen. Each of those brown wood grained buttons is a “drawer” where things are filed.

SmartSuite File Cabinet
SmartSuite File Cabinet

Lotus 123 ruled the spreadsheet universe. Honestly, the last version of 123 ever released is still ahead of Microsoft Excel.

Lotus Approach was a victim of zero marketing. I’m not saying it was a fantastic database, it was a fantastic report creation system driven by a database. For years I had my expense tracker system in Lotus Approach. Why? The data entry screen took about ten minutes to set up. The actual expense report with beautiful fonts, perfectly aligned columns, group totals and grand totals took about thirty minutes or so to create. It really looked professional too. Microsoft Access is still trying to get where Lotus Approach was when it was abandoned.

calendarThe calendar and address book portions were kind of cool. With hundreds or thousands of such things around today most of you don’t realize just how ground breaking it was to have such things all integrated. This was back when we were still shipping software on floppies remember. You could double click a spot there to create a new appointment for today or you could open up the calendar application and be greeted by a full software version of a Daytimer planner.

lotus organizer

Yes, you could change the view to be a week, month, whatever. I used the Lotus Organizer a lot. Those little Daytimer planners were getting to be hundreds of dollars when I stopped using them.

Address book
Address list

Everything was integrated for the very first time. You don’t think much about that now if your company has a pricey, unstable Exchange server, but this was a major feat. You really needed to have Team Center email at your company to get full use out of the email integration part. As I remember it didn’t work well with the Internet email of the day. Having said that, we didn’t have email standards yet. A regular person couldn’t send email from Compuserve to an AOL user. Every ISP wanted to own the Internet and all its content. The best way to do that was have a proprietary email system. Big Government had to step in and thump that. Today you don’t even think about the @someUrl.Blah portion of an email address when you send an email, but there was a long, dark period when you couldn’t “just do it.”

Don’t dis the layout of the address drawer too hard. It matched what the executive secretary had on their desk. A low level clerical person like a receptionist had a great big Rolodex of cards. The higher you went in a company the smaller and more stylish your list and address tracker became. You had people to do things for you. Those people had the great big Rolodex. You only had to keep track of the executives in Mahogany Row and a few special friends outside of the company. I seem to remember mine having the slider on the left. Honestly, I just threw it out when I changed desks this past fall.

Bates Listfinder image
Bates Listfinder

The slider worked because the cards inside had cut edges. The slider hung well down below the card edges. You slid the slider down to say, K, and then clicked the open button. All of the cards before K were missing the indexer edge.

Bates List Finder opened image
Bates List Finder opened

 

Lotus WordPro was and still is the best word processor for a writer ever created. It has features that were and still are earth shattering. In particular Sections and Divisions are something nobody else has really duplicated. There is a claim Scrivener has something similar, but I haven’t played with Scrivener yet. Installed Scrivener in a VM and basically forgot about it. Had it not been free to try I probably wouldn’t have even done that.

application drawer image

supported file formats image
Supported file formats

As you can tell by the list of supported file formats, WordPro has not been updated in a long time. We really need a Change.org campaign to get the federal government to pass a law requiring vendors to Open Source anything they abandoned posting a fully tested build script with all source on both GitHub and Sourceforge. We have simply lost too much. IBM didn’t kill this off because they launched a competing product. They killed it off because they got out of the PC software business not long after the death of OS/2. At least that was the story, but Lotus Notes is still around.

WordPro document image

Don’t confuse these tabs with tabs for different documents that lesser word processors use today. These are Divisions. You can even change the color of the Division tab along with its name so Research can be one color, To-Do list another, etc.

WordPro print dialog
WordPro print dialog

Notice in the bottom box of the print dialog that you can choose to print only the current division. I should point out that when you drag divisions to different locations you actually change their position within the file hierarchy. The next part should really blow your mind.

creating section image
creating a new section

document with new section image
document with new section

Take a good look. Notice the green “My New Section” tab is within the “Body” division. Every Division can have however many Sections within it. I don’t know if there is a physical number hard coded into the design or the only limit is the combination of physical memory and disk storage. Sections are amazing!

section image 1
Sections for Chapters 2 and 3

Notice that I created Sections for Chapter 2 and Chapter 3. To make them stand out I gave each tab color.

section image 2
re-arrange sections

Notice that you can just drag and drop a section to a new location. When writing a book it is often the case we have to re-arrange chapters. No matter what widely known word processor you are using now you are either selecting huge chunks of text to delete then paste in a new location, or you are simply deleting the stuff and retyping from either a print out or pdf. When an editor tells a WordPro user to make the third chapter the first chapter, it’s no big thing, drag and drop. Oh! You may have to fix some stuff in the text itself due to story line, etc., but the mechanics are no longer a horrible error prone thing.

Section drop down menu image
Section drop down menu

I imagine the cut and copy items are grayed out because Windows 10 has a different paste buffer API than Windows 3.1. Just a guess though. I just wanted to show you the right click section drop-down menu. It lets you do quite a few things. I just don’t feel like going through section mark and combine right now.

section moved to new division image
section moved to new division

The last thing I wanted to show you is dragging a Section from one Division and dropping it in another. People who don’t write for a living or to just be an author probably don’t understand just how indispensable this ability is. A professional writer or someone who hopes to one day be a professional writer must always have an open scraps Division. Never just nuke a chapter, scene, whatever, put it in a scraps Division. This advice is especially true during early external editing phases and “I got lost in the middle of the story” rewrites. That problem spot may get fixed and re-added. You may learn (because your editor informs you) the reason that problem spot was a problem is because you screwed something else up way early in the work.

It happens man. Adding insult to injury, it will be something you dropped in, not even caring about it. You gave some character a disability or background trait that sounded so good for five to seven sentences, then it never came up again in the book. Well, not until you got to the end of the book and now you need that not to exist only you are so far past it you don’t remember why or if it was a really important thing when you added it. Yeah, you aren’t finding that mistake on your own, you need an outside reader.

What happens if you are using Microsoft Word? Well, you select a bunch of text, copy, cut, then open a new scraps document file and paste it in praying you don’t lose it along the way. Oh, but you most likely lost the page styles including their sizes. Probably lost other stuff too.

It was a really sad day when IBM sunset Lotus SmartSuite. Sadder still that our Federal government didn’t force them to Open Source the code so someone could maintain it. We really need the Federal government to force IBM to release the source code, build configuration, and all development documentation. This is some abandonware we should never have lost. We could probably get it ported to Linux without a huge effort, especially if it was cleaned up to be Wine compatible.

KWrite and Kate

One thing which always annoys me about being forced to use a Gicky-Gnasty-Gnome based desktop is the total lack of indispensable packages. While, in theory, you can install KWrite and Kate under Gnome, they don’t run correctly. At least, they don’t run correctly on YAU (Yet Another Ubuntu) releases. I believe this is due in large part to Canonical not testing desktops together. They ship different products for each desktop so not much cross desktop testing needed in their view.

I spent a good many years in RPM hell with SuSE. I endured the ugly thing called YAST. I spent many an hour trying to recover from RPM installs which gagged part way through leaving the package manager in a state where one could neither uninstall the broken package nor repair it. Admittedly I was on dial-up and the package manager was absolutely worthless when it came to handling a lost Internet connection.

The thing which kept me using SuSE was their cross desktop testing. Back then when you installed SuSE you could install all of the desktops during the initial installation process. There was a high level of cross desktop testing. You changed your desktop with each login. Despite all of the other issues, I never noticed a problem where a KDE software package ran badly under Gnome or the other desktops.

Yes, when I’m doing development on Linux I’m typically using QtCreator because I’m developing with C++ and Qt, usually for some embedded target. That doesn’t mean I don’t use other editors. Here is what I tell the young developers on any of these projects.

Kate is your mommy. Tell your mommy everything and she will tell it to you when you need it again.

People laugh at that, and that is the point. You remember something which is funny. When they ask I tell them that Kate is more than just a fantastic editor. It’s a limitless shelf to store information you really need on. Once configured to automatically save the session on exit, you can have as many cheat sheet files as you want open in it. You click the one icon you add to the bar or desktop and one thing with all of your cheat sheets opens up.

A couple of projects ago everybody laughed at the Kate line, but by the time the project was over most of them had came to get one of my cheat sheets. Yes, they had theirs, somewhere, but mine were always right there. I didn’t have to remember file names or where I put that piece of paper.

KWrite has become another indispensable tool. Not so much for development. There have been a good number of years where WordPress ships an editor with severe gastrointestinal disorders. Not only is it slow and cumbersome to use, pasting to it from a text editor is fraught with peril. There was a brief period where Blogilo worked, then it was over. Just as brief a period where OpenOffice (before it was consumed by a corporation and dropped from most distros) where I could reliably past from OO. Once that stopped working I had to search for a text editor then reformat all of my embedded links. For a while the only text editor I could achieve some semblance of acceptable results with was Tea, then that quit working. Finally KWrite started working with WordPress. Yes, I still had to re-work all of my embedded links, but there was a 50/50 chance when I told the WordPress editor to perform full justification on the text it would actually work and that was the highest success rate I had found.

Recently I tested LibreOffice with WordPress and, in fact, I’m writing this post using LibreOffice. There seems to be some level of cooperation between the two packages now. That said, I still use KWrite a lot. I used it half a dozen times this morning while writing email just to look up spelling. Yes, Thunderbird flags the words as spelling errors and has some spell check feature, but when you have links in your SIG and other technical stuff in the email message it is a PITA. Much more efficient to notice the little red squiggly and pop the word into KWrite for magic to happen.

I keep seeing posts calling Gedit the Gnome equiv of KWrite. Well, it’s not. It has improved over the years, but it is still ugly. To compete with Kate you have to go commercial, or, you have to work around IDE needs in things like CodeLite and QtCreator just to write a blog post. The closest commercial product I have found is UltraEdit. There were a few years when I occasionally touched some nasty Windows stuff in the dark and distant past. (Thankfully I now only have to touch Windows once every 6 months or so to load results from my glucose meter for my doctor. Yes, enough sizable companies have left Windows so you never have to touch it again.)

During the dark period, when I had to touch that “other” platform, I wanted to find a commercial editor which ran on both (and ran the same on both) so I could load and go. That said, the Linux version was always the ugly red headed stepchild chained in the basement. The doc, help text, and even user forum answers would always be from a handful of Windows users. The real killer was the licensing. Ultimately they wanted $100/year for the rest of your life. Why pay that kind of money for something you don’t like as much as Kate and KWrite?

So, now that I’m going to have to use Gicky-Gnasty-Gnome for a while, I have to once again search for something which can begin to compare to both Kate and KWrite. At least until I can find a non-RPM based KDE distro which gets around the current set of NVidia problems.

Yes, I’ve looked at Jedit. I tried to use it for many months. Yes, there are a plethora of plug-ins. There are two things I’ve never been able to get over when it comes to that editor:

1) It’s a pig! To get many of the plug-ins to work you have to hack the JVM startup script and give it more memory which makes it a bigger pig. I can see why that “load in background at startup” option is so popular.

2) No matter what settings I tried the font rendering was simply atrocious.

I’ve tried almost every editor out there at some point. Kate and KWrite have simply been reliable tools which found places in my workflow. When I have to work in a situation where they either aren’t available or don’t work well, I become annoyed.