Skip to content

Commit

Permalink
Adding ctrl-a to standard mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasnoble committed Aug 22, 2021
1 parent 03b1598 commit 40ff9f8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/zep/keymap.h
Expand Up @@ -142,6 +142,8 @@ DECLARE_COMMANDID(NextTabWindow)
DECLARE_COMMANDID(StandardCopy)
DECLARE_COMMANDID(StandardPaste)

DECLARE_COMMANDID(StandardSelectAll)

DECLARE_COMMANDID(MotionStandardDown)
DECLARE_COMMANDID(MotionStandardUp)
DECLARE_COMMANDID(MotionStandardLeft)
Expand Down
10 changes: 10 additions & 0 deletions src/mode.cpp
Expand Up @@ -974,6 +974,16 @@ bool ZepMode::GetCommand(CommandContext& context)
GetCurrentWindow()->MoveCursorY(1, LineLocation::LineCRBegin);
return true;
}
else if (mappedCommand == id_StandardSelectAll)
{
context.commandResult.modeSwitch = EditorMode::Visual;
m_visualBegin = context.buffer.Begin();
m_visualEnd = context.buffer.End();
auto range = GetInclusiveVisualRange();
GetCurrentWindow()->GetBuffer().SetSelection(range);
GetCurrentWindow()->SetBufferCursor(range.second);
return true;
}
else if (mappedCommand == id_MotionStandardRightSelect)
{
context.commandResult.modeSwitch = EditorMode::Visual;
Expand Down
2 changes: 2 additions & 0 deletions src/mode_standard.cpp
Expand Up @@ -75,6 +75,8 @@ void ZepMode_Standard::Init()
keymap_add({ &m_insertMap, &m_visualMap }, { "<C-v>" }, id_StandardPaste);
keymap_add({ &m_visualMap }, { "<C-c>" }, id_StandardCopy);

keymap_add({ &m_insertMap, &m_visualMap }, { "<C-a>" }, id_StandardSelectAll);

keymap_add({ &m_normalMap, &m_visualMap, &m_insertMap }, { "<Escape>" }, id_InsertMode);
keymap_add({ &m_normalMap }, { "<Backspace>" }, id_MotionStandardLeft);
}
Expand Down

0 comments on commit 40ff9f8

Please sign in to comment.