-
Notifications
You must be signed in to change notification settings - Fork 97
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
Fix for rad init UI issue on a small terminal #8068
Fix for rad init UI issue on a small terminal #8068
Conversation
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
pkg/cli/prompt/list/list.go
Outdated
@@ -26,9 +26,9 @@ import ( | |||
"github.com/charmbracelet/x/ansi" | |||
) | |||
|
|||
const listHeight = 14 | |||
// const listHeight = 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be deleted or are they being used to denote specific values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted these lines in my latest PR.
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Radius functional test overview
Click here to see the list of tools in the current test run
Test Status⌛ Building Radius and pushing container images for functional tests... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing, looks good apart from a minor comment.
@@ -92,7 +88,7 @@ func NewListModel(choices []string, promptMsg string) ListModel { | |||
items[i] = item(choice) | |||
} | |||
|
|||
l := list.New(items, itemHandler{}, defaultWidth, listHeight) | |||
l := list.New(items, itemHandler{}, 0, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's add a comment here about 0 values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comments
@@ -134,6 +130,7 @@ func (m ListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |||
switch msg := msg.(type) { | |||
case tea.WindowSizeMsg: | |||
m.width = msg.Width | |||
m.List.SetSize(msg.Width, msg.Height-((3*msg.Height)/4)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, let's add a comment for quick description why we are doing this since it might not be obvious from the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
@@ -134,6 +131,9 @@ func (m ListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |||
switch msg := msg.(type) { | |||
case tea.WindowSizeMsg: | |||
m.width = msg.Width | |||
// setting the width and height of the list model as terminal dimensions changes. | |||
// setting the height to 25% of the height of the terminal height. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 25% specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want to change the dimension of the list model as terminal dimensions changes, and I am setting it to 25% because i figured its close to the existing size of the list model on a full terminal window.
Radius functional test overview
Click here to see the list of tools in the current test run
Test Status⌛ Building Radius and pushing container images for functional tests... |
Description
Type of change
Fixes: #6492
Contributor checklist
Please verify that the PR meets the following requirements, where applicable: