emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Request for pointers and advice: displaying several buffers inside a


From: Ihor Radchenko
Subject: Re: Request for pointers and advice: displaying several buffers inside a single window
Date: Sat, 11 Apr 2020 16:35:58 +0800

> That's not the definition I'd use.  The gap is a way of making text
> insertion less expensive.  If you insert characters one by one, each
> insertion needs to move the characters after the insertion point,
> which is expensive.  Having the gap allows us to perform this movement
> only after relatively large amounts of text were inserted; for smaller
> insertions we just make the gap smaller.

Do you mean that the gap is specially allocated memory space associated
with buffer point where you can insert characters without a need to
shift the tail of the char array containing buffer string?

> My question was how you handle insertion in a segment?  Move the gap
> to the segment, or have a separate gap for each segment?

A segment could mean two thing as I imagine: (1) pointer to original
char array associated with current buffer. you can think about it as
about narrowed buffer for current buffer implementation; (2) a pair of
markers in different buffer. The second type of segment may refer to a
char array in different buffer (just like case (1), but the char array
from different buffer). Alternatively, it may refer to several other
segments (if other buffer contains several segments between the
markers). The last case can be reduced to a list of char arrays in
different buffers.

If we think about insertion, the point may be within a single segment or
just between two segments. If it is within a single segment, we can
identify (maybe recursively) what is the basic char array corresponding
to the point. The gap will be that gap associated with that char array.
In the other case, when the point is in between two segments, it narrows
down to point position between two char arrays. One of this arrays (and
the associated gap) will be selected depending on some criteria (maybe,
something similar to what we have for overlays/sticky text properties).

I hope that my explanation is clear enough.


Eli Zaretskii <address@hidden> writes:

>> From: Ihor Radchenko <address@hidden>
>> Cc: address@hidden, address@hidden, address@hidden,
>>  address@hidden
>> Date: Sat, 11 Apr 2020 03:34:30 +0800
>> 
>> > And what do you suggest to do with the gap?
>> 
>> This is where the buffer text is stored internally right?
>
> That's not the definition I'd use.  The gap is a way of making text
> insertion less expensive.  If you insert characters one by one, each
> insertion needs to move the characters after the insertion point,
> which is expensive.  Having the gap allows us to perform this movement
> only after relatively large amounts of text were inserted; for smaller
> insertions we just make the gap smaller.
>
>> I think a
>> "segment" may as well refer to a substring from the gap. In the simplest
>> case the list of "segments" would contain a single element referring to
>> the whole gap. Then, if one adds another "segment", the list will hold 3
>> elements: (<segment from beginning of the gap to pos> <added segment>
>> <segment referring to the remaining part of the gap>).
>
> My question was how you handle insertion in a segment?  Move the gap
> to the segment, or have a separate gap for each segment?

-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: address@hidden, address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]