Skip to content

Commit

Permalink
imp - Don't set title again on wrap
Browse files Browse the repository at this point in the history
---

We've removed a sequence that sets the console title from the total buffered output.

---

Type: imp
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 24, 2024
1 parent 56cc1a2 commit 8c9c4ee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public static void ExecuteCommandWrapped(string Command)
// Then, initialize the buffered writer and execute the commands
DriverHandler.BeginLocalDriver<IConsoleDriver>("Buffered");
DebugWriter.WriteDebug(DebugLevel.I, "Buffering...");
ShellManager.GetLine(Command, "", currentType, false);
ShellManager.GetLine(Command, "", currentType, false, false);
CancellationHandlers.AllowCancel();
buffered = true;

Expand Down
27 changes: 20 additions & 7 deletions public/Nitrocid/Shell/ShellBase/Shells/ShellManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,15 @@ public static string LastShellType
/// </summary>
/// <remarks>All new shells implemented either in KS or by mods should use this routine to allow effective and consistent line parsing.</remarks>
public static void GetLine() =>
GetLine("", "", CurrentShellType);
GetLine("", "", CurrentShellType, true, Config.MainConfig.SetTitleOnCommandExecution);

/// <summary>
/// Parses a specified command.
/// </summary>
/// <param name="FullCommand">The full command string</param>
/// <remarks>All new shells implemented either in KS or by mods should use this routine to allow effective and consistent line parsing.</remarks>
public static void GetLine(string FullCommand) =>
GetLine(FullCommand, "", CurrentShellType);
GetLine(FullCommand, "", CurrentShellType, true, Config.MainConfig.SetTitleOnCommandExecution);

/// <summary>
/// Parses a specified command.
Expand All @@ -280,7 +280,7 @@ public static void GetLine(string FullCommand) =>
/// <param name="OutputPath">Optional (non-)neutralized output path</param>
/// <remarks>All new shells implemented either in KS or by mods should use this routine to allow effective and consistent line parsing.</remarks>
public static void GetLine(string FullCommand, string OutputPath = "") =>
GetLine(FullCommand, OutputPath, CurrentShellType);
GetLine(FullCommand, OutputPath, CurrentShellType, true, Config.MainConfig.SetTitleOnCommandExecution);

/// <summary>
/// Parses a specified command.
Expand All @@ -290,7 +290,7 @@ public static void GetLine(string FullCommand, string OutputPath = "") =>
/// <param name="ShellType">Shell type</param>
/// <remarks>All new shells implemented either in KS or by mods should use this routine to allow effective and consistent line parsing.</remarks>
public static void GetLine(string FullCommand, string OutputPath = "", ShellType ShellType = ShellType.Shell) =>
GetLine(FullCommand, OutputPath, GetShellTypeName(ShellType));
GetLine(FullCommand, OutputPath, GetShellTypeName(ShellType), true, Config.MainConfig.SetTitleOnCommandExecution);

/// <summary>
/// Parses a specified command.
Expand All @@ -300,7 +300,19 @@ public static void GetLine(string FullCommand, string OutputPath = "", ShellType
/// <param name="ShellType">Shell type</param>
/// <param name="restoreDriver">Whether to restore the driver to the previous state</param>
/// <remarks>All new shells implemented either in KS or by mods should use this routine to allow effective and consistent line parsing.</remarks>
public static void GetLine(string FullCommand, string OutputPath = "", string ShellType = "Shell", bool restoreDriver = true)
public static void GetLine(string FullCommand, string OutputPath = "", string ShellType = "Shell", bool restoreDriver = true) =>
GetLine(FullCommand, OutputPath, ShellType, restoreDriver, Config.MainConfig.SetTitleOnCommandExecution);

/// <summary>
/// Parses a specified command.
/// </summary>
/// <param name="FullCommand">The full command string</param>
/// <param name="OutputPath">Optional (non-)neutralized output path</param>
/// <param name="ShellType">Shell type</param>
/// <param name="restoreDriver">Whether to restore the driver to the previous state</param>
/// <param name="setTitle">Whether to set the console title</param>
/// <remarks>All new shells implemented either in KS or by mods should use this routine to allow effective and consistent line parsing.</remarks>
internal static void GetLine(string FullCommand, string OutputPath = "", string ShellType = "Shell", bool restoreDriver = true, bool setTitle = true)
{
// Check for sanity
if (string.IsNullOrEmpty(FullCommand))
Expand Down Expand Up @@ -455,7 +467,7 @@ public static void GetLine(string FullCommand, string OutputPath = "", string Sh
try
{
// Set title
if (Config.MainConfig.SetTitleOnCommandExecution)
if (setTitle)
ConsoleMisc.SetTitle($"{KernelReleaseInfo.ConsoleTitle} - {Command}");

// Check the command
Expand Down Expand Up @@ -618,7 +630,8 @@ public static void GetLine(string FullCommand, string OutputPath = "", string Sh
}

// Restore title and cancel possibility state
ConsoleMisc.SetTitle(KernelReleaseInfo.ConsoleTitle);
if (setTitle)
ConsoleMisc.SetTitle(KernelReleaseInfo.ConsoleTitle);
CancellationHandlers.InhibitCancel();
lastCommand = FullCommand;
}
Expand Down

0 comments on commit 8c9c4ee

Please sign in to comment.