textual icon indicating copy to clipboard operation
textual copied to clipboard

Footer() not visible

Open heeplr opened this issue 2 years ago • 1 comments

It seems screen height suffers from some sort of off-by-one bug. This testcase:


from textual.app import App
from textual.widgets import Footer, Placeholder


class MainApp(App):

    async def on_mount(self) -> None:
        await self.view.dock(Placeholder())
        await self.view.dock(Footer(), edge="bottom")

if __name__ == "__main__":
    MainApp.run()

produces this output::

win

The bottom line is cut off. Without the Placeholder widget, the Footer displays correctly at the bottom line:

win2

heeplr avatar Jul 24 '22 16:07 heeplr

For what it's worth, applying the elements in reverse order works:

from textual.app import App
from textual.widgets import Footer, Placeholder


class MainApp(App):

    async def on_mount(self) -> None:
        await self.view.dock(Footer(), edge="bottom")
        await self.view.dock(Placeholder())

if __name__ == "__main__":
    MainApp.run()

You could also apply the widgets at once-- await self.view.dock(Placeholder(), Footer(), edge="top") so they can work out a fair arrangement with each other.

The way my mental model interprets this is-- when you placed the Placeholder() the 'canvas' was empty, so Placeholder naturally grows to fully encompass everything. When you then add the Footer() the top of the footer has to touch the bottom of the Placeholder, so it therefore 'scrolls' offscreen.

(my mental model could well be wrong! I'm only new to exploring this project)

doobeh avatar Aug 03 '22 20:08 doobeh

https://github.com/Textualize/textual/wiki/Sorry-we-closed-your-issue

willmcgugan avatar Oct 25 '22 09:10 willmcgugan

Did we solve your problem?

Glad we could help!

github-actions[bot] avatar Oct 25 '22 09:10 github-actions[bot]