justjanne / powerline-go

A beautiful and useful low-latency prompt for your shell, written in go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prompt does not shrink when -max-width is specfied

fenprace opened this issue · comments

Describe the bug
Prompt does not shrink for a given -max-width value.

To Reproduce
Steps to reproduce the behavior:

  1. powerline-go -max-width 50

截屏2021-01-22 23 37 01

Expected behavior
Expect 1 or 2 segments are hidden and the printed out prompt takes no more than 50% of the width of the window.

Environment

  • OS: macOS 11.1
  • Architecture: x86_64
  • Shell: fish 3.1.2

Additional context
My prompt settings are as following. But the -max-width does not work in prompt either.

function fish_prompt
  powerline-go -error $status -modules cwd,git,root -cwd-mode dironly -max-width 50
end

I can confirm this same behavior with powerline-go 1.20.0 on Fedora 33, with Bash as the shell.

The issue seems to be from PR #251, which mistakenly assumes that the flag max-width is instead max-width-percentage.

I have the fix working locally, and I'm about to open up a pull request fixing this! (Which will be linked below)