Line Numbers in Text Editor

Alex Tweedly alex at tweedly.net
Fri Jun 25 19:37:18 EDT 2010


The straightforward answer is using formattedText ..... but the deeper 
question is what line numbering you want for the lines when there is 
line-wrapping happening. For instance, if it is something like a source 
code editor, then the line numbers (IMHO) should be independent of the 
size of window currenty in use.

For example,  if I have the following text

  1   My first line
  2 this is a very long line of text that is going to be wrapped in a 
moment when I make the window narrow.
  3 third line.

Then when the window becomes narrow, do I *want*

  1   My first line
  2  this is a very long line of text that is going to be wrapped
  3  in a moment when I make the window narrow.
  4  third line.

or do I want something like

  1   My first line
  2   this is a very long line of text that is going to be wrapped
  2a  in a moment when I make the window narrow.
  3   third line.

It really depends on whether you are numbering the lines of the window 
or the lines of the underlying text (or source code, or whatever); quite 
often, I suspect, it should be the latter. And in that case I don't know 
of any quick or easy way to figure out how the numbering should be done :-(

-- Alex.



On 25/06/2010 08:25, Justin Sloan wrote:
> I went with using a parallel field to add line numbers and it is
> working well. However, rev only counts the line numbers based on the
> delimeter. So if word warp is turned on you end up with more lines
> then there are actual line numbers.
>
> Does anyone know of a way to count all the lines, even the lines that
> are wrapped and not separated by the delimeter?
>
>   - Justin
>
>
>
> On Thu, Jun 24, 2010 at 5:44 PM, Jeff Massung<massung at gmail.com>  wrote:
>    
>> I used a parallel field in my Cryogen editor (http://massj.tumblr.com for
>> video + screenshot). Worked out perfectly, and now that I've done it that
>> way once, I actually wouldn't want to do it any other way in the future.
>>
>> Jeff M.
>>
>> On Thu, Jun 24, 2010 at 6:01 AM, Justin Sloan<justin.sloan at us.army.mil>wrote:
>>
>>      
>>> I am planning to implement line numbers in a proprietary text editor
>>> that I wrote for in-house use.  Problem is, I don't know how I am
>>> going to implement it. I thought about using a parallel text field,
>>> but there has to be an easier way.  Any of you genius devs have any
>>> ideas?
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>>        
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>      
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>    




More information about the Use-livecode mailing list