autocomplete - Python readline module: Set 2 character delimiter -


I am using the readline module to auto-complete names (first name last Name).

I want to set a 2 character delimiter, but by setting readline.set_completer_delims (',') , it accepts the comma and the white space as a delimiter . But I only want combination.

The problem is, now I am entering the first name which is present multiple times, with different names. Instead of suggesting all the possible last names of completion, Readline thinks that the white space's character is a delimiter, and again starts suggesting all the names.

How can I solve this problem?


Further information: I am already using a custom completion function:

  # Configure and Enable Tab Full Def Full (Text , State): "" "Contact integer work for readline module" option = [x [2] .strip () for contacts in x if x [2] .mount (.with startwith (text.strip () Less ()) Try: Return option [state] + ',' except index error: Return any readline.set_completer (full)   

The problem is not that The function works incorrectly, I debug it and when a word was completed that ends with a white space (like "simon" ), then text "simon" instead of "" .

You probably have to use it

  readline.set_completer ([ Function])   

from Python Doctor:

"State the integer function as 0, 1, 2, ... as the function (text, state) It is said, unless it returns a non-string value. It should be returned to the next possible completion, starting with the text. "

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -