jesseduffield / jesseduffield/lazygit
Support ANSI rewrite sequences
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
**Is your feature request related to a problem? Please describe.**
We have a git hook that displays some progress on a long running task, it does this progress message using ANSI escape codes to rewrite the previous line. When running this hook via LazyGit during a push the line escape codes are written literally so they do not function as expected.
**Describe the solution you'd like**
Ideally, the output capturing for hooks would handle all valid ANSI escapes.
**Additional context**
Example:
```sh
# .git/hooks/pre-push
# Print 1 line then re-write it using ANSI escape codes
>&2 echo -e "Line one (should not be visible)"
>&2 echo -e "\033[1A\033[KLine two"
if [ -t 0 ]; then
>&2 echo " --> Attached to a terminal"
else
>&2 echo " --> Not attached to a terminal"
fi
>&2 echo "If you see 'Line two' then things are working as expected"
exit 1
```

Contributor guide
Assessment
This issue has not been assessed yet.