Commit Graph
4 Commits
Author SHA1 Message Date
Zhiming Wang 4a35b8002b fix last-char-of-preprompt-on-last-column condition
See https://github.com/sindresorhus/pure/pull/142#issuecomment-120961475.
2015-07-14 17:52:33 -07:00
Zhiming Wang 57bfd997a5 move subtraction by one out of prompt_pure_string_length
prompt_pure_string_length is used for calculating the length of the
preprompt, but the preprompt doesn't contain a newline, so we shouldn't
subtract by one in prompt_pure_string_length.

What should happen instead is that when we subtract one from the length
when we calculate the number of lines the preprompt occupies.
2015-07-14 17:50:31 -07:00
Zhiming Wang 5f5c4d4856 prompt_pure_preprompt_render: rename prompt to preprompt
Preprompt and prompt are two distinct concepts in pure: the preprompt is
where the directory and git info live, whereas the prompt (`PROMPT`) is
as pure and simple as `%(?.%F{magenta}.%F{red})❯%f`.

In the `prompt_pure_preprompt_render` function though, prompt and
preprompt are used interchangeably, which makes it confusing the first
time one reads it. (The lines `[[ "${prompt_pure_last_preprompt}" !=
"${prompt}" ]]` and `prompt_pure_last_preprompt=$prompt` perfectly
illustrate the interchangeable use and the potential point of
confusion.)

Therefore, this commits corrects the problem by renaming the `prompt`
local variable to `preprompt`, and updating comments accordingly.
2015-07-13 02:11:16 -07:00
Zhiming Wang fe6f11960c rename two internal variables for readability
* `prompt_pure_git_delay_dirty_check` holds the (finish) timestamp of
  the last dirty check (if the dirty check took more than 2 seconds);
  renamed to `prompt_pure_git_last_dirty_check_timestamp`.

* Local variable `dirty_check` holds the elapsed time in seconds since
  the last dirty check (if the timestamp is set); renamed to
  `time_since_last_dirty_check`.
2015-06-13 03:45:23 -07:00