Skip to content

rprompt at top of multiline prompt not working since 3.0.6 #1241

@sevens

Description

@sevens

Hi, I've been using Xonsh with a prompt-toolkit prompt for quite some time. I have a multi-line prompt with an rprompt showing an exit-status indicator 'above' the multi-line prompt (technically it's in the prompt but the first line of the prompt is an empty line, both for visual separation and for the rprompt indicator). Since prompt-toolkit 3.0.6 however, this is no longer working as before: the rprompt is now shown at the bottom and my attempts at fixing this haven't succeeded.

A simplified example of my current setup (in Xonsh) which works as expected in 3.0.5 and before:

$PROMPT = '\n' + '-' * int($(tput cols)) + '\n\n>>> '
$RIGHT_PROMPT = 'exit_status_indicator'

This shows the exit status indicator of the previous command above the visible part of the prompt:

                                                      exit_status_indicator
---------------------------------------------------------------------------
                                                                           
>>> 

It worked fine in 3.0.5 and earlier (including ptk 2.x). In 3.0.6 this isn't working anymore, probably due to 07e3429

I've tried 'inverting' my rprompt by suffixing it with newlines to shift it back up to above the dashed separator line but that doesn't seem to work (as it crosses a line that has content at the right-side of the screen as well?). I.e. suffixing it with 3 newlines:

$RIGHT_PROMPT = 'exit_status_indicator\n\n\n'

Tested this (both my original prompt and work-around) in ptk 3.0.6 and 3.0.7, not working in either.

Version info:

  • Python 3.8.3
  • Xonsh: tested with 0.9.13, 0.9.18
  • Prompt toolkit: tested with 2.0.10, 3.0.5, 3.0.6, 3.0.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions