Skip to content

Commit 9f33e33

Browse files
fshifNyaMisty
authored andcommitted
Pull Code52#164 from Code52/carnac & Extra changes
Code52#164
1 parent 1bc978a commit 9f33e33

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/Carnac.Logic/KeyProvider.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ KeyPress ToCarnacKeyPress(InterceptKeyEventArgs interceptKeyEventArgs)
137137
return null;
138138
}
139139

140+
/*
140141
Debug.WriteLine("processName: " + process.ProcessName);
142+
*/
141143

142144
var filterRegex = GetRegEx();
143145

src/Carnac.Logic/Models/KeyPress.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ public IEnumerable<string> GetTextParts()
3737
{
3838
if (!isFirst)
3939
{
40+
/*
4041
yield return " + ";
42+
*/
43+
yield return "";
4144
}
4245
else
4346
{

src/Carnac.Logic/Models/Message.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System;
33
using System.Collections.Generic;
44
using System.Collections.ObjectModel;
5+
using System.Diagnostics;
56
using System.Linq;
67
using System.Windows.Media;
78

@@ -115,7 +116,10 @@ public Message Replace(Message newMessage)
115116
return new Message(this, newMessage, true);
116117
}
117118

118-
static readonly TimeSpan OneSecond = TimeSpan.FromSeconds(1);
119+
/*
120+
static readonly TimeSpan OneSecond = TimeSpan.FromSeconds(1);
121+
*/
122+
static readonly TimeSpan OneSecond = TimeSpan.FromSeconds(0.5);
119123

120124
public static Message MergeIfNeeded(Message previousMessage, Message newMessage)
121125
{
@@ -134,6 +138,9 @@ public static Message MergeIfNeeded(Message previousMessage, Message newMessage)
134138

135139
static bool ShouldCreateNewMessage(Message previous, Message current)
136140
{
141+
return current.LastMessage.Subtract(previous.LastMessage) > OneSecond ||
142+
previous.ProcessName != current.ProcessName;
143+
/*
137144
return previous.ProcessName != current.ProcessName ||
138145
current.LastMessage.Subtract(previous.LastMessage) > OneSecond ||
139146
KeyProvider.IsModifierKeyPress(current.keys[0].InterceptKeyEventArgs) ||
@@ -145,6 +152,7 @@ static bool ShouldCreateNewMessage(Message previous, Message current)
145152
((InterceptMouse.MouseKeys.Contains(current.keys[0].Key) ||
146153
(previous.keys != null && InterceptMouse.MouseKeys.Contains(previous.keys[0].Key)))
147154
&& !previous.keys[0].Input.SequenceEqual(current.keys[0].Input));
155+
*/
148156
}
149157

150158
public Message FadeOut()
@@ -165,6 +173,9 @@ static IEnumerable<string> CreateTextSequence(IEnumerable<KeyPress> keys)
165173
if (acc.Any())
166174
{
167175
var last = acc.Last();
176+
/*
177+
if (last.IsRepeatedBy(curr))
178+
*/
168179
var secondLast = acc.Count() > 1 ? acc.SkipLast(1).Last() : null;
169180
var thirdLast = acc.Count() > 2 ? acc.SkipLast(2).Last() : null;
170181
if (last.IsRepeatedBy(curr) &&
@@ -235,13 +246,19 @@ public bool IsRepeatedBy(KeyPress nextKeyPress)
235246
public IEnumerable<string> GetTextParts()
236247
{
237248
if (requiresPrefix)
249+
/*
238250
yield return ", ";
251+
*/
252+
yield return "";
239253
foreach (var textPart in textParts)
240254
{
241255
yield return textPart;
242256
}
243257
if (repeatCount > 1)
258+
/*
244259
yield return string.Format(" x {0} ", repeatCount);
260+
*/
261+
yield return string.Format("�{0}", repeatCount);
245262
}
246263
}
247264

0 commit comments

Comments
 (0)