-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend and tweak documention in select.rs and theme.rs. #177
base: master
Are you sure you want to change the base?
Conversation
In addition, consistently speak of a 'selection prompt'.
The comment on max_length was simply outdated.
I am actually unsure. I was confused by this earlier this week too. You have my blessing to refactor it to your heart's content. I was planning to do that before 0.11.0 anyway (after around 2 months). |
Thanks for the trust ❤️ |
I found some time to look into this today and just pushed a couple more commits with further doc improvements. Let me know if I you prefer me to squash some commits (such as all those just changing indicative to imperative tense). |
I think I figured out what If prompts_reset_height is true,
If prompts_reset_height is false, The password prompt uses @psunkara Does that sound plausible to you? |
I'm not sure about the grammar or format of the comments, but open to changing it.
The comment of default() was misleading: if a default value is set, the user can still change the selected answer. They merely have the *additional* option of confirming the default choice.
Looking into the password prompt closely, I don't see how
|
Setting it to false doesn't make a difference in practice. The distinction between self.height and self.prompt_height only matters when calling TermThemeRenderer::clear_preserve_prompt(): that method preserves prompts and only clears input below the most recent prompt. However, the password prompt only calls TermThemeRenderer::clear(), which treats height and prompt_height in the same way. The function set_prompts_reset_height is now unused, hence is removed.
Setting The distinction between self.height and self.prompt_height only matters when calling |
@mitsuhiko You introduced prompts_reset_height in 489a065. Do you remember why you specifically set this to false for password prompts? I don't see a reason right now, but maybe I'm just overlooking something. In case that reason doesn't exist anymore, I just pushed two commits removing prompts_reset_height (always setting it to true). I also pushed a commit documenting the meaning of height and prompt_height: with prompts_reset_height removed, that is crystal clear. I purposefully did not include docstrings for clear() and clear_preserve_prompt to avoid conflicts with in-flight PRs #190 and #191. These fix some pre-existing bugs in those methods and document the correct behaviour. |
Sorry for all the PRs right now. I'm done for the moment - take as much time pondering this as you need or prefer! |
I do not remember sadly. |
Trying to understand the selection prompt and theme rendering a bit better, I touched up the docs a bit to make them easier to follow for me. Hence, this PR is a mixture of various small changes --- feel free to accept or decline as you wish.
I'm not sure about all of the members of TermThemeRenderer, especially
prompt_preserve_height
. Related to that, I don't understand the distinction ofclear
in contrast toclear_preserve_prompt
yet. @pksunkara Can you help me with that? Even a pointer to whereprompt_preserve_height
is actually used would help.