# Re: Editing Text (#145)

**URL:** <https://www.ruby-forum.com/t/re-editing-text-145/119420>\
**Category:** Ruby\
**Created:** [November 6, 2007, 9:40pm UTC](https://www.ruby-forum.com/t/re-editing-text-145/119420 "2007-11-06T21:40:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jameskelly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3ab097/32.png) [@jameskelly](https://www.ruby-forum.com/u/jameskelly)\
**Post date:** [November 6, 2007, 9:40pm UTC](https://www.ruby-forum.com/t/re-editing-text-145/119420/1 "2007-11-06T21:40:43Z")

</div>

Eric M. 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.)
