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

Added capture of server console input for hotkeys #2085

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

Measurity
Copy link
Collaborator

@Measurity Measurity commented Oct 2, 2023

Hotkeys

  • Escape will clear the input line.
  • Ctrl+C will clear the input line. If no input, will terminate the server and console
  • Ctrl+D will terminate the server and console
  • Home Move cursor to start of input
  • End Move cursor to end of input
  • Up Arrow Go backward (in time) of input history
  • Down Arrow Go forward (in time) of input history

Limitations

The input line only shows up correctly when it doesn't wrap to the next line. I see this as a minor issue because you can increase width of console or paste-in large inputs.

Possible improvements

  • Using a third-party library which has (static) input field support and can show server output above it. I'm not familiar with any so recommendations are welcome.

Tasks left

  • Add input submit history (using up/down arrows to navigate it)

PR refers to #1489

@Measurity Measurity force-pushed the server-console-hotkeys branch 3 times, most recently from fc11c1f to 492993d Compare October 4, 2023 12:39
Copy link
Member

@dartasen dartasen left a comment

Choose a reason for hiding this comment

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

Some of the behaviors I find lacking when using a console :

  • Unable to use arrow to navigate between inputs
  • Unable to use enter to create an empty line

Also noticed some errors while testing the feature;

Step to reproduce : Press tab then press delete

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.Text.StringBuilder.Remove(Int32 startIndex, Int32 length)
   at NitroxServer_Subnautica.Program.<HandleConsoleInput>d__4.MoveNext() in NitroxServer-Subnautica\Program.cs:line 204

Step to reproduce : Open server in launcher wrap mode

System.IO.IOException: Invalid Descriptor
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.Console.set_TreatControlCAsInput(Boolean value)
   at NitroxServer_Subnautica.Program.<StartServer>d__3.MoveNext() in NitroxServer-Subnautica\Program.cs:line 53

NitroxServer-Subnautica/Program.cs Outdated Show resolved Hide resolved
NitroxServer-Subnautica/Program.cs Outdated Show resolved Hide resolved
@Measurity Measurity force-pushed the server-console-hotkeys branch 2 times, most recently from 5e3a7cb to 09000c1 Compare October 4, 2023 20:50
@Measurity Measurity marked this pull request as draft October 4, 2023 22:03
@Measurity Measurity marked this pull request as ready for review October 5, 2023 17:54
@Measurity Measurity force-pushed the server-console-hotkeys branch 2 times, most recently from 65a2c05 to ad89813 Compare October 6, 2023 07:53
Copy link
Member

@Jannify Jannify left a comment

Choose a reason for hiding this comment

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

LGTM CW

@Measurity Measurity merged commit e48af09 into SubnauticaNitrox:master Nov 29, 2023
@Measurity Measurity deleted the server-console-hotkeys branch November 29, 2023 21:39
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

Successfully merging this pull request may close these issues.

None yet

3 participants