Use a static array to store the keymap

This commit is contained in:
Maxime Coste 2015-03-09 13:55:55 +00:00
parent 1cec8df45e
commit d1f17228dd
2 changed files with 5 additions and 3 deletions

View File

@ -1350,7 +1350,7 @@ void move(Context& context, NormalParams params)
selections.sort_and_merge_overlapping(); selections.sort_and_merge_overlapping();
} }
KeyMap keymap = static NormalCmdDesc cmds[] =
{ {
{ 'h', "move left", move<CharCount, Backward> }, { 'h', "move left", move<CharCount, Backward> },
{ 'j', "move down", move<LineCount, Forward> }, { 'j', "move down", move<LineCount, Forward> },
@ -1515,4 +1515,6 @@ KeyMap keymap =
{ Key::PageDown, "scroll one page down", scroll<Key::PageDown> }, { Key::PageDown, "scroll one page down", scroll<Key::PageDown> },
}; };
KeyMap keymap = cmds;
} }

View File

@ -1,8 +1,8 @@
#ifndef normal_hh_INCLUDED #ifndef normal_hh_INCLUDED
#define normal_hh_INCLUDED #define normal_hh_INCLUDED
#include "array_view.hh"
#include "keys.hh" #include "keys.hh"
#include "unordered_map.hh"
#include "string.hh" #include "string.hh"
namespace Kakoune namespace Kakoune
@ -23,7 +23,7 @@ struct NormalCmdDesc
void (*func)(Context& context, NormalParams params); void (*func)(Context& context, NormalParams params);
}; };
using KeyMap = Vector<NormalCmdDesc>; using KeyMap = const ArrayView<NormalCmdDesc>;
extern KeyMap keymap; extern KeyMap keymap;
} }