Skip to content

Commit e85f694

Browse files
committed
Fixed Time/DateField crash 2
1 parent bf2e032 commit e85f694

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Terminal.Gui/Views/DateField.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ public override void DeleteCharRight ()
116116
/// <inheritdoc/>
117117
protected override bool OnMouseEvent (MouseEventArgs ev)
118118
{
119+
if (base.OnMouseEvent (ev) || ev.Handled)
120+
{
121+
return true;
122+
}
123+
119124
if (SelectedLength == 0 && ev.Flags.HasFlag (MouseFlags.Button1Pressed))
120125
{
121126
AdjCursorPosition (ev.Position.X);
@@ -162,7 +167,7 @@ private void AdjCursorPosition (int point, bool increment = true)
162167
newPoint = 1;
163168
}
164169

165-
//if (newPoint != point)
170+
if (newPoint != point)
166171
{
167172
CursorPosition = newPoint;
168173
}

Terminal.Gui/Views/TimeField.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ public override void DeleteCharRight ()
165165
/// <inheritdoc/>
166166
protected override bool OnMouseEvent (MouseEventArgs ev)
167167
{
168+
if (base.OnMouseEvent (ev) || ev.Handled)
169+
{
170+
return true;
171+
}
172+
168173
if (SelectedLength == 0 && ev.Flags.HasFlag (MouseFlags.Button1Pressed))
169174
{
170175
int point = ev.Position.X;
@@ -220,7 +225,7 @@ private void AdjCursorPosition (int point, bool increment = true)
220225
newPoint = 1;
221226
}
222227

223-
//if (newPoint != point)
228+
if (newPoint != point)
224229
{
225230
CursorPosition = newPoint;
226231
}

0 commit comments

Comments
 (0)