Skip to content

Commit

Permalink
imp - Improved infoboxes for editors/viewers
Browse files Browse the repository at this point in the history
---

The infoboxes now use their titles in all editors and viewers.

---

Type: imp
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Jan 7, 2025
1 parent 613ed08 commit 1268b78
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
8 changes: 2 additions & 6 deletions public/Terminaux/Inputs/Styles/Editor/HexEditInteractive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private static void RenderKeybindingsBox(InteractiveTuiSettings settings)

// User needs an infobox that shows all available keys
string bindingsHelp = KeybindingTools.RenderKeybindingHelpText(bindings);
InfoBoxModalColor.WriteInfoBoxModalColorBack(bindingsHelp, settings.BoxForegroundColor, settings.BoxBackgroundColor);
InfoBoxModalColor.WriteInfoBoxModalColorBack("Available keybindings", bindingsHelp, settings.BoxForegroundColor, settings.BoxBackgroundColor);
}

private static void MoveBackward()
Expand Down Expand Up @@ -507,11 +507,7 @@ private static void NumInfo(byte[] bytes, InteractiveTuiSettings settings)
string byteNumBinary = Convert.ToString(byteNum, 2);

// Print the number information
string header = "Number information:";
int maxLength = header.Length > ConsoleWrapper.WindowWidth - 4 ? ConsoleWrapper.WindowWidth - 4 : header.Length;
InfoBoxModalColor.WriteInfoBoxModalColorBack(
header + CharManager.NewLine +
new string('=', maxLength) + CharManager.NewLine + CharManager.NewLine +
InfoBoxModalColor.WriteInfoBoxModalColorBack("Number information",
$"Hexadecimal: {byteNumHex}" + CharManager.NewLine +
$"Octal: {byteNumOctal}" + CharManager.NewLine +
$"Number: {byteNumNumber}" + CharManager.NewLine +
Expand Down
8 changes: 2 additions & 6 deletions public/Terminaux/Inputs/Styles/Editor/HexViewInteractive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private static byte[] RenderKeybindingsBox(byte[] bytes, InteractiveTuiSettings

// User needs an infobox that shows all available keys
string bindingsHelp = KeybindingTools.RenderKeybindingHelpText(bindings);
InfoBoxModalColor.WriteInfoBoxModalColorBack(bindingsHelp, settings.BoxForegroundColor, settings.BoxBackgroundColor);
InfoBoxModalColor.WriteInfoBoxModalColorBack("Available keybindings", bindingsHelp, settings.BoxForegroundColor, settings.BoxBackgroundColor);
return bytes;
}

Expand Down Expand Up @@ -416,11 +416,7 @@ private static byte[] NumInfo(byte[] bytes, InteractiveTuiSettings settings)
string byteNumBinary = Convert.ToString(byteNum, 2);

// Print the number information
string header = "Number information:";
int maxLength = header.Length > ConsoleWrapper.WindowWidth - 4 ? ConsoleWrapper.WindowWidth - 4 : header.Length;
InfoBoxModalColor.WriteInfoBoxModalColorBack(
header + CharManager.NewLine +
new string('=', maxLength) + CharManager.NewLine + CharManager.NewLine +
InfoBoxModalColor.WriteInfoBoxModalColorBack("Number information",
$"Hexadecimal: {byteNumHex}" + CharManager.NewLine +
$"Octal: {byteNumOctal}" + CharManager.NewLine +
$"Number: {byteNumNumber}" + CharManager.NewLine +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ private static void RenderKeybindingsBox(InteractiveTuiSettings settings)

// User needs an infobox that shows all available keys
string bindingsHelp = KeybindingTools.RenderKeybindingHelpText(finalBindings);
InfoBoxModalColor.WriteInfoBoxModalColorBack(bindingsHelp, settings.BoxForegroundColor, settings.BoxBackgroundColor);
InfoBoxModalColor.WriteInfoBoxModalColorBack("Available keybindings", bindingsHelp, settings.BoxForegroundColor, settings.BoxBackgroundColor);
}

private static void MoveBackward(List<string> lines, Screen screen) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ private static List<string> RenderKeybindingsBox(List<string> lines, Interactive

// User needs an infobox that shows all available keys
string bindingsHelp = KeybindingTools.RenderKeybindingHelpText(bindings);
InfoBoxModalColor.WriteInfoBoxModalColorBack(bindingsHelp, settings.BoxForegroundColor, settings.BoxBackgroundColor);
InfoBoxModalColor.WriteInfoBoxModalColorBack("Available keybindings", bindingsHelp, settings.BoxForegroundColor, settings.BoxBackgroundColor);
return lines;
}

Expand Down

0 comments on commit 1268b78

Please sign in to comment.