Skip to content

Prompt spacing weird #1104

Closed
rkern opened this Issue Dec 5, 2011 · 3 comments

2 participants

@rkern
rkern commented Dec 5, 2011

Running off of master using takluyver's recent modifications to the prompt templating. I have a fairly customized multiline prompt based off of one of the configuration examples from the 0.9(?) era:

[~]
|1> 10
        10

[~]
|2> cd scratch
/Users/rkern/scratch

[~/scratch]
|3> 10
                10

[~/scratch]
|4> cd ..
/Users/rkern

        [~]
|5> 10
                10

In the current scheme, I have these settings:

c.PromptManager.in_template = r'{color.Blue}[{color.Cyan}\Y1{color.Blue}]\n{color.LightGreen}|\#> '
c.PromptManager.in2_template = '.\D> '
c.PromptManager.out_template = ''

All lines should be flush with the left side of the screen.

@takluyver takluyver was assigned Dec 5, 2011
@takluyver
IPython member

The steadily increasing spacing is a bug, but the default is not to have all lines flush with the left side of the screen. If you do want that behaviour, you need to set c.PromptManager.justify = False. Otherwise, it tries to line the start of each line up with the line before.

I'll look into the increasing spacing.

@rkern
rkern commented Dec 5, 2011

It looks like part of the problem is that you are just counting characters, not taking into account newlines and maybe not the color control characters (I haven't looked too closely).

@takluyver
IPython member

Colour control characters are taken into account, but the newlines aren't. Well spotted, it should be an easy fix.

@takluyver takluyver closed this in 82193fb Dec 8, 2011
@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
@takluyver takluyver Fix for prompts containing newlines.
Closes gh-1104
5067844
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.