Skip to content

Commit

Permalink
Use a static array to store the keymap
Browse files Browse the repository at this point in the history
  • Loading branch information
mawww committed Mar 9, 2015
1 parent 1cec8df commit d1f1722
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/normal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ void move(Context& context, NormalParams params)
selections.sort_and_merge_overlapping();
}

KeyMap keymap =
static NormalCmdDesc cmds[] =
{
{ 'h', "move left", move<CharCount, Backward> },
{ 'j', "move down", move<LineCount, Forward> },
Expand Down Expand Up @@ -1515,4 +1515,6 @@ KeyMap keymap =
{ Key::PageDown, "scroll one page down", scroll<Key::PageDown> },
};

KeyMap keymap = cmds;

}
4 changes: 2 additions & 2 deletions src/normal.hh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef normal_hh_INCLUDED
#define normal_hh_INCLUDED

#include "array_view.hh"
#include "keys.hh"
#include "unordered_map.hh"
#include "string.hh"

namespace Kakoune
Expand All @@ -23,7 +23,7 @@ struct NormalCmdDesc
void (*func)(Context& context, NormalParams params);
};

using KeyMap = Vector<NormalCmdDesc>;
using KeyMap = const ArrayView<NormalCmdDesc>;
extern KeyMap keymap;

}
Expand Down

0 comments on commit d1f1722

Please sign in to comment.