Editing: Other methods

insert str        # insert text str here
pos = line()      # current line
pos = char()      # current char offset
c = col()         # column within line
str = selection() # get the selected text
extend_selection  # include full lines
select(x..y)      # select text by offset
                  # et cetera...
       
<< >>



Comments. Besides moving the cursor around, an editor needs to be able to determine the cursor location; insert, delete, and retrieve text; and manipulate selected text. A few examples of these operations are shown here.

Where it made sense, Ruby-like data are supported (e.g., negative indices and ranges). For example, when selecting text, it seems natural to supply a Range object.

Some of this will change. I've realized that the selection should be modeled as an object in its own right, and there should probably be a Location class as well. These are forthcoming.