diff options
author | Stefan Bolte <sbolte@lavabit.com> | 2013-04-18 00:31:57 +0200 |
---|---|---|
committer | Stefan Bolte <sbolte@lavabit.com> | 2013-04-18 00:31:57 +0200 |
commit | a8ed8093f80dfa701e51f4edf542b6eb620f50c7 (patch) | |
tree | 4a6a5eeb261980a698e373d68a71f0882b08973a | |
parent | 6bd421d013edd373f7dedf573cd7e645b86ded01 (diff) | |
download | dwb-a8ed8093f80dfa701e51f4edf542b6eb620f50c7.zip |
Merging mode changing commands
-rw-r--r-- | src/commands.c | 32 | ||||
-rw-r--r-- | src/commands.h | 5 | ||||
-rw-r--r-- | src/config.h | 20 |
3 files changed, 18 insertions, 39 deletions
diff --git a/src/commands.c b/src/commands.c index aa8d5f37..1e01d593 100644 --- a/src/commands.c +++ b/src/commands.c @@ -184,18 +184,6 @@ commands_add_search_field(KeyMap *km, Arg *a) }/*}}}*/ -DwbStatus -commands_insert_mode(KeyMap *km, Arg *a) -{ - return dwb_change_mode(INSERT_MODE); -} -DwbStatus -commands_normal_mode(KeyMap *km, Arg *a) -{ - dwb_change_mode(NORMAL_MODE, true); - return STATUS_OK; -} - /* commands_toggle_proxy {{{*/ DwbStatus commands_toggle_proxy(KeyMap *km, Arg *a) @@ -524,14 +512,14 @@ commands_entry_confirm(KeyMap *km, Arg *a) return STATUS_OK; }/*}}}*/ -/* commands_entry_escape {{{*/ DwbStatus -commands_entry_escape(KeyMap *km, Arg *a) +commands_change_mode(KeyMap *km, Arg *a) { - dwb_change_mode(NORMAL_MODE, true); - return STATUS_OK; -}/*}}}*/ - + if (a->b) + return dwb_change_mode(a->n, true); + else + return dwb_change_mode(a->n); +} /* commands_save_session {{{*/ DwbStatus commands_save_session(KeyMap *km, Arg *arg) @@ -802,13 +790,7 @@ commands_open_editor(KeyMap *km, Arg *arg) return editor_open(); }/*}}}*/ -/* dwb_command_mode {{{*/ -DwbStatus -commands_command_mode(KeyMap *km, Arg *arg) -{ - return dwb_change_mode(COMMAND_MODE); -}/*}}}*/ -/* dwb_command_mode {{{*/ +/* dwb_only {{{*/ DwbStatus commands_only(KeyMap *km, Arg *arg) { diff --git a/src/commands.h b/src/commands.h index 59b09a6a..62f9b1ae 100644 --- a/src/commands.h +++ b/src/commands.h @@ -31,7 +31,6 @@ DwbStatus commands_entry_movement(KeyMap *, Arg *); DwbStatus commands_entry_history_back(KeyMap *, Arg *); DwbStatus commands_entry_history_forward(KeyMap *, Arg *); DwbStatus commands_entry_confirm(KeyMap *km, Arg *a); -DwbStatus commands_entry_escape(KeyMap *km, Arg *a); DwbStatus commands_execute_userscript(KeyMap *, Arg *); DwbStatus commands_find(KeyMap *, Arg *); @@ -77,8 +76,7 @@ DwbStatus commands_quit(KeyMap *, Arg *); DwbStatus commands_reload_user_scripts(KeyMap *, Arg *); DwbStatus commands_fullscreen(KeyMap *, Arg *); DwbStatus commands_open_editor(KeyMap *, Arg *); -DwbStatus commands_insert_mode(KeyMap *, Arg *); -DwbStatus commands_command_mode(KeyMap *, Arg *); +DwbStatus commands_change_mode(KeyMap *, Arg *); DwbStatus commands_only(KeyMap *, Arg *); DwbStatus commands_toggle_bars(KeyMap *, Arg *); DwbStatus commands_presentation_mode(KeyMap *, Arg *); @@ -89,7 +87,6 @@ DwbStatus commands_toggle_setting(KeyMap *km, Arg *arg); DwbStatus commands_tab_move(KeyMap *, Arg *); DwbStatus commands_clear_tab(KeyMap *, Arg *); DwbStatus commands_cancel_download(KeyMap *, Arg *); -DwbStatus commands_normal_mode(KeyMap *, Arg *); DwbStatus commands_dump(KeyMap *, Arg *); DwbStatus commands_sanitize(KeyMap *, Arg *); DwbStatus commands_eval(KeyMap *, Arg *); diff --git a/src/config.h b/src/config.h index 56243c48..a899a66f 100644 --- a/src/config.h +++ b/src/config.h @@ -187,7 +187,7 @@ static KeyValue KEYS[] = { { "toggle_tab", { "@Tab@", GDK_CONTROL_MASK, 0 }, }, { "reload_bookmarks", { NULL, 0, 0 }, }, { "reload_quickmarks", { NULL, 0, 0 }, }, - { "print_preview", { NULL, 0, 0 }, }, + { "print_preview", { NULL, 0, 0 }, }, }; /* FUNCTION_MAP{{{*/ @@ -319,8 +319,8 @@ static FunctionMap FMAP [] = { { .n = OPEN_NEW_WINDOW }, EP_NONE, { NULL }, }, { { "command_mode", "Enter command mode", }, 0, - (Func)commands_command_mode, NULL, POST_SM, - {0}, EP_NONE, { NULL }, }, + (Func)commands_change_mode, NULL, POST_SM, + { .n = COMMAND_MODE, .b = false }, EP_NONE, { NULL }, }, { { "find_backward", "Find backward ", }, CP_COMMANDLINE|CP_HAS_MODE, (Func)commands_find, NO_URL, NEVER_SM, @@ -467,12 +467,12 @@ static FunctionMap FMAP [] = { { .n = OPEN_NEW_WINDOW, .i = 1 }, EP_NONE, { "winforward", "wfo", NULL }, }, { { "insert_mode", "Insert Mode", }, CP_COMMANDLINE | CP_HAS_MODE, - (Func)commands_insert_mode, NULL, POST_SM, - { 0 }, EP_NONE, { "i", "insert", NULL }, }, - + (Func)commands_change_mode, NULL, POST_SM, + { .n = INSERT_MODE, .b = false }, EP_NONE, { "i", "insert", NULL }, }, + { { "normal_mode", "Normal Mode", }, CP_OVERRIDE_INSERT | CP_OVERRIDE_ENTRY | CP_OVERRIDE_ALL, - (Func)commands_normal_mode, NULL, POST_SM, - { 0 }, EP_NONE, { NULL }, }, + (Func)commands_change_mode, NULL, POST_SM, + { .n = NORMAL_MODE, .b = true }, EP_NONE, { NULL }, }, { { "load_html", "Load html", }, CP_COMMANDLINE, (Func)commands_open, NULL, NEVER_SM, @@ -760,8 +760,8 @@ static FunctionMap FMAP [] = { { 0 }, EP_NONE, { NULL }, }, { { "entry_escape", "Command line: Alternate escape binding", }, CP_OVERRIDE_ENTRY, - (Func)commands_entry_escape, NULL, ALWAYS_SM, - { 0 }, EP_NONE, { NULL }, }, + (Func)commands_change_mode, NULL, ALWAYS_SM, + { .n = NORMAL_MODE, .b = true }, EP_NONE, { NULL }, }, { { "entry_confirm", "Command line: Alternate return binding", }, CP_OVERRIDE_ENTRY, (Func)commands_entry_confirm, NULL, ALWAYS_SM, |