whitespace batch bug fixed, some indent bugs fixed, keyboard input improved, removed old keyboard files
This commit is contained in:
parent
4f4bc15e8a
commit
e6d27c2bd8
|
@ -256,6 +256,11 @@ HOOK_SIG(my_file_settings){
|
||||||
wrap_lines = 0;
|
wrap_lines = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE(allen|a4.0.5): Unlike previous versions the command cmdid_set_settings
|
||||||
|
// no longer automatically effects the active buffer. This command will actually be
|
||||||
|
// phased out in favor of an app call soon.
|
||||||
|
push_parameter(app, par_buffer_id, buffer.buffer_id);
|
||||||
|
|
||||||
push_parameter(app, par_lex_as_cpp_file, treat_as_code);
|
push_parameter(app, par_lex_as_cpp_file, treat_as_code);
|
||||||
push_parameter(app, par_wrap_lines, wrap_lines);
|
push_parameter(app, par_wrap_lines, wrap_lines);
|
||||||
push_parameter(app, par_key_mapid, (treat_as_code)?((int)my_code_map):((int)mapid_file));
|
push_parameter(app, par_key_mapid, (treat_as_code)?((int)my_code_map):((int)mapid_file));
|
||||||
|
|
196
4ed.cpp
196
4ed.cpp
|
@ -158,7 +158,8 @@ do_feedback_message(System_Functions *system, Models *models, String value){
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
|
|
||||||
globalvar Application_Links app_links;
|
// TODO(allen): MOVE THIS TO models
|
||||||
|
//globalvar Application_Links app_links;
|
||||||
|
|
||||||
#define USE_MODELS(n) Models *n = command->models
|
#define USE_MODELS(n) Models *n = command->models
|
||||||
#define USE_VARS(n) App_Vars *n = command->vars
|
#define USE_VARS(n) App_Vars *n = command->vars
|
||||||
|
@ -223,7 +224,7 @@ panel_make_empty(System_Functions *system, Exchange *exchange, App_Vars *vars, P
|
||||||
|
|
||||||
Assert(panel->view == 0);
|
Assert(panel->view == 0);
|
||||||
new_view = live_set_alloc_view(&vars->live_set, panel, models);
|
new_view = live_set_alloc_view(&vars->live_set, panel, models);
|
||||||
view_set_file(new_view.view, 0, models, 0, 0, 0);
|
view_set_file(new_view.view, 0, models, 0);
|
||||||
new_view.view->map = app_get_map(models, mapid_global);
|
new_view.view->map = app_get_map(models, mapid_global);
|
||||||
|
|
||||||
return(new_view.view);
|
return(new_view.view);
|
||||||
|
@ -877,7 +878,7 @@ view_file_in_panel(Command_Data *cmd, Panel *panel, Editing_File *file){
|
||||||
cmd->part = partition_sub_part(part, Kbytes(16));
|
cmd->part = partition_sub_part(part, Kbytes(16));
|
||||||
|
|
||||||
View *view = panel->view;
|
View *view = panel->view;
|
||||||
view_set_file(view, file, models, system, models->hooks[hook_open_file], &app_links);
|
view_set_file(view, file, models, system);
|
||||||
view_show_file(view, 0);
|
view_show_file(view, 0);
|
||||||
|
|
||||||
cmd->part = old_part;
|
cmd->part = old_part;
|
||||||
|
@ -908,8 +909,7 @@ COMMAND_DECL(reopen){
|
||||||
index = file->id.id;
|
index = file->id.id;
|
||||||
app_push_file_binding(vars, file_id, index);
|
app_push_file_binding(vars, file_id, index);
|
||||||
|
|
||||||
view_set_file(view, file, models, system,
|
view_set_file(view, file, models, system);
|
||||||
models->hooks[hook_open_file], &app_links);
|
|
||||||
view_show_file(view, 0);
|
view_show_file(view, 0);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -1521,14 +1521,14 @@ COMMAND_DECL(cursor_mark_swap){
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMAND_DECL(user_callback){
|
COMMAND_DECL(user_callback){
|
||||||
if (binding.custom) binding.custom(&app_links);
|
USE_MODELS(models);
|
||||||
|
if (binding.custom) binding.custom(&models->app_links);
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMAND_DECL(set_settings){
|
COMMAND_DECL(set_settings){
|
||||||
REQ_READABLE_VIEW(view);
|
|
||||||
REQ_FILE(file, view);
|
|
||||||
USE_MODELS(models);
|
USE_MODELS(models);
|
||||||
|
|
||||||
|
Editing_File *file = 0;
|
||||||
b32 set_mapid = 0;
|
b32 set_mapid = 0;
|
||||||
i32 new_mapid = 0;
|
i32 new_mapid = 0;
|
||||||
|
|
||||||
|
@ -1537,15 +1537,23 @@ COMMAND_DECL(set_settings){
|
||||||
for (; param < end; param = param_next(param, end)){
|
for (; param < end; param = param_next(param, end)){
|
||||||
int p = dynamic_to_int(¶m->param.param);
|
int p = dynamic_to_int(¶m->param.param);
|
||||||
switch (p){
|
switch (p){
|
||||||
|
case par_buffer_id:
|
||||||
|
{
|
||||||
|
int v = dynamic_to_int(¶m->param.value);
|
||||||
|
file = working_set_get_active_file(&models->working_set, v);
|
||||||
|
}break;
|
||||||
|
|
||||||
case par_lex_as_cpp_file:
|
case par_lex_as_cpp_file:
|
||||||
{
|
{
|
||||||
#if BUFFER_EXPERIMENT_SCALPEL <= 0
|
#if BUFFER_EXPERIMENT_SCALPEL <= 0
|
||||||
int v = dynamic_to_bool(¶m->param.value);
|
if (file){
|
||||||
if (file->settings.tokens_exist){
|
int v = dynamic_to_bool(¶m->param.value);
|
||||||
if (!v) file_kill_tokens(system, &models->mem.general, file);
|
if (file->settings.tokens_exist){
|
||||||
}
|
if (!v) file_kill_tokens(system, &models->mem.general, file);
|
||||||
else{
|
}
|
||||||
if (v) file_first_lex_parallel(system, &models->mem.general, file);
|
else{
|
||||||
|
if (v) file_first_lex_parallel(system, &models->mem.general, file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}break;
|
}break;
|
||||||
|
@ -1553,45 +1561,23 @@ COMMAND_DECL(set_settings){
|
||||||
case par_wrap_lines:
|
case par_wrap_lines:
|
||||||
{
|
{
|
||||||
int v = dynamic_to_bool(¶m->param.value);
|
int v = dynamic_to_bool(¶m->param.value);
|
||||||
if (view->file_data.unwrapped_lines){
|
if (file){
|
||||||
if (v){
|
file->settings.unwrapped_lines = !v;
|
||||||
view->file_data.unwrapped_lines = 0;
|
|
||||||
file->settings.unwrapped_lines = 0;
|
|
||||||
|
|
||||||
if (!file->state.is_loading){
|
|
||||||
Relative_Scrolling scrolling = view_get_relative_scrolling(view);
|
|
||||||
view->file_scroll.target_x = 0;
|
|
||||||
view->file_data.cursor =
|
|
||||||
view_compute_cursor_from_pos(view, view->file_data.cursor.pos);
|
|
||||||
view_set_relative_scrolling(view, scrolling);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (!v){
|
|
||||||
view->file_data.unwrapped_lines = 1;
|
|
||||||
file->settings.unwrapped_lines = 1;
|
|
||||||
|
|
||||||
if (!file->state.is_loading){
|
|
||||||
Relative_Scrolling scrolling = view_get_relative_scrolling(view);
|
|
||||||
view->file_data.cursor =
|
|
||||||
view_compute_cursor_from_pos(view, view->file_data.cursor.pos);
|
|
||||||
view_set_relative_scrolling(view, scrolling);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case par_key_mapid:
|
case par_key_mapid:
|
||||||
{
|
{
|
||||||
set_mapid = 1;
|
if (file){
|
||||||
int v = dynamic_to_int(¶m->param.value);
|
set_mapid = 1;
|
||||||
if (v == mapid_global) file->settings.base_map_id = mapid_global;
|
int v = dynamic_to_int(¶m->param.value);
|
||||||
else if (v == mapid_file) file->settings.base_map_id = mapid_file;
|
if (v == mapid_global) file->settings.base_map_id = mapid_global;
|
||||||
else if (v < mapid_global){
|
else if (v == mapid_file) file->settings.base_map_id = mapid_file;
|
||||||
new_mapid = app_get_map_index(models, v);
|
else if (v < mapid_global){
|
||||||
if (new_mapid < models->user_map_count) file->settings.base_map_id = v;
|
new_mapid = app_get_map_index(models, v);
|
||||||
else file->settings.base_map_id = mapid_file;
|
if (new_mapid < models->user_map_count) file->settings.base_map_id = v;
|
||||||
|
else file->settings.base_map_id = mapid_file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
|
@ -2405,8 +2391,7 @@ extern "C"{
|
||||||
if (file){
|
if (file){
|
||||||
result = 1;
|
result = 1;
|
||||||
if (file != vptr->file_data.file){
|
if (file != vptr->file_data.file){
|
||||||
view_set_file(vptr, file, models, cmd->system,
|
view_set_file(vptr, file, models, cmd->system);
|
||||||
models->hooks[hook_open_file], &app_links);
|
|
||||||
view_show_file(vptr, 0);
|
view_show_file(vptr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2535,58 +2520,58 @@ command_caller(Coroutine *coroutine){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
app_links_init(System_Functions *system, void *data, int size){
|
app_links_init(System_Functions *system, Application_Links *app_links, void *data, int size){
|
||||||
app_links.memory = data;
|
app_links->memory = data;
|
||||||
app_links.memory_size = size;
|
app_links->memory_size = size;
|
||||||
|
|
||||||
app_links.exec_command_keep_stack = external_exec_command_keep_stack;
|
app_links->exec_command_keep_stack = external_exec_command_keep_stack;
|
||||||
app_links.push_parameter = external_push_parameter;
|
app_links->push_parameter = external_push_parameter;
|
||||||
app_links.push_memory = external_push_memory;
|
app_links->push_memory = external_push_memory;
|
||||||
app_links.clear_parameters = external_clear_parameters;
|
app_links->clear_parameters = external_clear_parameters;
|
||||||
|
|
||||||
app_links.directory_get_hot = external_directory_get_hot;
|
app_links->directory_get_hot = external_directory_get_hot;
|
||||||
app_links.file_exists = system->file_exists;
|
app_links->file_exists = system->file_exists;
|
||||||
app_links.directory_cd = system->directory_cd;
|
app_links->directory_cd = system->directory_cd;
|
||||||
app_links.get_file_list = external_get_file_list;
|
app_links->get_file_list = external_get_file_list;
|
||||||
app_links.free_file_list = external_free_file_list;
|
app_links->free_file_list = external_free_file_list;
|
||||||
|
|
||||||
app_links.get_buffer_first = external_get_buffer_first;
|
app_links->get_buffer_first = external_get_buffer_first;
|
||||||
app_links.get_buffer_next = external_get_buffer_next;
|
app_links->get_buffer_next = external_get_buffer_next;
|
||||||
|
|
||||||
app_links.get_buffer = external_get_buffer;
|
app_links->get_buffer = external_get_buffer;
|
||||||
app_links.get_active_buffer = external_get_active_buffer;
|
app_links->get_active_buffer = external_get_active_buffer;
|
||||||
app_links.get_parameter_buffer = external_get_parameter_buffer;
|
app_links->get_parameter_buffer = external_get_parameter_buffer;
|
||||||
app_links.get_buffer_by_name = external_get_buffer_by_name;
|
app_links->get_buffer_by_name = external_get_buffer_by_name;
|
||||||
|
|
||||||
app_links.refresh_buffer = external_refresh_buffer;
|
app_links->refresh_buffer = external_refresh_buffer;
|
||||||
app_links.buffer_seek_delimiter = external_buffer_seek_delimiter;
|
app_links->buffer_seek_delimiter = external_buffer_seek_delimiter;
|
||||||
app_links.buffer_seek_string = external_buffer_seek_string;
|
app_links->buffer_seek_string = external_buffer_seek_string;
|
||||||
app_links.buffer_seek_string_insensitive = external_buffer_seek_string_insensitive;
|
app_links->buffer_seek_string_insensitive = external_buffer_seek_string_insensitive;
|
||||||
app_links.buffer_read_range = external_buffer_read_range;
|
app_links->buffer_read_range = external_buffer_read_range;
|
||||||
app_links.buffer_replace_range = external_buffer_replace_range;
|
app_links->buffer_replace_range = external_buffer_replace_range;
|
||||||
|
|
||||||
app_links.get_view_first = external_get_view_first;
|
app_links->get_view_first = external_get_view_first;
|
||||||
app_links.get_view_next = external_get_view_next;
|
app_links->get_view_next = external_get_view_next;
|
||||||
|
|
||||||
app_links.get_view = external_get_view;
|
app_links->get_view = external_get_view;
|
||||||
app_links.get_active_view = external_get_active_view;
|
app_links->get_active_view = external_get_active_view;
|
||||||
|
|
||||||
app_links.refresh_view = external_refresh_view;
|
app_links->refresh_view = external_refresh_view;
|
||||||
app_links.view_set_cursor = external_view_set_cursor;
|
app_links->view_set_cursor = external_view_set_cursor;
|
||||||
app_links.view_set_mark = external_view_set_mark;
|
app_links->view_set_mark = external_view_set_mark;
|
||||||
app_links.view_set_highlight = external_view_set_highlight;
|
app_links->view_set_highlight = external_view_set_highlight;
|
||||||
app_links.view_set_buffer = external_view_set_buffer;
|
app_links->view_set_buffer = external_view_set_buffer;
|
||||||
|
|
||||||
app_links.get_user_input = external_get_user_input;
|
app_links->get_user_input = external_get_user_input;
|
||||||
app_links.get_command_input = external_get_command_input;
|
app_links->get_command_input = external_get_command_input;
|
||||||
|
|
||||||
app_links.start_query_bar = external_start_query_bar;
|
app_links->start_query_bar = external_start_query_bar;
|
||||||
app_links.end_query_bar = external_end_query_bar;
|
app_links->end_query_bar = external_end_query_bar;
|
||||||
app_links.print_message = external_print_message;
|
app_links->print_message = external_print_message;
|
||||||
|
|
||||||
app_links.change_theme = external_change_theme;
|
app_links->change_theme = external_change_theme;
|
||||||
app_links.change_font = external_change_font;
|
app_links->change_font = external_change_font;
|
||||||
app_links.set_theme_colors = external_set_theme_colors;
|
app_links->set_theme_colors = external_set_theme_colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
@ -3123,13 +3108,13 @@ App_Init_Sig(app_init){
|
||||||
i32 panel_max_count;
|
i32 panel_max_count;
|
||||||
i32 divider_max_count;
|
i32 divider_max_count;
|
||||||
|
|
||||||
app_links_init(system, memory->user_memory, memory->user_memory_size);
|
|
||||||
|
|
||||||
vars = (App_Vars*)memory->vars_memory;
|
vars = (App_Vars*)memory->vars_memory;
|
||||||
models = &vars->models;
|
models = &vars->models;
|
||||||
|
|
||||||
|
app_links_init(system, &models->app_links, memory->user_memory, memory->user_memory_size);
|
||||||
|
|
||||||
models->config_api = api;
|
models->config_api = api;
|
||||||
app_links.cmd_context = &vars->command_data;
|
models->app_links.cmd_context = &vars->command_data;
|
||||||
|
|
||||||
partition = &models->mem.part;
|
partition = &models->mem.part;
|
||||||
target->partition = partition;
|
target->partition = partition;
|
||||||
|
@ -3195,14 +3180,14 @@ App_Init_Sig(app_init){
|
||||||
global = &models->map_top;
|
global = &models->map_top;
|
||||||
Assert(models->config_api.get_bindings != 0);
|
Assert(models->config_api.get_bindings != 0);
|
||||||
|
|
||||||
wanted_size = models->config_api.get_bindings(app_links.memory, app_links.memory_size);
|
wanted_size = models->config_api.get_bindings(models->app_links.memory, models->app_links.memory_size);
|
||||||
|
|
||||||
if (wanted_size <= app_links.memory_size){
|
if (wanted_size <= models->app_links.memory_size){
|
||||||
Command_Map *map_ptr = 0;
|
Command_Map *map_ptr = 0;
|
||||||
Binding_Unit *unit, *end;
|
Binding_Unit *unit, *end;
|
||||||
i32 user_map_count;
|
i32 user_map_count;
|
||||||
|
|
||||||
unit = (Binding_Unit*)app_links.memory;
|
unit = (Binding_Unit*)models->app_links.memory;
|
||||||
if (unit->type == unit_header && unit->header.error == 0){
|
if (unit->type == unit_header && unit->header.error == 0){
|
||||||
end = unit + unit->header.total_size;
|
end = unit + unit->header.total_size;
|
||||||
|
|
||||||
|
@ -3306,7 +3291,7 @@ App_Init_Sig(app_init){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(app_links.memory, 0, wanted_size);
|
memset(models->app_links.memory, 0, wanted_size);
|
||||||
if (!did_top) setup_top_commands(&models->map_top, &models->mem.part, global);
|
if (!did_top) setup_top_commands(&models->map_top, &models->mem.part, global);
|
||||||
if (!did_file) setup_file_commands(&models->map_file, &models->mem.part, global);
|
if (!did_file) setup_file_commands(&models->map_file, &models->mem.part, global);
|
||||||
|
|
||||||
|
@ -3667,7 +3652,7 @@ App_Step_Sig(app_step){
|
||||||
models->message_buffer = file;
|
models->message_buffer = file;
|
||||||
|
|
||||||
if (models->hooks[hook_start]){
|
if (models->hooks[hook_start]){
|
||||||
models->hooks[hook_start](&app_links);
|
models->hooks[hook_start](&models->app_links);
|
||||||
cmd->part.pos = 0;
|
cmd->part.pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4374,14 +4359,14 @@ App_Step_Sig(app_step){
|
||||||
|
|
||||||
View *view = panel->view;
|
View *view = panel->view;
|
||||||
|
|
||||||
view_set_file(view, file, models, system, models->hooks[hook_open_file], &app_links);
|
view_set_file(view, file, models, system);
|
||||||
view_show_file(view, 0);
|
view_show_file(view, 0);
|
||||||
view->map = app_get_map(models, file->settings.base_map_id);
|
view->map = app_get_map(models, file->settings.base_map_id);
|
||||||
|
|
||||||
Hook_Function *new_file_fnc = models->hooks[hook_new_file];
|
Hook_Function *new_file_fnc = models->hooks[hook_new_file];
|
||||||
if (new_file_fnc){
|
if (new_file_fnc){
|
||||||
models->buffer_param_indices[models->buffer_param_count++] = file->id.id;
|
models->buffer_param_indices[models->buffer_param_count++] = file->id.id;
|
||||||
new_file_fnc(&app_links);
|
new_file_fnc(&models->app_links);
|
||||||
models->buffer_param_count = 0;
|
models->buffer_param_count = 0;
|
||||||
file->settings.is_initialized = 1;
|
file->settings.is_initialized = 1;
|
||||||
}
|
}
|
||||||
|
@ -4404,8 +4389,7 @@ App_Step_Sig(app_step){
|
||||||
if (file){
|
if (file){
|
||||||
View *view = panel->view;
|
View *view = panel->view;
|
||||||
|
|
||||||
view_set_file(view, file, models, system,
|
view_set_file(view, file, models, system);
|
||||||
models->hooks[hook_open_file], &app_links);
|
|
||||||
view_show_file(view, 0);
|
view_show_file(view, 0);
|
||||||
view->map = app_get_map(models, file->settings.base_map_id);
|
view->map = app_get_map(models, file->settings.base_map_id);
|
||||||
}
|
}
|
||||||
|
@ -4422,8 +4406,7 @@ App_Step_Sig(app_step){
|
||||||
|
|
||||||
if (file && !file->settings.never_kill){
|
if (file && !file->settings.never_kill){
|
||||||
working_set_remove(system, working_set, file->name.source_path);
|
working_set_remove(system, working_set, file->name.source_path);
|
||||||
kill_file(system, exchange, models, file,
|
kill_file(system, exchange, models, file);
|
||||||
models->hooks[hook_open_file], &app_links);
|
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
@ -4452,8 +4435,7 @@ App_Step_Sig(app_step){
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
working_set_remove(system, working_set, file->name.source_path);
|
working_set_remove(system, working_set, file->name.source_path);
|
||||||
kill_file(system, exchange, models, file,
|
kill_file(system, exchange, models, file);
|
||||||
models->hooks[hook_open_file], &app_links);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct Models{
|
||||||
u32 command_coroutine_flags[2];
|
u32 command_coroutine_flags[2];
|
||||||
|
|
||||||
Hook_Function *hooks[hook_type_count];
|
Hook_Function *hooks[hook_type_count];
|
||||||
Application_Links *app;
|
Application_Links app_links;
|
||||||
|
|
||||||
i32 *buffer_param_indices;
|
i32 *buffer_param_indices;
|
||||||
i32 buffer_param_count, buffer_param_max;
|
i32 buffer_param_count, buffer_param_max;
|
||||||
|
|
BIN
4ed_data.ctm
BIN
4ed_data.ctm
Binary file not shown.
|
@ -35,14 +35,7 @@ str_alloc_copy(General_Memory *general, String str){
|
||||||
result.str = (char*)general_memory_allocate(general, result.memory_size, 0);
|
result.str = (char*)general_memory_allocate(general, result.memory_size, 0);
|
||||||
memcpy(result.str, str.str, str.size);
|
memcpy(result.str, str.str, str.size);
|
||||||
result.str[result.size] = 0;
|
result.str[result.size] = 0;
|
||||||
return(result);
|
return(result);}
|
||||||
}
|
|
||||||
|
|
||||||
inline Delayed_Action
|
|
||||||
delayed_action_zero(){
|
|
||||||
Delayed_Action action={(Action_Type)0};
|
|
||||||
return(action);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Delayed_Action*
|
inline Delayed_Action*
|
||||||
delayed_action_(Delay *delay, Action_Type type){
|
delayed_action_(Delay *delay, Action_Type type){
|
||||||
|
@ -52,8 +45,7 @@ delayed_action_(Delay *delay, Action_Type type){
|
||||||
delay->acts = (Delayed_Action*)general_memory_reallocate(delay->general, delay->acts, delay->count*sizeof(Delayed_Action), delay->max*sizeof(Delayed_Action), 0);
|
delay->acts = (Delayed_Action*)general_memory_reallocate(delay->general, delay->acts, delay->count*sizeof(Delayed_Action), delay->max*sizeof(Delayed_Action), 0);
|
||||||
}
|
}
|
||||||
result = delay->acts + delay->count++;
|
result = delay->acts + delay->count++;
|
||||||
|
*result = {};
|
||||||
*result = delayed_action_zero();
|
|
||||||
result->type = type;
|
result->type = type;
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -588,7 +588,21 @@ file_create_from_string(System_Functions *system, Models *models,
|
||||||
}
|
}
|
||||||
|
|
||||||
Hook_Function *open_hook = models->hooks[hook_open_file];
|
Hook_Function *open_hook = models->hooks[hook_open_file];
|
||||||
open_hook(models->app);
|
models->buffer_param_indices[models->buffer_param_count++] = file->id.id;
|
||||||
|
open_hook(&models->app_links);
|
||||||
|
models->buffer_param_count = 0;
|
||||||
|
file->settings.is_initialized = 1;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (file){
|
||||||
|
if (open_hook && file->settings.is_initialized == 0){
|
||||||
|
models->buffer_param_indices[models->buffer_param_count++] = file->id.id;
|
||||||
|
open_hook(app);
|
||||||
|
models->buffer_param_count = 0;
|
||||||
|
file->settings.is_initialized = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
|
@ -1267,10 +1281,7 @@ view_set_file(
|
||||||
View *view, Editing_File *file, Models *models,
|
View *view, Editing_File *file, Models *models,
|
||||||
|
|
||||||
// NOTE(allen): Necessary when file != 0
|
// NOTE(allen): Necessary when file != 0
|
||||||
System_Functions *system, Hook_Function *open_hook, Application_Links *app,
|
System_Functions *system){
|
||||||
|
|
||||||
// other
|
|
||||||
b32 set_vui = 1){
|
|
||||||
|
|
||||||
Font_Info *fnt_info;
|
Font_Info *fnt_info;
|
||||||
|
|
||||||
|
@ -1796,6 +1807,7 @@ file_do_white_batch_edit(System_Functions *system, Models *models, Editing_File
|
||||||
for (; token->start < edit->start && edit->start < token->start + token->size &&
|
for (; token->start < edit->start && edit->start < token->start + token->size &&
|
||||||
token < end_token; ++token){
|
token < end_token; ++token){
|
||||||
token->size += local_shift;
|
token->size += local_shift;
|
||||||
|
token->start += shift_amount;
|
||||||
}
|
}
|
||||||
for (; token->start < edit->start && token < end_token; ++token){
|
for (; token->start < edit->start && token < end_token; ++token){
|
||||||
token->start += shift_amount;
|
token->start += shift_amount;
|
||||||
|
@ -2222,9 +2234,8 @@ view_clean_whitespace(System_Functions *system, Models *models, View *view){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
view_auto_tab_tokens(System_Functions *system,
|
view_auto_tab_tokens(System_Functions *system, Models *models,
|
||||||
Models *models, View *view,
|
View *view, i32 start, i32 end, b32 empty_blank_lines, b32 use_tabs){
|
||||||
i32 start, i32 end, b32 empty_blank_lines, b32 use_tabs){
|
|
||||||
#if BUFFER_EXPERIMENT_SCALPEL <= 0
|
#if BUFFER_EXPERIMENT_SCALPEL <= 0
|
||||||
Editing_File *file = view->file_data.file;
|
Editing_File *file = view->file_data.file;
|
||||||
Mem_Options *mem = &models->mem;
|
Mem_Options *mem = &models->mem;
|
||||||
|
@ -2251,29 +2262,47 @@ view_auto_tab_tokens(System_Functions *system,
|
||||||
Cpp_Token *token, *self_token;
|
Cpp_Token *token, *self_token;
|
||||||
|
|
||||||
{
|
{
|
||||||
i32 start_pos = file->state.buffer.line_starts[line_start];
|
i32 start_pos = buffer->line_starts[line_start];
|
||||||
Cpp_Get_Token_Result result = cpp_get_token(&tokens, start_pos);
|
Cpp_Get_Token_Result result = cpp_get_token(&tokens, start_pos);
|
||||||
token_i = result.token_index;
|
token_i = result.token_index;
|
||||||
if (result.in_whitespace) token_i += 1;
|
if (result.in_whitespace) token_i += 1;
|
||||||
self_token = tokens.tokens + token_i;
|
self_token = tokens.tokens + token_i;
|
||||||
}
|
}
|
||||||
|
|
||||||
i32 line = line_start - 1;
|
// NOTE(allen): This part looks at code before the current code to figure out
|
||||||
for (; line >= 0; --line){
|
// how much to indent the current code.
|
||||||
i32 start = file->state.buffer.line_starts[line];
|
|
||||||
b32 all_whitespace = 0;
|
for (token = self_token; token_i > 0; --token_i, --token){
|
||||||
b32 all_space = 0;
|
switch(token->type){
|
||||||
buffer_find_hard_start(&file->state.buffer, start,
|
case CPP_TOKEN_BRACKET_OPEN:
|
||||||
&all_whitespace, &all_space, ¤t_indent, 4);
|
case CPP_TOKEN_BRACKET_CLOSE:
|
||||||
if (!all_whitespace) break;
|
token_i = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i32 line = 0;
|
||||||
|
{
|
||||||
|
i32 start = 0;
|
||||||
|
b32 all_whitespace = 0, all_space = 0;
|
||||||
|
|
||||||
|
line = buffer_get_line_index(buffer, token->start);
|
||||||
|
start = buffer->line_starts[line];
|
||||||
|
buffer_find_hard_start(buffer, start, &all_whitespace, &all_space, ¤t_indent, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE(allen): It is not clear what this part does...
|
||||||
|
// it looks like it figures out the current token from the line, but
|
||||||
|
// the system now figures out the line from the current token...
|
||||||
|
// All we really need here is to make sure we start on the first
|
||||||
|
// token of the line we want to start at I think.
|
||||||
|
|
||||||
if (line < 0){
|
if (line < 0){
|
||||||
token_i = 0;
|
token_i = 0;
|
||||||
token = tokens.tokens + token_i;
|
token = tokens.tokens + token_i;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
i32 start_pos = file->state.buffer.line_starts[line];
|
i32 start_pos = buffer->line_starts[line];
|
||||||
Cpp_Get_Token_Result result = cpp_get_token(&tokens, start_pos);
|
Cpp_Get_Token_Result result = cpp_get_token(&tokens, start_pos);
|
||||||
token_i = result.token_index;
|
token_i = result.token_index;
|
||||||
if (result.in_whitespace) token_i += 1;
|
if (result.in_whitespace) token_i += 1;
|
||||||
|
@ -2290,51 +2319,74 @@ view_auto_tab_tokens(System_Functions *system,
|
||||||
current_indent = 0;
|
current_indent = 0;
|
||||||
}
|
}
|
||||||
else if (token->start < start_pos){
|
else if (token->start < start_pos){
|
||||||
line = buffer_get_line_index(&file->state.buffer, token->start);
|
line = buffer_get_line_index(buffer, token->start);
|
||||||
i32 start = file->state.buffer.line_starts[line];
|
i32 start = buffer->line_starts[line];
|
||||||
b32 all_whitespace = 0;
|
b32 all_whitespace = 0;
|
||||||
b32 all_space = 0;
|
b32 all_space = 0;
|
||||||
buffer_find_hard_start(&file->state.buffer, start,
|
buffer_find_hard_start(buffer, start, &all_whitespace, &all_space, ¤t_indent, 4);
|
||||||
&all_whitespace, &all_space, ¤t_indent, 4);
|
|
||||||
Assert(!all_whitespace);
|
Assert(!all_whitespace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
indent_marks -= line_start;
|
indent_marks -= line_start;
|
||||||
i32 line_i = line_start;
|
i32 line_i = line_start;
|
||||||
i32 next_line_start = file->state.buffer.line_starts[line_i];
|
i32 next_line_start = buffer->line_starts[line_i];
|
||||||
switch (token->type){
|
switch (token->type){
|
||||||
case CPP_TOKEN_BRACKET_OPEN: current_indent += 4; break;
|
case CPP_TOKEN_BRACKET_OPEN: current_indent += 4; break;
|
||||||
case CPP_TOKEN_PARENTHESE_OPEN: current_indent += 4; break;
|
case CPP_TOKEN_PARENTHESE_OPEN: current_indent += 4; break;
|
||||||
case CPP_TOKEN_BRACE_OPEN: current_indent += 4; break;
|
case CPP_TOKEN_BRACE_OPEN: current_indent += 4; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cpp_Token *prev_token = token;
|
Cpp_Token T;
|
||||||
|
Cpp_Token prev_token = *token;
|
||||||
++token;
|
++token;
|
||||||
for (; line_i < line_end; ++token_i, ++token){
|
|
||||||
for (; token->start >= next_line_start && line_i < line_end;){
|
for (; line_i < line_end; ++token){
|
||||||
|
if (token < tokens.tokens + tokens.count){
|
||||||
|
T = *token;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
T.type = CPP_TOKEN_EOF;
|
||||||
|
T.start = buffer_size(buffer);
|
||||||
|
T.flags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; T.start >= next_line_start && line_i < line_end;){
|
||||||
i32 this_line_start = next_line_start;
|
i32 this_line_start = next_line_start;
|
||||||
next_line_start = file->state.buffer.line_starts[line_i+1];
|
if (line_i+1 < buffer->line_count){
|
||||||
|
next_line_start = buffer->line_starts[line_i+1];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
next_line_start = buffer_size(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
i32 this_indent;
|
i32 this_indent;
|
||||||
if (prev_token && prev_token->type == CPP_TOKEN_COMMENT &&
|
if (prev_token.type == CPP_TOKEN_COMMENT &&
|
||||||
prev_token->start <= this_line_start && prev_token->start + prev_token->size > this_line_start){
|
prev_token.start <= this_line_start && prev_token.start + prev_token.size > this_line_start){
|
||||||
this_indent = -1;
|
if (line_i > 0){
|
||||||
|
this_indent = indent_marks[line_i-1];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this_indent = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this_indent = current_indent;
|
this_indent = current_indent;
|
||||||
if (token->start < next_line_start){
|
if (T.start < next_line_start){
|
||||||
if (token->flags & CPP_TFLAG_PP_DIRECTIVE) this_indent = 0;
|
if (T.flags & CPP_TFLAG_PP_DIRECTIVE){
|
||||||
|
this_indent = 0;
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
switch (token->type){
|
switch (T.type){
|
||||||
case CPP_TOKEN_BRACKET_CLOSE: this_indent -= 4; break;
|
case CPP_TOKEN_BRACKET_CLOSE: this_indent -= 4; break;
|
||||||
case CPP_TOKEN_PARENTHESE_CLOSE: this_indent -= 4; break;
|
case CPP_TOKEN_PARENTHESE_CLOSE: this_indent -= 4; break;
|
||||||
case CPP_TOKEN_BRACE_CLOSE: this_indent -= 4; break;
|
case CPP_TOKEN_BRACE_CLOSE: this_indent -= 4; break;
|
||||||
case CPP_TOKEN_BRACE_OPEN: break;
|
case CPP_TOKEN_BRACE_OPEN: break;
|
||||||
default:
|
default:
|
||||||
if (current_indent > 0 && prev_token){
|
if (current_indent > 0){
|
||||||
if (!(prev_token->flags & CPP_TFLAG_PP_BODY ||
|
if (!(prev_token.flags & CPP_TFLAG_PP_BODY ||
|
||||||
prev_token->flags & CPP_TFLAG_PP_DIRECTIVE)){
|
prev_token.flags & CPP_TFLAG_PP_DIRECTIVE)){
|
||||||
switch (prev_token->type){
|
switch (prev_token.type){
|
||||||
case CPP_TOKEN_BRACKET_OPEN: case CPP_TOKEN_PARENTHESE_OPEN:
|
case CPP_TOKEN_BRACKET_OPEN: case CPP_TOKEN_PARENTHESE_OPEN:
|
||||||
case CPP_TOKEN_BRACE_OPEN: case CPP_TOKEN_BRACE_CLOSE:
|
case CPP_TOKEN_BRACE_OPEN: case CPP_TOKEN_BRACE_CLOSE:
|
||||||
case CPP_TOKEN_SEMICOLON: case CPP_TOKEN_COLON: break;
|
case CPP_TOKEN_SEMICOLON: case CPP_TOKEN_COLON: break;
|
||||||
|
@ -2352,7 +2404,7 @@ view_auto_tab_tokens(System_Functions *system,
|
||||||
++line_i;
|
++line_i;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (token->type){
|
switch (T.type){
|
||||||
case CPP_TOKEN_BRACKET_OPEN: current_indent += 4; break;
|
case CPP_TOKEN_BRACKET_OPEN: current_indent += 4; break;
|
||||||
case CPP_TOKEN_BRACKET_CLOSE: current_indent -= 4; break;
|
case CPP_TOKEN_BRACKET_CLOSE: current_indent -= 4; break;
|
||||||
case CPP_TOKEN_PARENTHESE_OPEN: current_indent += 4; break;
|
case CPP_TOKEN_PARENTHESE_OPEN: current_indent += 4; break;
|
||||||
|
@ -2360,7 +2412,7 @@ view_auto_tab_tokens(System_Functions *system,
|
||||||
case CPP_TOKEN_BRACE_OPEN: current_indent += 4; break;
|
case CPP_TOKEN_BRACE_OPEN: current_indent += 4; break;
|
||||||
case CPP_TOKEN_BRACE_CLOSE: current_indent -= 4; break;
|
case CPP_TOKEN_BRACE_CLOSE: current_indent -= 4; break;
|
||||||
}
|
}
|
||||||
prev_token = token;
|
prev_token = T;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2369,14 +2421,14 @@ view_auto_tab_tokens(System_Functions *system,
|
||||||
char *str_base = (char*)part->base + part->pos;
|
char *str_base = (char*)part->base + part->pos;
|
||||||
i32 str_size = 0;
|
i32 str_size = 0;
|
||||||
for (i32 line_i = line_start; line_i < line_end; ++line_i){
|
for (i32 line_i = line_start; line_i < line_end; ++line_i){
|
||||||
i32 start = file->state.buffer.line_starts[line_i];
|
i32 start = buffer->line_starts[line_i];
|
||||||
i32 preferred_indentation;
|
i32 preferred_indentation;
|
||||||
i32 correct_indentation;
|
i32 correct_indentation;
|
||||||
b32 all_whitespace = 0;
|
b32 all_whitespace = 0;
|
||||||
b32 all_space = 0;
|
b32 all_space = 0;
|
||||||
i32 tab_width = 4;
|
i32 tab_width = 4;
|
||||||
i32 hard_start =
|
i32 hard_start =
|
||||||
buffer_find_hard_start(&file->state.buffer, start, &all_whitespace, &all_space,
|
buffer_find_hard_start(buffer, start, &all_whitespace, &all_space,
|
||||||
&preferred_indentation, tab_width);
|
&preferred_indentation, tab_width);
|
||||||
|
|
||||||
correct_indentation = indent_marks[line_i];
|
correct_indentation = indent_marks[line_i];
|
||||||
|
@ -2427,7 +2479,7 @@ view_auto_tab_tokens(System_Functions *system,
|
||||||
i32 preferred_indentation;
|
i32 preferred_indentation;
|
||||||
i32 start = view->file_data.cursor.pos;
|
i32 start = view->file_data.cursor.pos;
|
||||||
i32 hard_start = buffer_find_hard_start(
|
i32 hard_start = buffer_find_hard_start(
|
||||||
&file->state.buffer, start, &all_whitespace, &all_space,
|
buffer, start, &all_whitespace, &all_space,
|
||||||
&preferred_indentation, 4);
|
&preferred_indentation, 4);
|
||||||
|
|
||||||
view_cursor_move(view, hard_start);
|
view_cursor_move(view, hard_start);
|
||||||
|
@ -4650,11 +4702,8 @@ do_render_file_view(System_Functions *system, Exchange *exchange,
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(allen): Passing this hook and app pointer is a hack. It can go as soon as we start
|
|
||||||
// initializing files independently of setting them to views.
|
|
||||||
internal void
|
internal void
|
||||||
kill_file(System_Functions *system, Exchange *exchange, Models *models, Editing_File *file,
|
kill_file(System_Functions *system, Exchange *exchange, Models *models, Editing_File *file){
|
||||||
Hook_Function *open_hook, Application_Links *app){
|
|
||||||
File_Node *node, *used;
|
File_Node *node, *used;
|
||||||
|
|
||||||
file_close(system, &models->mem.general, file);
|
file_close(system, &models->mem.general, file);
|
||||||
|
@ -4668,12 +4717,12 @@ kill_file(System_Functions *system, Exchange *exchange, Models *models, Editing_
|
||||||
iter = file_view_iter_next(iter)){
|
iter = file_view_iter_next(iter)){
|
||||||
if (node != used){
|
if (node != used){
|
||||||
iter.view->file_data.file = 0;
|
iter.view->file_data.file = 0;
|
||||||
view_set_file(iter.view, (Editing_File*)node, models, system, open_hook, app, 0);
|
view_set_file(iter.view, (Editing_File*)node, models, system);
|
||||||
node = node->next;
|
node = node->next;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
iter.view->file_data.file = 0;
|
iter.view->file_data.file = 0;
|
||||||
view_set_file(iter.view, 0, models, system, open_hook, app, 0);
|
view_set_file(iter.view, 0, models, system);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
/*
|
|
||||||
* Mr. 4th Dimention - Allen Webster
|
|
||||||
*
|
|
||||||
* 16.11.2014
|
|
||||||
*
|
|
||||||
* Keyboard layer for 4coder
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TOP
|
|
||||||
|
|
||||||
globalvar u8 keycode_lookup_table[255];
|
|
||||||
|
|
||||||
inline u8
|
|
||||||
keycode_lookup(u8 system_code){
|
|
||||||
return keycode_lookup_table[system_code];
|
|
||||||
}
|
|
||||||
|
|
||||||
// BOTTOM
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* Mr. 4th Dimention - Allen Webster
|
|
||||||
*
|
|
||||||
* 12.17.2014
|
|
||||||
*
|
|
||||||
* Win32-US Keyboard layer for 4coder
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TOP
|
|
||||||
|
|
||||||
#include "4ed_keyboard.cpp"
|
|
||||||
|
|
||||||
internal void
|
|
||||||
keycode_init(){
|
|
||||||
keycode_lookup_table[VK_BACK] = key_back;
|
|
||||||
keycode_lookup_table[VK_DELETE] = key_del;
|
|
||||||
keycode_lookup_table[VK_UP] = key_up;
|
|
||||||
keycode_lookup_table[VK_DOWN] = key_down;
|
|
||||||
keycode_lookup_table[VK_LEFT] = key_left;
|
|
||||||
keycode_lookup_table[VK_RIGHT] = key_right;
|
|
||||||
keycode_lookup_table[VK_INSERT] = key_insert;
|
|
||||||
keycode_lookup_table[VK_HOME] = key_home;
|
|
||||||
keycode_lookup_table[VK_END] = key_end;
|
|
||||||
keycode_lookup_table[VK_PRIOR] = key_page_up;
|
|
||||||
keycode_lookup_table[VK_NEXT] = key_page_down;
|
|
||||||
keycode_lookup_table[VK_ESCAPE] = key_esc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BOTTOM
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Distribution Date: 13.5.2016 (dd.mm.yyyy)
|
Distribution Date: 14.5.2016 (dd.mm.yyyy)
|
||||||
|
|
||||||
Thank you for contributing to the 4coder project!
|
Thank you for contributing to the 4coder project!
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Distribution Date: 13.5.2016 (dd.mm.yyyy)
|
Distribution Date: 14.5.2016 (dd.mm.yyyy)
|
||||||
|
|
||||||
Thank you for contributing to the 4coder project!
|
Thank you for contributing to the 4coder project!
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ buffer_replace_range(Buffer *buffer, int start, int end, char *str, int len, int
|
||||||
|
|
||||||
internal_4tech int
|
internal_4tech int
|
||||||
buffer_batch_edit_step(Buffer_Batch_State *state, Buffer *buffer, Buffer_Edit *sorted_edits,
|
buffer_batch_edit_step(Buffer_Batch_State *state, Buffer *buffer, Buffer_Edit *sorted_edits,
|
||||||
char *strings, int edit_count, void *scratch, int scratch_size, int *request_amount){
|
char *strings, int edit_count, void *scratch, int scratch_size, int *request_amount){
|
||||||
Buffer_Edit *edit;
|
Buffer_Edit *edit;
|
||||||
int i, result;
|
int i, result;
|
||||||
int shift_total, shift_amount;
|
int shift_total, shift_amount;
|
||||||
|
@ -203,7 +203,7 @@ buffer_batch_edit_step(Buffer_Batch_State *state, Buffer *buffer, Buffer_Edit *s
|
||||||
|
|
||||||
edit = sorted_edits + i;
|
edit = sorted_edits + i;
|
||||||
for (; i < edit_count; ++i, ++edit){
|
for (; i < edit_count; ++i, ++edit){
|
||||||
assert(edit->end + shift_total < buffer_size(buffer));
|
assert(edit->end + shift_total <= buffer_size(buffer));
|
||||||
result = buffer_replace_range(buffer, edit->start + shift_total, edit->end + shift_total,
|
result = buffer_replace_range(buffer, edit->start + shift_total, edit->end + shift_total,
|
||||||
strings + edit->str_start, edit->len, &shift_amount,
|
strings + edit->str_start, edit->len, &shift_amount,
|
||||||
scratch, scratch_size, request_amount);
|
scratch, scratch_size, request_amount);
|
||||||
|
|
|
@ -1198,6 +1198,31 @@ Win32RedrawScreen(HDC hdc){
|
||||||
SwapBuffers(hdc);
|
SwapBuffers(hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE(allen): Old contents of 4ed_keyboard.cpp
|
||||||
|
globalvar u8 keycode_lookup_table[255];
|
||||||
|
|
||||||
|
inline u8
|
||||||
|
keycode_lookup(u8 system_code){
|
||||||
|
return keycode_lookup_table[system_code];
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE(allen): Old contents of 4ed_win32_keyboard.cpp
|
||||||
|
internal void
|
||||||
|
keycode_init(){
|
||||||
|
keycode_lookup_table[VK_BACK] = key_back;
|
||||||
|
keycode_lookup_table[VK_DELETE] = key_del;
|
||||||
|
keycode_lookup_table[VK_UP] = key_up;
|
||||||
|
keycode_lookup_table[VK_DOWN] = key_down;
|
||||||
|
keycode_lookup_table[VK_LEFT] = key_left;
|
||||||
|
keycode_lookup_table[VK_RIGHT] = key_right;
|
||||||
|
keycode_lookup_table[VK_INSERT] = key_insert;
|
||||||
|
keycode_lookup_table[VK_HOME] = key_home;
|
||||||
|
keycode_lookup_table[VK_END] = key_end;
|
||||||
|
keycode_lookup_table[VK_PRIOR] = key_page_up;
|
||||||
|
keycode_lookup_table[VK_NEXT] = key_page_down;
|
||||||
|
keycode_lookup_table[VK_ESCAPE] = key_esc;
|
||||||
|
}
|
||||||
|
|
||||||
internal LRESULT
|
internal LRESULT
|
||||||
Win32Callback(HWND hwnd, UINT uMsg,
|
Win32Callback(HWND hwnd, UINT uMsg,
|
||||||
WPARAM wParam, LPARAM lParam){
|
WPARAM wParam, LPARAM lParam){
|
||||||
|
@ -1325,10 +1350,12 @@ Win32Callback(HWND hwnd, UINT uMsg,
|
||||||
// control+alt is used to signal AltGr for important keys.
|
// control+alt is used to signal AltGr for important keys.
|
||||||
if (result1 && result2){
|
if (result1 && result2){
|
||||||
char c1 = char_to_upper((char)x1);
|
char c1 = char_to_upper((char)x1);
|
||||||
char c2 = char_to_upper((char)x2);
|
|
||||||
char cParam = char_to_upper((char)wParam);
|
char cParam = char_to_upper((char)wParam);
|
||||||
|
|
||||||
if (c1 != cParam && c2 == cParam){
|
if ((c1 == '\n' || c1 == '\r') && cParam != VK_RETURN){
|
||||||
|
result1 = 0;
|
||||||
|
}
|
||||||
|
if (c1 == '\t' && cParam != VK_TAB){
|
||||||
result1 = 0;
|
result1 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue