1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | View_ID view = get_active_view(app, Access_Always); Scratch_Block scratch(app); String_u8 commandString = string_u8_push(scratch, 10); User_Input firstCommandInput = get_current_input(app); User_Input nextCommandInput = get_next_input(app, EventProperty_TextInsert, EventProperty_Escape); string_append_character(&commandString, *key_code_name[firstCommandInput.event.key.code]); if (nextCommandInput.abort) return; else string_append(&commandString, nextCommandInput.event.text.string); ................. |
1 2 3 4 5 6 7 | User_Input input = get_current_input( app ); if ( input.event.kind == InputEventKind_KeyStroke && input.event.key.first_dependent_text ) { Input_Event* e = input.event.key.first_dependent_text; _assert( e->kind == InputEventKind_TextInsert ); String_Const_u8 string = e->text.string; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | /* 4coder_default_bidings.cpp - Supplies the default bindings used for default 4coder behavior. */ // TOP #if !defined(FCODER_DEFAULT_BINDINGS_CPP) #define FCODER_DEFAULT_BINDINGS_CPP #include "4coder_default_include.cpp" // NOTE(allen): Users can declare their own managed IDs here. #if !defined(META_PASS) #include "generated/managed_id_metadata.cpp" #endif CUSTOM_COMMAND_SIG( test ) { User_Input input = get_current_input( app ); if ( input.event.kind == InputEventKind_KeyStroke && input.event.key.first_dependent_text ) { Input_Event* e = input.event.key.first_dependent_text; Assert( e->kind == InputEventKind_TextInsert ); write_text( app, e->text.string ); } while ( !input.abort ) { input = get_next_input( app, EventProperty_AnyKey, EventProperty_Escape ); if ( input.event.kind == InputEventKind_KeyStroke && input.event.key.first_dependent_text ) { Input_Event* e = input.event.key.first_dependent_text; Assert( e->kind == InputEventKind_TextInsert ); write_text( app, e->text.string ); } } } void custom_layer_init(Application_Links *app){ Thread_Context *tctx = get_thread_context(app); // NOTE(allen): setup for default framework default_framework_init(app); // NOTE(allen): default hooks and command maps set_all_default_hooks(app); mapping_init(tctx, &framework_mapping); #if OS_MAC // setup_mac_mapping(&framework_mapping, mapid_global, mapid_file, mapid_code); #else // setup_default_mapping(&framework_mapping, mapid_global, mapid_file, mapid_code); #endif MappingScope( ); SelectMapping( &framework_mapping ); SelectMap( mapid_global ); BindCore( default_startup, CoreCode_Startup ); BindCore( default_try_exit, CoreCode_TryExit ); SelectMap( mapid_file ); ParentMap( mapid_global ); Bind( test, KeyCode_D ); SelectMap( mapid_code ); ParentMap( mapid_global ); } #endif //FCODER_DEFAULT_BINDINGS // BOTTOM |