Skip to content

Commit

Permalink
Don't send Activated event when opening/closing branches with [Space]
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Feb 4, 2021
1 parent 37d3a1e commit d88f447
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/NCTable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ NCPad * NCTable::CreatePad()
NCursesEvent NCTable::wHandleInput( wint_t key )
{
NCursesEvent ret = NCursesEvent::none;
bool sendEvent = false;
int currentIndex = getCurrentItem();

// Call the pad's input handler via NCPadWidget::handleInput()
Expand Down Expand Up @@ -586,27 +585,33 @@ NCursesEvent NCTable::wHandleInput( wint_t key )
break;


case KEY_SPACE:

if ( ! handled ) // NCTableLine::handleInput() handles opening/closing branches
{
if ( _multiSelect )
{
toggleCurrentItem();

if ( notify() )
return NCursesEvent::ValueChanged;
}
}
break;

// Even if the event was already handled:
// Take care about sending UI events to the caller.

case KEY_RETURN:

sendEvent = true;

if ( _multiSelect)
if ( _multiSelect )
{
toggleCurrentItem();

// Send ValueChanged on Return (like done for NCTree multiSelection)

if ( notify() && sendEvent )
if ( notify() )
return NCursesEvent::ValueChanged;
}
// FALLTHRU

case KEY_SPACE:

if ( !_multiSelect )
else // !_multiSelect
{
if ( notify() && currentIndex != -1 )
return NCursesEvent::Activated;
Expand Down

0 comments on commit d88f447

Please sign in to comment.