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

Unable to add left padding to singleLineMenu? #246

Open
MisterSirCode opened this issue Jun 22, 2024 · 1 comment
Open

Unable to add left padding to singleLineMenu? #246

MisterSirCode opened this issue Jun 22, 2024 · 1 comment

Comments

@MisterSirCode
Copy link

MisterSirCode commented Jun 22, 2024

I noticed in the documentation, the multiline menu had a left padding option, but the single line menu does not.

Ive tried adding characters before it, but it doesnt move it at all..

I need to position this menu within a specific location, and its completely impossible as far as I can tell.

Adding space to the first item in the list does give me padding, but it obviously messes up the background color formatting :/

This is what Im stuck with right now:

image

It completely ruins the look of my project, so I was hoping there would be a fix for this or an alternative solution if someone knows one?

@GothMetalhead
Copy link

GothMetalhead commented Jul 28, 2024

How did you add padding with space, i wanna see it
Can you test :

...
const items = [ 'File' , 'Edit' , 'View' , 'History' , 'Bookmarks' , 'Tools' , 'Help' ] ;
var pad = ' '.repeat(10) // ten spaces 
items[0] = pad + items[0]; // adding padding to first item
...
term.singleLineMenu(items, options, function (error, response) {
let selectedText = response.selectedText.trimStart(); // clears padding with trimming
if (response.selectedIndex !== 0) { // if its not first item then dont trim
selectedText = response.selectedText;
}
...

It work on me succesfully

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

2 participants