Skip to content

Commit da0c09b

Browse files
committed
Fix click events blocked by Button1Released early return
Unix SGR mouse driver sends Button1Released and Button1Clicked as combined flags in a single event. The Button1Released handler in ListControl and TableControl had an unconditional return false when no scrollbar drag was active, preventing Button1Clicked from ever being processed. This broke click-based selection in ServerHub dialogs.
1 parent 96b0b8e commit da0c09b

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

SharpConsoleUI/Controls/ListControl/ListControl.Mouse.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,10 @@ public bool ProcessMouseEvent(MouseEventArgs args)
117117
}
118118

119119
// Handle scrollbar drag end
120-
if (args.HasFlag(MouseFlags.Button1Released))
120+
if (args.HasFlag(MouseFlags.Button1Released) && _isScrollbarDragging)
121121
{
122-
if (_isScrollbarDragging)
123-
{
124-
_isScrollbarDragging = false;
125-
return true;
126-
}
127-
return false;
122+
_isScrollbarDragging = false;
123+
return true;
128124
}
129125

130126
// Calculate which item the mouse is over

SharpConsoleUI/Controls/TableControl/TableControl.Mouse.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public bool ProcessMouseEvent(MouseEventArgs args)
7171
_isResizingColumn = false;
7272
return true;
7373
}
74-
return false;
74+
// Don't return false here — the event may also contain Button1Clicked
75+
// which must be processed by handlers below (Unix SGR sends both flags together)
7576
}
7677

7778
// Hover tracking

0 commit comments

Comments
 (0)