text formatting
ZXNet echo conference «code.zx»
From Sergey Zotov → To Jaroslav Voronin 1 March 2000
Reply-to: zs80@ssu.samara.ru
On Thu 27 } 2000 Jaroslav Voronin wrote:
JV> Does anyone have an algorithm thread
JV> subject, no matter where it comes from (is-EDIT, ZX-Word, ZxASM)???
The algorithm is simple.
Let's start from the beginning of the text, i.e. this is the beginning of the line.
1 Remember the position. 0.
2 Look for the first separator - space, tab, or whatever else fits this
definition. You can kill double separators along the way.
3 Check the position. If it is less than the specified right margin, then
remember it and go to 2. :)
4 Otherwise, we return to the remembered position, insert the end of the line
(#0d,#0a).
5 Calculate the length of the string by subtraction.
6 Now we run from the beginning of the lines to the current position and insert double
spaces, increasing the length of the line until we get the specified one.
7 And now, bast and bast, start all over again. :) And so on until the end of the text.
Although the algorithm is simple, everyone has their own implementation. So good luck.
e-mail: zs80@ssu.samara.ru ~/ <~ http://www.zx.ru/zs/
ZXNet: 500:8462/1 /_ _> ftp://zx-museum.org.ru/zs/