Code Monkey home page Code Monkey logo

Comments (1)

jtdaugherty avatar jtdaugherty commented on July 30, 2024

Thanks for writing this up.

The reason this isn't already the way things are implemented is because it's not as straightforward as one might like. The reason is because the space taken up by a widget (even if it declares Fixed) is not static but depends on the box in which it is rendered. Fixed doesn't exactly mean "the same size every time" or "a fixed size", but rather "not greedy."

For example, a text string that needs to be wrapped has a definite size and won't greedily consume the whole window the way a list might, but it can't say with certainty how big it will be in the future once rendered, because that depends on how much space you give it, and that depends on the layout conditions that exist at rendering time, and those conditions depend on other rendering operations that cannot be statically determined. If you give it enough width, it might be one row high, but it might wrap to two or more rows if not given enough columns. So if it reported a size, anything that used that size to make decisions would get the wrong answer under certain layout conditions.

It allows UI elements to degenerate in an orderly fashion when not given enough space. Currently the highest level boxRenderer just crops the resulting table. It would be more sensible if it instead rendered the sub-widgets with less space than requested.

On this note, I suspect this is going to result in behaviors that are very difficult to predict. For example, would you prefer a dialog box to get cropped, or would you prefer only its buttons to disappear? Which one would be easier to detect visually when you resize the terminal? Cropping at the top level (as a consequence of greed policies, mind you) may seem messy, but I think that makes it more obvious that you just made your terminal too small.

from brick.

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.