Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
PromptManager fixes #1078
Should close #1075
Code looks good, but before we close #1075, as Gokhan says, we're inserting weird space before the prompt with these other templates, I'm not sure why. I tried putting simply
but I get this output:
I haven't looked at the prompt display logic in ages, but there's something odd here...
That this means the rewrite logic is a little flawed in @takluyver's rework, and I missed that. The rewrite prompt in the old code would be the one adjusting dynamically its length to that of the others, not the other way around. So users should be able to define prompts of any length they want, and the rewrite prompt will simply be '-------.... ---->' , as long as it needs to be to match the length of the prompt above it. I went to great lengths to make this work in the presence of ansi escapes.
It seems that now the rewrite prompt has a fixed length and the others ares simply justified to match it. That's definitely not the logic we want; it's ugly and it breaks the common case of people changing their prompts and getting that weird left-space.
I'm actually OK with the rewrite prompt not being a template at all, we're simply saying 'the line above got rewritten'. The rewrite prompt instead could be a simple boolean: if True, we rewrite with '---->' as long as it needs to be, if False we don't show any rewrite. There's no need for having a template there.
Sorry that I didn't realize this slipped in when reviewing #507; I was trying to flush so much code to get to the beta that I failed to see these issues. But we have time to fix them before release...