diff options
author | mathieui <mathieui@mathieui.net> | 2013-08-01 20:17:12 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-08-01 20:17:12 +0200 |
commit | bb59771d9962dcd69c29b008031fd4ae9002915d (patch) | |
tree | 4ce52e3e5fc99837ecc97113de299d5e142c12cd /doc/source | |
parent | 2744234d52016ae06f4c72193c5b1faebc57ddd1 (diff) | |
download | poezio-bb59771d9962dcd69c29b008031fd4ae9002915d.tar.gz poezio-bb59771d9962dcd69c29b008031fd4ae9002915d.tar.bz2 poezio-bb59771d9962dcd69c29b008031fd4ae9002915d.tar.xz poezio-bb59771d9962dcd69c29b008031fd4ae9002915d.zip |
Fix #2049 (get the current completed argument)
A command argument can now be completed even if it isn’t the last
one in the input.
- Add a new method Input.new_completion
Almost like the old auto_completion method, except taht it takes
another argument: argument_position, which is the argument to be
completed.
- Methods using the old completion method still work
- All completion methods in poezio now use the new one if necessary
- Further details can be found in the docstring of new_completion
Diffstat (limited to 'doc/source')
-rw-r--r-- | doc/source/dev/overview.rst | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/doc/source/dev/overview.rst b/doc/source/dev/overview.rst index 452938e6..f0eef18a 100644 --- a/doc/source/dev/overview.rst +++ b/doc/source/dev/overview.rst @@ -91,24 +91,27 @@ Completions are a bit tricky, but it’s easy once you get used to it: They take an **Input** (a _windows_ class) as a parameter, named the_input everywhere in the sources. To effectively have a completion, you have to call -**the_input.auto_completion()** at the end of the function. +**the_input.auto_completion()** or **the_input.new_completion()** at the end +of the function. .. code-block:: python class Input(Win): # … - def auto_completion(completion_list, after='', quote=True): + def auto_completion(completion_list, after='', quotify=True): + # … + + def new_completion(completion_list, argument_position, after='', quotify=True): # … Set the input to iterate over _completion_list_ when the user hits tab, insert **after** after the completed item, and surround the item with double quotes or not. -There is no method to find the current argument in the input (although the -feature is planned), so you have to assume the current argument is the last, -and guess it by splitting the string an checking for end-space. +To find the current completed argument, use the **input.get_argument_position()** +method. You can then use new_completion() to select the argument to be completed. You can look for examples in the sources, all the possible cases are covered (single-argument, complex arguments with spaces, several arguments, -etc…) +etc…). |