c4c85cf4b8
- Translated project documentation (LEARNING-JOURNEY, CONTRIBUTORS, AI_DISCLOSURE) to English for better accessibility. - Standardized internal code documentation by converting XML-doc blocks to standard comment format. - Cleaned up inline comments and removed redundant versioning metadata across the codebase. - Refactored non-functional text elements to improve readability and maintain a consistent style.
27 lines
801 B
C#
27 lines
801 B
C#
using System;
|
|
using HellionChat.Ui;
|
|
|
|
namespace HellionChat._Helpers;
|
|
|
|
// Extracted submit logic from ChatInputBar.SubmitCompact to allow unit testing
|
|
// without a sealed ChatLogWindow dependency.
|
|
// TEST-MIRROR: ../../../Hellion Build test/Ui/CompactInputSubmitterTests.cs
|
|
public static class CompactInputSubmitter
|
|
{
|
|
public static bool TrySubmit(InputState state, Tab tab, Action<Tab, string> sender)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(state);
|
|
ArgumentNullException.ThrowIfNull(tab);
|
|
ArgumentNullException.ThrowIfNull(sender);
|
|
|
|
if (string.IsNullOrWhiteSpace(state.Buffer))
|
|
return false;
|
|
|
|
var text = state.Buffer;
|
|
state.Buffer = string.Empty;
|
|
state.HistoryCursor = -1;
|
|
sender(tab, text);
|
|
return true;
|
|
}
|
|
}
|