# \[QUIZ\] Editing Text (#145)

**URL:** <https://rubytalk.org/t/quiz-editing-text-145/41963>\
**Category:** ruby-talk\
**Created:** [6 November 2007 20:39 UTC](https://rubytalk.org/t/quiz-editing-text-145/41963 "2007-11-06T20:39:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Koppel1](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@James\_Koppel1](https://rubytalk.org/u/James_Koppel1)\
**Post date:** [6 November 2007 20:39 UTC](https://rubytalk.org/t/quiz-editing-text-145/41963/1 "2007-11-06T20:39:48Z")

</div>

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
> 
> > **[Yahoo Mail - Organized Email](https://mail.yahoo.com/)**
> >
> > It's time to get stuff done with Yahoo Mail. Just add your Gmail, Outlook, AOL or Yahoo Mail to get going. We automatically organize all the things life throws at you, like receipts and attachments, so you can find what you need fast. Plus, we've got...
