[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] adding a word-completion feature to nano
From: |
Benno Schulenberg |
Subject: |
Re: [Nano-devel] adding a word-completion feature to nano |
Date: |
Wed, 26 Oct 2016 11:46:50 +0200 |
On Tue, Oct 25, 2016, at 22:29, Sumedh Pendurkar wrote:
> Some important modifications to code:
> 1) added pop_undo(undo_type) function. This functions the top element of
> undo stack and also makes current_undo point to what undotop is pointing
Okay. But you have to check that u != NULL. In other words:
return immediately when u == NULL. Unless you are sure that
this can never happen.
But... wouldn't it be enough to instead simply do?:
if (openfile->current_undo != NULL) {
discard_until(openfile->current_undo->next, openfile);
openfile->current_undo = openfile->undotop;
}
> 2) added a dummy struct undo so that we have the desired effect. Example
> file just contains "for" user types "f" and then ^] . so it would now be
> "for for" in the file as well as in strdata of the undotop.
Wouldn't it be much simpler to just set last_action = OTHER
whenever ^] is typed? (Which the above suggested popping
of the top item already does.)
> Therefore doing a single undo would remove everything which I think is
> not desirable.
Correct.
> 3) added a linked list of words. Words vanish from memory once a fresh
> attempt is made.
Okay.
By the way, please use a blank line between blocks of code.
Also, better not use "current" as the name of the pointer in
the list of completion words. And your inserting a new word
into this list contains some duplicated code; it can be written
shorter; and it is inserted into the middle of something else
(see the preceding comment -- keep related lines together).
Benno
--
http://www.fastmail.com - Does exactly what it says on the tin
- Re: [Nano-devel] adding a word-completion feature to nano, (continued)
- Re: [Nano-devel] adding a word-completion feature to nano, Benno Schulenberg, 2016/10/17
- Re: [Nano-devel] adding a word-completion feature to nano, Sumedh Pendurkar, 2016/10/17
- Re: [Nano-devel] adding a word-completion feature to nano, Benno Schulenberg, 2016/10/18
- Re: [Nano-devel] adding a word-completion feature to nano, Sumedh Pendurkar, 2016/10/18
- Re: [Nano-devel] adding a word-completion feature to nano, Benno Schulenberg, 2016/10/19
- Re: [Nano-devel] adding a word-completion feature to nano, Sumedh Pendurkar, 2016/10/19
- Re: [Nano-devel] adding a word-completion feature to nano, Benno Schulenberg, 2016/10/19
- Re: [Nano-devel] adding a word-completion feature to nano, Sumedh Pendurkar, 2016/10/24
- Re: [Nano-devel] adding a word-completion feature to nano, Benno Schulenberg, 2016/10/24
- Re: [Nano-devel] adding a word-completion feature to nano, Sumedh Pendurkar, 2016/10/25
- Re: [Nano-devel] adding a word-completion feature to nano,
Benno Schulenberg <=
- Re: [Nano-devel] adding a word-completion feature to nano, Sumedh Pendurkar, 2016/10/26
- Re: [Nano-devel] adding a word-completion feature to nano, Benno Schulenberg, 2016/10/27
- Re: [Nano-devel] adding a word-completion feature to nano, Sumedh Pendurkar, 2016/10/27
- Re: [Nano-devel] adding a word-completion feature to nano, Benno Schulenberg, 2016/10/28
- Re: [Nano-devel] adding a word-completion feature to nano, Sumedh Pendurkar, 2016/10/28
- Re: [Nano-devel] adding a word-completion feature to nano, Benno Schulenberg, 2016/10/28
- Re: [Nano-devel] adding a word-completion feature to nano, Sumedh Pendurkar, 2016/10/28
- Re: [Nano-devel] adding a word-completion feature to nano, Benno Schulenberg, 2016/10/29
- Re: [Nano-devel] adding a word-completion feature to nano, Sumedh Pendurkar, 2016/10/30
- Re: [Nano-devel] adding a word-completion feature to nano, Benno Schulenberg, 2016/10/30