added a few new features

master
Allen Webster 2017-07-11 17:41:25 -04:00
parent 30529f4593
commit 35d2ca218b
2 changed files with 19 additions and 19 deletions

View File

@ -103,9 +103,10 @@ default_keys(Bind_Helper *context){
bind(context, '\t', MDFR_CTRL, auto_tab_range); bind(context, '\t', MDFR_CTRL, auto_tab_range);
bind(context, '\t', MDFR_SHIFT, auto_tab_line_at_cursor); 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, 't', MDFR_ALT, write_todo);
bind(context, 'y', MDFR_ALT, write_note); 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);
bind(context, '{', MDFR_CTRL, open_long_braces_semicolon); bind(context, '{', MDFR_CTRL, open_long_braces_semicolon);
bind(context, '}', MDFR_CTRL, open_long_braces_break); bind(context, '}', MDFR_CTRL, open_long_braces_break);

View File

@ -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]; char space[512];
String str = make_fixed_width_string(space); String str = make_fixed_width_string(space);
char *name = 0; char *name = 0;
int32_t name_len = 0; int32_t name_len = 0;
if (get_current_name(&name, &name_len)){ 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, make_string(name, name_len));
append(&str, "): "); append(&str, "): ");
} }
else{ else{
append(&str, "// TODO: "); append(&str, "// ");
append(&str, type_string);
append(&str, ": ");
} }
write_string(app, 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){ CUSTOM_COMMAND_SIG(write_note){
char space[512]; write_named_comment_string(app, "NOTE");
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);
} }
CUSTOM_COMMAND_SIG(write_block){ CUSTOM_COMMAND_SIG(write_block){