Conversation
d126ed6 to
ac5f3c8
Compare
a1baab6 to
f9002eb
Compare
f9002eb to
c8898b0
Compare
chrisbra
left a comment
There was a problem hiding this comment.
I have only looked at the provided API, but I think this can be improved.
|
|
||
| If "max" is not provided, then the entire history is returned. | ||
| The first item in the list is always the current text (text | ||
| that has not been entered yet by the user). Use a "max" value |
There was a problem hiding this comment.
| that has not been entered yet by the user). Use a "max" value | |
| If "max" is not provided, then the entire history is returned. The list order is always from the most recent entry to the oldest, with the very first item in the list being the current text on the prompt line (which may be an empty string if nothing has been typed). |
|
|
||
| Return type: |String| | ||
|
|
||
| prompt_gethistory({buf} [, {max}]) *prompt_gethistory()* |
There was a problem hiding this comment.
This is different from e.g. histget(). Is this inconsistency okay?
| none set prompt history | ||
| prompt_sethistsize({buf}, {max}) | ||
| Number set maximum number of items in prompt | ||
| history |
There was a problem hiding this comment.
I am looking at the existing history functions: histget(), histadd(), histdel() and histnr(). I think we should use a naming, prompt_hist<action>
| moving through the prompt history. | ||
|
|
||
| In both cases, the values will be clamped between the maximum | ||
| and minimum possible offsets or indexes. |
There was a problem hiding this comment.
clamped is a bit unusual in the help files, how about this:
In both cases, the value is limited to the available range:
If the index or offset would move the position beyond the oldest
entry or past the current text, it will stay at the first or
last entry respectively. No error is given.
| {only available when compiled with the |+channel| feature} | ||
|
|
||
| prompt_histsearch({buf}, {offset} [, {text}]) *prompt_histsearch()* | ||
| Search for a specific entry in the prompt history and set the |
There was a problem hiding this comment.
| Search for a specific entry in the prompt history and set the | |
| Search for a specific entry {text} in the prompt history and set the |
| world! | ||
| inprogress| <current position> | ||
| < To go to "hello" is history, do >vim | ||
| call prompt_histsearch(bufnr(), 2, "he") |
There was a problem hiding this comment.
This is a bit strange. The function is called search, why do we need to provide an offset?
|
|
||
| prompt_histsearch({buf}, {offset} [, {text}]) *prompt_histsearch()* | ||
| Search for a specific entry in the prompt history and set the | ||
| current text. {buf} can be a buffer name or number. See |
There was a problem hiding this comment.
should this not just return a list of history entries or the indexes? Why set the text? That is what the goto function is for, no?
|
|
||
| prompt_sethistsize({buf}, {max}) *prompt_sethistsize()* | ||
| Set the maximum prompt history size of {buf} to "max". {buf} | ||
| can be a buffer name or number. See |prompt-buffer|. |
| GetBuffer()->prompt_setinterrupt(callback) | ||
| < | ||
| Return type: |Number| | ||
|
|
Yes. I would also like feedback from @puremourning if they are available |
|
I checked it quickly. Need to think about it practically. Might take me a little while. |
Fixes #5010. Adds history to the prompt buffer, like a command line shell. Will add tests later
@puremourning what are your thoughts on this? Thanks.