Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Allways on top information #233

Open
dostoievsky opened this issue Oct 17, 2024 · 0 comments
Open

[Question] Allways on top information #233

dostoievsky opened this issue Oct 17, 2024 · 0 comments

Comments

@dostoievsky
Copy link

Hello. Do you guys think is possible to have like an allways on top line over a linenoise session?

...
void 
show_account_data()
{
	printf("\033[s");
	printf("\033[3;1H");
	printf("-----------------------------------------------------\n");
	printf("Account: name: %s - identity: %s - status: TODO\n", 
		account.name ? account.name : "N/A", 
 		account.identity ? account.identity : "N/A");
	printf("-----------------------------------------------------\n");
	printf("\033[u");
}

int main(void)
{
	char *linenoise(const char *prompt);
	char *command;
	
	linenoiseClearScreen();
	show_account_data();

	while((command = linenoise("> ")) != NULL) 
	{
		show_account_data();          
                ...
                handles all inputs/outputs while preserving account data
                ...
        }
}

This almost works, but when I enter a invalid or unmapped command, the cursor moves down to account data print, instead of returning to the original position.

I dont know if this is possible, and also intented for the lib.

maybe should I use just ncurses?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant