jed-users mailing list

[2003 Date Index] [2003 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: move a spot


Joerg Sommer <joerg@xxxxxxxxxxxx> wrote:
>What's going wrong here? Why doesn't move the spot, if I insert at the
>spot any text?

Positions defined by marks, spots, and the point (current editing
position) should never be regarded as "on" a character.  Rather they
should be regarded as being "between" characters, with the point
always to the right of a mark or spot, i.e.,

    <CHARACTER>  <MARK> <POINT> <CHARACTER>

but never

    <CHARACTER>  <POINT> <MARK> <CHARACTER>

Hence, insertion of a character in this situation will not cause the
MARK to move.

So, with this in mind, consider your example:

>      check_region(1);
>      insert_char('}');
>      exchange_point_and_mark();
>      insert("\\text"+attrib+"{");
>      pop_spot();

Suppose the buffer looks like:

   some text <POINT>region<MARK> more text

Then: 

  check_region(1) ==>

   some text <SPOT><MARK>region<POINT> more text

  insert_char('}') ==>

   some text <SPOT><MARK>region}<POINT> more text

  exchange_point_and_mark() ==>

   some text <SPOT><POINT>region}<MARK> more text
  
  insert("\\text{") ==>

   some text <SPOT>\text{<POINT>region}<MARK> more text
   
  pop_spot ();  ==>
  
   some text <POINT>\text{region}<MARK> more text
    
I hope this explains what is happening.

Thanks,
--John

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2003 date index] [2003 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]