Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14746 > unrolled thread
| Started by | Jaren Stangret <sirjaren@gmail.com> |
|---|---|
| First post | 2018-10-30 10:43 -0500 |
| Last post | 2018-10-30 10:43 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: GNUbash v. 4.4.23-5 – Bash identifier location is non-correct in terminal Jaren Stangret <sirjaren@gmail.com> - 2018-10-30 10:43 -0500
| From | Jaren Stangret <sirjaren@gmail.com> |
|---|---|
| Date | 2018-10-30 10:43 -0500 |
| Subject | Re: GNUbash v. 4.4.23-5 – Bash identifier location is non-correct in terminal |
| Message-ID | <mailman.3107.1540914239.1284.bug-bash@gnu.org> |
On Mon, Oct 29, 2018 at 7:37 AM Ilkka Virta <itvirta@iki.fi> wrote:
>
> prompt_to_bol() { local pos; printf '\e[6n'; read -sdR pos;
> [[ ${pos#*;} != 1 ]] && printf '\e[30;47m%%\n\e[0m'; }
> PROMPT_COMMAND=prompt_to_bol
>
> (I stole the main parts from the answers in
> https://unix.stackexchange.com/q/88296/170373 )
Another solution I use is to emulate ZSH's behavior, which places a
'%' in reverse video if the previous command ended in a newline,
# Can return $ps1 by printing our using this function in
# PROMPT_COMMAND, or some other means.
_zsh_prompt_nl()
{
local line_pos col_pos
IFS=';[' read -s -t1 -d'R' -p $'\033[6n' _ line_pos col_pos
if (( col_pos != 1 )); then
(( LINES != line_pos ))
ps1="${reset/\[0/[7}%${reset}\n${ps1}\n"
else
ps1="${ps1}\n"
fi
}
Updating LINES and COLUMN non-interactively can be difficult,
so obtaining these values manually may be required:
IFS='[;' \
read -rsu2 -d'R' -p $'\033[s\033[9999;9999H\033[6n\033[u' \
_ LINES COLUMNS
Back to top | Article view | gnu.bash.bug
csiph-web