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

Keep dependencies in the box in ConsoleUI #3459

Merged
merged 1 commit into from
Oct 17, 2021

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Oct 9, 2021

Problem

Unhandled Exception:
System.ArgumentOutOfRangeException: Value must be positive and below the buffer height.
Parameter name: top
  at System.TermInfoDriver.SetCursorPosition (System.Int32 left, System.Int32 top) [0x0003e] in <533173d24dae460899d2b10975534bb0>:0 
  at System.ConsoleDriver.SetCursorPosition (System.Int32 left, System.Int32 top) [0x00000] in <533173d24dae460899d2b10975534bb0>:0 
  at System.Console.SetCursorPosition (System.Int32 left, System.Int32 top) [0x00000] in <533173d24dae460899d2b10975534bb0>:0 
  at CKAN.ConsoleUI.Toolkit.ConsoleTextBox.Draw (CKAN.ConsoleUI.Toolkit.ConsoleTheme theme, System.Boolean focused) [0x000c2] in <3ad907c2f8a0408085d33038b3a73567>:0 
  at CKAN.ConsoleUI.Toolkit.ScreenContainer.Draw (CKAN.ConsoleUI.Toolkit.ConsoleTheme theme) [0x00034] in <3ad907c2f8a0408085d33038b3a73567>:0 
  at CKAN.ConsoleUI.Toolkit.ScreenContainer.Interact (CKAN.ConsoleUI.Toolkit.ConsoleTheme theme) [0x00012] in <3ad907c2f8a0408085d33038b3a73567>:0 
  at CKAN.ConsoleUI.Toolkit.ScreenContainer.Run (CKAN.ConsoleUI.Toolkit.ConsoleTheme theme, System.Action`1[T] process) [0x0002d] in <3ad907c2f8a0408085d33038b3a73567>:0 
  at CKAN.ConsoleUI.Toolkit.ConsoleScreen.LaunchSubScreen (CKAN.ConsoleUI.Toolkit.ConsoleTheme theme, CKAN.ConsoleUI.Toolkit.ConsoleScreen cs, System.Action`1[T] newProc) [0x00001] in <3ad907c2f8a0408085d33038b3a73567>:0 
  at CKAN.ConsoleUI.ModListScreen.<.ctor>b__0_16 (System.Object sender, CKAN.ConsoleUI.Toolkit.ConsoleTheme theme) [0x00038] in <3ad907c2f8a0408085d33038b3a73567>:0 
  at CKAN.ConsoleUI.Toolkit.ScreenContainer.Interact (CKAN.ConsoleUI.Toolkit.ConsoleTheme theme) [0x000a2] in <3ad907c2f8a0408085d33038b3a73567>:0 
  at CKAN.ConsoleUI.Toolkit.ScreenContainer.Run (CKAN.ConsoleUI.Toolkit.ConsoleTheme theme, System.Action`1[T] process) [0x0002d] in <3ad907c2f8a0408085d33038b3a73567>:0 

image

Cause

The mod info screen only has room for a total of 9 dependencies and conflicts, and it assumes there will be fewer than that many. If there are more, they will overflow the dependencies box. If there are a lot more, they can overflow the screen and crash.

I think I couldn't conceive of a mod having more than 9 dependencies+conflicts when I wrote this. Now we have crazy mods like the RP1 express stuff with way more.

Changes

  • Formatting.ConvertCoord now coerces all coordinates to appear on-screen, so if we have other layout problems in the future, they won't cause a crash
  • ModInfoscreen.addDependencies now allocates its 9 lines of text proportionally between dependencies and conflicts, and limits the size of the text boxes to fit within that range. If this isn't enough room, the text boxes will display scrollbars. The user is not able to scroll the box because we already use the scroll bindings for the description box, but hopefully they won't care.

image

@HebaruSan HebaruSan added Bug Something is not working as intended Pull request ConsoleUI Issues affecting the interactive console UI labels Oct 9, 2021
@HebaruSan HebaruSan requested a review from DasSkelett October 9, 2021 18:23
Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@HebaruSan HebaruSan merged commit abeda34 into KSP-CKAN:master Oct 17, 2021
@HebaruSan HebaruSan deleted the fix/consoleui-dep-overflow branch October 17, 2021 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended ConsoleUI Issues affecting the interactive console UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants