Client::MenuMode wrap through options with j/k Ctrl-n/Ctrl-p and tab
This commit is contained in:
parent
c4dd6b4038
commit
57b89099ec
|
@ -64,14 +64,24 @@ public:
|
||||||
key == Key(Key::Modifiers::Control, 'i') or
|
key == Key(Key::Modifiers::Control, 'i') or
|
||||||
key == Key(Key::Modifiers::None, 'j'))
|
key == Key(Key::Modifiers::None, 'j'))
|
||||||
{
|
{
|
||||||
m_client.menu_ctrl(MenuCommand::SelectNext);
|
if (++m_selected >= m_choice_count)
|
||||||
m_selected = std::min(m_selected+1, m_choice_count-1);
|
{
|
||||||
|
m_client.menu_ctrl(MenuCommand::SelectFirst);
|
||||||
|
m_selected = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_client.menu_ctrl(MenuCommand::SelectNext);
|
||||||
}
|
}
|
||||||
if (key == Key(Key::Modifiers::Control, 'p') or
|
if (key == Key(Key::Modifiers::Control, 'p') or
|
||||||
key == Key(Key::Modifiers::None, 'k'))
|
key == Key(Key::Modifiers::None, 'k'))
|
||||||
{
|
{
|
||||||
m_client.menu_ctrl(MenuCommand::SelectPrev);
|
if (--m_selected < 0)
|
||||||
m_selected = std::max(m_selected-1, 0);
|
{
|
||||||
|
m_client.menu_ctrl(MenuCommand::SelectLast);
|
||||||
|
m_selected = m_choice_count-1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_client.menu_ctrl(MenuCommand::SelectPrev);
|
||||||
}
|
}
|
||||||
if (key == Key(Key::Modifiers::Control, 'm'))
|
if (key == Key(Key::Modifiers::Control, 'm'))
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,7 @@ class Context;
|
||||||
enum class MenuCommand
|
enum class MenuCommand
|
||||||
{
|
{
|
||||||
SelectFirst,
|
SelectFirst,
|
||||||
|
SelectLast,
|
||||||
SelectPrev,
|
SelectPrev,
|
||||||
SelectNext,
|
SelectNext,
|
||||||
SelectNone,
|
SelectNone,
|
||||||
|
|
|
@ -243,6 +243,10 @@ void NCursesClient::menu_ctrl(MenuCommand command)
|
||||||
set_menu_fore(m_menu, A_STANDOUT);
|
set_menu_fore(m_menu, A_STANDOUT);
|
||||||
menu_driver(m_menu, REQ_FIRST_ITEM);
|
menu_driver(m_menu, REQ_FIRST_ITEM);
|
||||||
break;
|
break;
|
||||||
|
case MenuCommand::SelectLast:
|
||||||
|
set_menu_fore(m_menu, A_STANDOUT);
|
||||||
|
menu_driver(m_menu, REQ_LAST_ITEM);
|
||||||
|
break;
|
||||||
case MenuCommand::SelectNext:
|
case MenuCommand::SelectNext:
|
||||||
set_menu_fore(m_menu, A_STANDOUT);
|
set_menu_fore(m_menu, A_STANDOUT);
|
||||||
menu_driver(m_menu, REQ_NEXT_ITEM);
|
menu_driver(m_menu, REQ_NEXT_ITEM);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user