Re: [dev] [edit] Introducing edit, a simple text editor

From: Quentin Rameau <quinq_AT_fifth.space>
Date: Mon, 23 Oct 2023 16:23:33 +0200

Hi Arthur,

> I understand that some people may miss the undo feature, as it's so
> common in others tools. I've given it a lot of thought when designing
> edit. As you pointed out, undo-ing is tightly linked to the data
> structures, so leaving it aside had major implications on the
> developement.
>
> Undo-ing is clearly a non-trivial feature. Most operations are not
> injective, meaning one cannot deduce the previous content only from
> the new, modified content. Thus implementing undo-ing recquires
> storing and managing more content. How much complexity it adds very
> much depends on the data structures.
>
> vis[0] (after a quick inspection) seems to have found a good balance
> between simplicity and compatibility with features such as undo-ing.
> I felt that going the undo path would result in a cheap and
> non-innovative vis imitation.
>
> Besides, I found out I was saving so frequently in vim that undo-ing
> was most of the time equivalent to reloading. Going without undo-ing
> was not a real issue for me.
>
> So I took edit as an opportunity to explore how much complexity can be
> stripped off by not implementing the undo feature. There are very few
> defined structures. Content is simply stored line by line in a doubly
> linked list, as UTF-8 strings:
>
> typedef struct Line { // doubly linked list of lines
> struct Line *prev, *next;
> int line_nb; // between 1 and nb_lines
> int ml, dl; // length in memory, on screen
> char *chars; // content (UTF-8, NULL-ended
> string)
> } Line;
>
> So that's for the the explanation, but to be honest your mail
> triggered me to think of undo-ing again. As I don't intend to change
> the central data structures, undo-ing won't be as good as in vis, but
> I have a few ideas... I'll come back to you if I have some news.

Well, I really get the idea and the opportunity to have an editor
without editing history, and that could actually be a good way to train
for it too.

I was rather looking for confirmation,
that wasn't really a feature-request.

I think that my most recurrent use-case of undoing is for testing
text replacement, sometimes getting the correct RegEx need a couple
tries for complex ones.

But again, those problem can also be solved with some discipline
and I wouldn't want to trigger a corruption of the current model
if you like how it is already!

Thanks for your consideration though, cheers!
>
>
>
>
>
Received on Mon Oct 23 2023 - 16:23:33 CEST

This archive was generated by hypermail 2.3.0 : Mon Oct 23 2023 - 16:24:08 CEST