Line justifier (Rainbow 1981-08)
Last month we said that we'd have a line Justification program ready for this month's issue. The listing is included below.
We were writing the RAINBOW last month with a simple word processor that let us enter a whole line and make corrections before it was. committed to the print buffer on a printer. That was an improvement over the program that the manual had, mainly because it allowed us to backspace for corrections. In the case or the RAINBOW, where we want to have lines which are right-justified, that wrorked only to a degree -- mainly because we had to type the line and then go back and add spaces to make the lines come out even on the right-hand side. While the was easier than typing the RAINBOW on a typewriter (which would have required two typings) it was still a hassle. Thus was born the (mini word processor below.
What happens here is that, using the INSTR Command, we search for spaces in a line and then "peel off" spaces from the end or each line and add them to the spaces which are already between the words. Each line is entered as A$ and then pulled apart. Spaces are inserted, and then the line is put back together. There are two variations, one for a full-length line and the other for a half-length one.
The program requires the typist to space to a certain spot on the line, in effect, to fill up the line with spaces (a printer might call these space bands). Those spaces are then repositioned in the line to make it come out evenly.
The screen display is set up so that there is a little black block for the typist to "aim" at. Once the typist gets close to the block, he or she just spaces in blanks until the cursor covers the black block. Then, the line is entered into the print buffer and printed on the line printer.
As an added aid, the last line typed is shown on the bottom of the screen. One of the reasons for this is because we felt it would be easier for the typist to begin the next line knowing what was on the previous line — without the need of having to look at the printer.
For short lines, Just hit ENTER when the line ends. However, a bug ray — but will not always -- appear if you. type a VERY short line. What can happen is that the one or two words in the line will repeat themselves. If that does occur, just space down and retype the same line. It will go away.