[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: [QUIZ] Editing Text (#145

James Koppel

11/6/2007 8:40:00 PM

Eric Mahurin wrote
>>The cursor should be thought to lie between two characters rather
than on a character. Because of this, inserting before and after is the
same. The cursor is >>represented by the node containing the line that the
cursor is on, and the index of the character to the right of the
cursor.
>
>Actually, they are different. Both insert the character at the same
>point in the text. The difference is the final position of the
>cursor/caret. insert_after is not a normal editor operation though.
>It is equivalent to typing right-to-left instead of left-to-right
>(what insert_before does). Since insert_after isn't a common
>operation, and it can be done using insert_before followed by left, it
>isn't needed. The main reason I threw it in was symmetry.


Actually, I wouldn't call it different. I prefer just to call "inserting a character" adding a character at the position of the cursor. If you want the cursor to end up at the right, I'd call that a second operation.

(One could probably have an argument all day over whether the One True Name for this is "insert_before" or "insert followed by cursor_right" with no movement toward consensus.)


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail...