Replies: 9 comments 6 replies
-
I'm thinking that type BufferObserver interface {
// Would invoke Text.inserted.
Inserted(p0 int, s []rune)
// Would invoke Text.deleted.
Deleted(p0, p1 int)
} To move all of this code into a separate module, the |
Beta Was this translation helpful? Give feedback.
-
Do you have any ideas for what should be done with Elog when migrating File to it's own package? |
Beta Was this translation helpful? Give feedback.
-
Is it worth thinking of multiple insertions and deletions? Multiple
observations will likely lead to multiple redraws which would (um, do?)
suck.
Paul
…On Thu, Jun 10, 2021, 10:03 AM Robert Kroeger ***@***.***> wrote:
I'm thinking that BufferObserver would look like this:
type BufferObserver interface {
// Would invoke Text.inserted.
Inserted(p0 int, s []rune)
// Would invoke Text.deleted.
Deleted(p0, p1 int)
}
To move all of this code into a separate module, the File.AllText would
operate over BufferObserver implementations. The functions passed into
File.AllText would need to do a cast of the BufferObserver to a *Text.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#334 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJ6RUF6GLUQERPEBYVGRPLTSDV6FANCNFSM46O3ABQQ>
.
|
Beta Was this translation helpful? Give feedback.
-
That was an excellent nudge.
…On Mon, Jun 14, 2021, 7:45 PM camsn0w ***@***.***> wrote:
I'll have to keep that in mind going forward. Paul, if you'd like to see
how it's going I have a new pull request up by the way.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#334 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJ6RUCPQI23YJVPCDDD273TS25FDANCNFSM46O3ABQQ>
.
|
Beta Was this translation helpful? Give feedback.
-
For things like warn, and warnerror and elog, should separate them from the package in order to use them in file? |
Beta Was this translation helpful? Give feedback.
-
If a mutation is a single change of the buffer then this is likely to
perform poorly for large search-and-replace operations. But I'm fine
dealing with that if and when that day comes.
Paul
…On Fri, Jun 18, 2021 at 3:17 PM Robert Kroeger ***@***.***> wrote:
I'd like to keep the observing interface fine-grain with an invocation per
mutation. Instead, what's suppose to happen is that
- all of the observing Text instances receive each mutation change
- if the change is inside the viewport, invoke Frame to update. Frame
writes the necessary commands to the Display buffer
- once per user interaction, we call display.Flush() to push the ops
to the screen.
This can be improved. There are bugs with this: I've noticed that Edwood
sometimes leaves itself un-redrawn under certain circumstances.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#334 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJ6RUF5Y7VT6PREZO2PUNLTTPAWFANCNFSM46O3ABQQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Just a bit of an update and explanation on my current class implementation; |
Beta Was this translation helpful? Give feedback.
-
Additional thoughts:
I think (albeit needs more research) that |
Beta Was this translation helpful? Give feedback.
-
Newtype buffers are now the default. Time to take advantage of them. General order:
|
Beta Was this translation helpful? Give feedback.
-
Some discussion about the approach for fixing #97. (@camsn0w: this is a follow up from our chat yesterday.)
Currently Edwood uses
File
to store an editable text buffer with undo and has-a (completely internal)RuneArray
. Per @mibk's suggestion in #97, the undo package would seem reasonable. (Though it may require some modifications)I'll call undo
undo.Buffer
to (maybe) be clearer.File
combines:File
)Text
observer functionality (i.e. eachText
instances observe theFile
that it displays) for broadcasting changes to aFile
to all of the interested (currentlyText
) instancesundo.Buffer combines:
but (obviously) no
Text
observer functionality.So: at a high-level, getting Edwood to use
buffer.Undo
entails splittingFile
apart into:File
until it can be replaced withundo.Buffer
Text
observer functionality. Maybe call thisObservableEditableBuffer
(anticipatingundo.Buffer
)ObservableEditableBuffer
would apply edits / undos to its has-aFile
orundo.Buffer
and notify the implementations of the (new)BufferObserver
interface of these edits.Text
already largely implements the forthcomingBufferObserver
so it's mostly a matter of creating the interface .Once this is split up like this, we can replace the buffer mutation and Undo functionality with
undo.Buffer
.Beta Was this translation helpful? Give feedback.
All reactions