Question: Place element on last line of terminal #897
Unanswered
Feuermurmel
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
You can achieve this by using import {Box, Text, useWindowSize} from "ink";
function App() {
const {rows} = useWindowSize();
return (
<Box height={rows} flexDirection="column" justifyContent="flex-end">
<Text>This will be at the bottom of the terminal</Text>
</Box>
);
}You can also combine this with import {Box, Text, useWindowSize} from "ink";
function App() {
const {rows} = useWindowSize();
return (
<Box height={rows} flexDirection="column">
<Text>Content at top</Text>
<Box flexGrow={1} />
<Text>Prompt at bottom</Text>
</Box>
);
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to place output on the last line of the terminal, when the complete output of the application is shorter than the terminal height (e.g. just a few lines)?
My use case
I'm trying to create an application that uses an interface similar to GNU Readline-based applications
example.sh:IMHO, an important aspect of Readline's UI is that it will use the last line of the terminal, when there's enough input already before it:
I think this is important because users that regularly use Readline-based applications (like
Bashor most other shells) will probably expect a prompt to be displayed on the last line of their terminal, while an output line that is followed by an empty line means the application is currently busy and not waiting for input. Example:Another use-case would be to print something related to the input below the input line, e.g. what
zshdoes when the user uses the tab key to show completions:Beta Was this translation helpful? Give feedback.
All reactions