jed-users mailing list

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

Re: JWindows->Mark and bug


=?UTF-8?Q?J=C3=B6rg?= Sommer <joerg@xxxxxxxxxxxx> wrote:
>what's the meaning of JWindow->Mark and where is it different from the
>fields of JWindow->buffer? Where is it used?

The purpose of the mark is to store the editing position of a buffer
as displayed in that window.  Multiple windows can contain the same
buffer and can have window-specific editing positions.

>I think the problem is in window.c:other_window(). The mark that was
>restored by switch_to_buffer() gets overwritten by jed_goto_mark(). The
>editing point in the buffer does never change, because down() and
>insert_char() do not change JWindow->mark, but this is restored by
>other_window().

There are two buffer-changing functions: setbuf and sw2buf.  The
sw2buf function changes to the specified buffer and attaches that
buffer to the current window.  The setbuf function only switches
buffers-- it does not change the buffer attached to the window.  After
your function ran, control passed back to jed's editing loop.  Since
you used setbuf, the cursor position was restored to the window's
value.  As a result, you did not see the cursor move, although your
function moved it.

From the code, it looks like you are trying to move a selection from
one line to another.  For that, you might want to use line marks:

    m = create_line_mark (color_number ("region"));
      .
      .
    move_user_mark (m);

The bufed function in bufed.sl provides an example of this approach.

>I've removed it from the code and I don't see any difference. So, what's
>the meaning of Window_Type.mark?

You should see a difference if you use multiple windows that contain
the same buffer.

I hope this clarifies things a bit.
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>.


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