chore: housekeeping — linter & formatter setup
Add .prettierrc.json, .markdownlint.json, .yamllint.yaml, .gitattributes Run CSharpier, Prettier and markdownlint across the entire codebase. No logic changes — formatting, using order and line endings only.
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using HellionChat.Code;
|
||||
using HellionChat.Resources;
|
||||
using HellionChat.Util;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using HellionChat.Code;
|
||||
using HellionChat.Resources;
|
||||
using HellionChat.Util;
|
||||
|
||||
namespace HellionChat.Ui;
|
||||
|
||||
@@ -30,12 +30,18 @@ public partial class InputPreview : Window
|
||||
|
||||
internal int SelectedCursorPos = -1;
|
||||
|
||||
internal InputPreview(ChatLogWindow logWindow) : base("##chat2-inputpreview")
|
||||
internal InputPreview(ChatLogWindow logWindow)
|
||||
: base("##chat2-inputpreview")
|
||||
{
|
||||
LogWindow = logWindow;
|
||||
|
||||
Flags = ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoMove |
|
||||
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoScrollbar;
|
||||
Flags =
|
||||
ImGuiWindowFlags.NoSavedSettings
|
||||
| ImGuiWindowFlags.NoTitleBar
|
||||
| ImGuiWindowFlags.NoMove
|
||||
| ImGuiWindowFlags.NoResize
|
||||
| ImGuiWindowFlags.NoFocusOnAppearing
|
||||
| ImGuiWindowFlags.NoScrollbar;
|
||||
|
||||
RespectCloseHotkey = false;
|
||||
DisableWindowSounds = true;
|
||||
@@ -49,7 +55,10 @@ public partial class InputPreview : Window
|
||||
Plugin.Framework.Update -= UpdateConditionCheck;
|
||||
}
|
||||
|
||||
private bool ValidDraw => !string.IsNullOrEmpty(LogWindow.Chat) && LogWindow.Chat.Length >= Plugin.Config.PreviewMinimum;
|
||||
private bool ValidDraw =>
|
||||
!string.IsNullOrEmpty(LogWindow.Chat)
|
||||
&& LogWindow.Chat.Length >= Plugin.Config.PreviewMinimum;
|
||||
|
||||
private void UpdateConditionCheck(IFramework framework)
|
||||
{
|
||||
Drawing = ValidDraw;
|
||||
@@ -70,7 +79,9 @@ public partial class InputPreview : Window
|
||||
var bytes = Encoding.UTF8.GetBytes(LogWindow.Chat.Trim());
|
||||
AutoTranslate.ReplaceWithPayload(ref bytes);
|
||||
|
||||
var chunks = ChunkUtil.ToChunks(SeString.Parse(bytes), ChunkSource.Content, ChatType.Say).ToList();
|
||||
var chunks = ChunkUtil
|
||||
.ToChunks(SeString.Parse(bytes), ChunkSource.Content, ChatType.Say)
|
||||
.ToList();
|
||||
PreviewMessage = Message.FakeMessage(chunks, new ChatCode(XivChatType.Say, 0, 0));
|
||||
PreviewMessage.DecodeTextParam();
|
||||
}
|
||||
@@ -79,7 +90,9 @@ public partial class InputPreview : Window
|
||||
|
||||
internal bool IsDrawable => ValidDraw && HasEvaluation;
|
||||
|
||||
private static bool IsWindowMode => Plugin.Config.PreviewPosition is PreviewPosition.Top or PreviewPosition.Bottom;
|
||||
private static bool IsWindowMode =>
|
||||
Plugin.Config.PreviewPosition is PreviewPosition.Top or PreviewPosition.Bottom;
|
||||
|
||||
public override bool DrawConditions()
|
||||
{
|
||||
return IsWindowMode && IsDrawable;
|
||||
@@ -96,7 +109,11 @@ public partial class InputPreview : Window
|
||||
{
|
||||
PreviewPosition.Top => pos.Y - PreviewHeight,
|
||||
PreviewPosition.Bottom => pos.Y + size.Y,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(Plugin.Config.PreviewPosition), Plugin.Config.PreviewPosition, null)
|
||||
_ => throw new ArgumentOutOfRangeException(
|
||||
nameof(Plugin.Config.PreviewPosition),
|
||||
Plugin.Config.PreviewPosition,
|
||||
null
|
||||
),
|
||||
};
|
||||
|
||||
Position = pos with { Y = y };
|
||||
@@ -141,7 +158,12 @@ public partial class InputPreview : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawChunksPreview(IReadOnlyList<Chunk> chunks, PayloadHandler? handler = null, float lineWidth = 0f, int unique = 0)
|
||||
private void DrawChunksPreview(
|
||||
IReadOnlyList<Chunk> chunks,
|
||||
PayloadHandler? handler = null,
|
||||
float lineWidth = 0f,
|
||||
int unique = 0
|
||||
)
|
||||
{
|
||||
CursorPosition = 0;
|
||||
|
||||
@@ -168,7 +190,12 @@ public partial class InputPreview : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawChunkPreview(Chunk chunk, PayloadHandler? handler = null, float lineWidth = 0f, int unique = 0)
|
||||
private void DrawChunkPreview(
|
||||
Chunk chunk,
|
||||
PayloadHandler? handler = null,
|
||||
float lineWidth = 0f,
|
||||
int unique = 0
|
||||
)
|
||||
{
|
||||
if (chunk is IconChunk icon)
|
||||
{
|
||||
@@ -248,7 +275,14 @@ public partial class InputPreview : Window
|
||||
var letterSize = ImGui.CalcTextSize(letter.ToString());
|
||||
|
||||
CursorPosition++;
|
||||
if (ImGui.Selectable($"{letter}##{CursorPosition + unique}", false, ImGuiSelectableFlags.None, letterSize))
|
||||
if (
|
||||
ImGui.Selectable(
|
||||
$"{letter}##{CursorPosition + unique}",
|
||||
false,
|
||||
ImGuiSelectableFlags.None,
|
||||
letterSize
|
||||
)
|
||||
)
|
||||
{
|
||||
SelectedCursorPos = CursorPosition;
|
||||
LogWindow.FocusedPreview = true;
|
||||
|
||||
Reference in New Issue
Block a user