diff --git a/4coder_default_bindings.cpp b/4coder_default_bindings.cpp index 430f77da..4ebb26ed 100644 --- a/4coder_default_bindings.cpp +++ b/4coder_default_bindings.cpp @@ -103,9 +103,10 @@ default_keys(Bind_Helper *context){ bind(context, '\t', MDFR_CTRL, auto_tab_range); bind(context, '\t', MDFR_SHIFT, auto_tab_line_at_cursor); + bind(context, 'h', MDFR_ALT, write_hack); + bind(context, 'r', MDFR_ALT, write_block); bind(context, 't', MDFR_ALT, write_todo); bind(context, 'y', MDFR_ALT, write_note); - bind(context, 'r', MDFR_ALT, write_block); bind(context, '[', MDFR_CTRL, open_long_braces); bind(context, '{', MDFR_CTRL, open_long_braces_semicolon); bind(context, '}', MDFR_CTRL, open_long_braces_break); diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index b280af61..ff82f67f 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -290,40 +290,39 @@ CUSTOM_COMMAND_SIG(if0_off){ } } -CUSTOM_COMMAND_SIG(write_todo){ +static void +write_named_comment_string(Application_Links *app, char *type_string){ char space[512]; String str = make_fixed_width_string(space); char *name = 0; int32_t name_len = 0; if (get_current_name(&name, &name_len)){ - append(&str, "// TODO("); + append(&str, "// "); + append(&str, type_string); + append(&str, "("); append(&str, make_string(name, name_len)); append(&str, "): "); } else{ - append(&str, "// TODO: "); + append(&str, "// "); + append(&str, type_string); + append(&str, ": "); } write_string(app, str); } +CUSTOM_COMMAND_SIG(write_todo){ + write_named_comment_string(app, "TODO"); +} + +CUSTOM_COMMAND_SIG(write_hack){ + write_named_comment_string(app, "HACK"); +} + CUSTOM_COMMAND_SIG(write_note){ - char space[512]; - String str = make_fixed_width_string(space); - - char *name = 0; - int32_t name_len = 0; - if (get_current_name(&name, &name_len)){ - append(&str, "// NOTE("); - append(&str, make_string(name, name_len)); - append(&str, "): "); - } - else{ - append(&str, "// NOTE: "); - } - - write_string(app, str); + write_named_comment_string(app, "NOTE"); } CUSTOM_COMMAND_SIG(write_block){