__prompt_statusline_tput()
(
  [ "$(command -v tput)" ] || return 0
  if echo "$TERM" | grep -q '^xterm\(-\|$\)'
  then
    export TERM='xterm+sl'
  fi
  tput "$@"
)

__prompt_statusline_tsl="$(__prompt_statusline_tput tsl)"
__prompt_statusline_fsl="$(__prompt_statusline_tput fsl)"

__prompt_statusline()
{
  [ "$__prompt_statusline_tsl" ] || return 0
  printf "$1" "${__prompt_statusline_tsl}${2}${__prompt_statusline_fsl}"
}