Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Sep 11, 2024
1 parent ee7d518 commit 00d8d8f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions JL.Windows/GUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,24 @@ private bool CopyText(string text)
bool mergeTexts = false;
string? subsequentText = null;

if (ConfigManager.MergeSequentialTextsWhenTheyMatch)
Dispatcher.Invoke(() =>
{
DateTime preciseTimeNow = new(Stopwatch.GetTimestamp());
if (ConfigManager.MergeSequentialTextsWhenTheyMatch)
{
DateTime preciseTimeNow = new(Stopwatch.GetTimestamp());

mergeTexts = (ConfigManager.MaxDelayBetweenCopiesForMergingMatchingSequentialTextsInMilliseconds is 0
|| (preciseTimeNow - s_lastTextCopyTime).TotalMilliseconds < ConfigManager.MaxDelayBetweenCopiesForMergingMatchingSequentialTextsInMilliseconds)
&& sanitizedText.StartsWith(MainTextBox.Text, StringComparison.Ordinal);
mergeTexts = (ConfigManager.MaxDelayBetweenCopiesForMergingMatchingSequentialTextsInMilliseconds is 0
|| (preciseTimeNow - s_lastTextCopyTime).TotalMilliseconds < ConfigManager.MaxDelayBetweenCopiesForMergingMatchingSequentialTextsInMilliseconds)
&& sanitizedText.StartsWith(MainTextBox.Text, StringComparison.Ordinal);

s_lastTextCopyTime = preciseTimeNow;
s_lastTextCopyTime = preciseTimeNow;

if (mergeTexts)
{
subsequentText = sanitizedText[MainTextBox.Text.Length..];
if (mergeTexts)
{
subsequentText = sanitizedText[MainTextBox.Text.Length..];
}
}
}

Dispatcher.Invoke(() =>
{
if (mergeTexts)
{
MainTextBox.AppendText(subsequentText);
Expand Down

0 comments on commit 00d8d8f

Please sign in to comment.