resolves#2803
- update1: handle optional prompts correctly
- update2: split PromptFormatter._format_prompt
- update3: get number of workers from env
- update4: now it supports setting async prompt after initing the
session
- update5: keep track of futures<->token index to avoice looping over
all token items
refactor: cache thread results between calls
if there is not much update between calls, then it will not glitch
also applied code review suggestions
refactor: clean old running features
refactor: async-prompt handle clearing futures from container
refactor: add more docstrings and apply review changes
docs: add doc hook
refactor: change %s to string concat
docs: update title in formatter api doc
feat: style cached result as faded
refactor: update shell functions after osc_ascii PR merged
refactor: split code into updator.py to handle async updates
This commit adds a new color token "RESET", and makes "NO_COLOR" a
normal color. This means that you could make some text bold while
keeping the default color using `{BOLD_NO_COLOR}`, but it also means
that the current code relying on "NO_COLOR" resetting all attributes
will break.
This commit *does not* fix the current issue (maybe not reported?) that
the prompt toolkit backend doesn't behave the same as the readline
backend:
```python
import xonsh.tools
xonsh.tools.print_color("{BOLD_GREEN}green {RED}red")
```