nano-devel
[Top][All Lists]
Advanced

[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: Mon, 17 Oct 2016 20:12:07 +0200

Hello Sumedh,

On Mon, Oct 17, 2016, at 15:59, Sumedh Pendurkar wrote:
> Made it look similar to emacs.

Very nice!  Good work.

> Please go through the patch and suggest changes if any.

I don't think you need an array of words -- you can just
search for the first possible completion when the user
types ^], and search for the next when the user types ^]
again.  No need to store all these words.  You just need
to remember the location of the last compleation.  And
when you reach end-of-file, there are no further matches
and you start afresh.  This removes the arbitrary limit
of WORD_MAX.

I don't like it that auto_complete_void() reads the input
stream.  Better use a global variable to store the state.
Somewhere in do_input(), after 'if (have_shortcut) {', do:

    if (s->scfunc != complete_a_word)
        new_completion = TRUE;

(Yes, rename auto_complete_void() to complete_a_word().)
So every ^] keystroke enters /and/ exits from this function.

Benno

-- 
http://www.fastmail.com - A fast, anti-spam email service.




reply via email to

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