GithubHelp home page GithubHelp logo

Comments (6)

lugray avatar lugray commented on June 10, 2024

Ah, yes, that makes sense. I'd be happy to review a PR that fixes this.

from cli-ui.

ChrisBr avatar ChrisBr commented on June 10, 2024

Is there any workaround for this? e.g. can we query the allowed terminal size / characters before this breaks?

from cli-ui.

lugray avatar lugray commented on June 10, 2024

You can:

def width
winsize[1]
end

I'd still love to review a PR that fixes it properly though.

from cli-ui.

ChrisBr avatar ChrisBr commented on June 10, 2024

I'd still love to review a PR that fixes it properly though.

Yeah I would love to have this fixed, I'm just not really familiar with this library. Might give it a go though.

from cli-ui.

ChrisBr avatar ChrisBr commented on June 10, 2024

With long selects it also duplicates (triples) entries and messes the screen up completely. I suppose that's related.

image

@lugray any pointers where to look in first / what might go wrong here?

from cli-ui.

lugray avatar lugray commented on June 10, 2024

They are separate but similar bugs. In both cases, we're assuming that things are on a single line that may not be. For the original issue, after a response is chosen, we rewrite the question with the chosen response. We prepare to do this by clearing the previous line of the terminal:

cli-ui/lib/cli/ui/prompt.rb

Lines 265 to 268 in 151f207

# Clear the line
print(ANSI.previous_line + ANSI.clear_to_end_of_line)
# Force StdoutRouter to prefix
print(ANSI.previous_line + "\n")

If the question were on a single line, this would be fine. But when the question spans multiple lines, we erase only the last one.

The second bug you identified at a guess is a bug in

def calculate_option_line_lengths

I think a single choice is wrapping to a new line, but there are also more choices than space available to display them, so we're trying to track the number of lines available, and elide choices at the top/bottom of the list, but the wrapped line is disturbing our count of number of lines available.

from cli-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.