fixed small issues discovered after 4.0.21 release

master
Allen Webster 2017-06-28 11:15:54 -04:00
parent 9564dbe25d
commit 7a94942242
11 changed files with 1302 additions and 1272 deletions

View File

@ -11,6 +11,7 @@ struct Application_Links;
#define GET_BUFFER_NEXT_SIG(n) void n(Application_Links *app, Buffer_Summary *buffer, Access_Flag access)
#define GET_BUFFER_SIG(n) Buffer_Summary n(Application_Links *app, Buffer_ID buffer_id, Access_Flag access)
#define GET_BUFFER_BY_NAME_SIG(n) Buffer_Summary n(Application_Links *app, char *name, int32_t len, Access_Flag access)
#define GET_BUFFER_BY_FILE_NAME_SIG(n) Buffer_Summary n(Application_Links *app, char *name, int32_t len, Access_Flag access)
#define BUFFER_READ_RANGE_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *out)
#define BUFFER_REPLACE_RANGE_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *str, int32_t len)
#define BUFFER_COMPUTE_CURSOR_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, Buffer_Seek seek, Partial_Cursor *cursor_out)
@ -88,6 +89,7 @@ typedef GET_BUFFER_FIRST_SIG(Get_Buffer_First_Function);
typedef GET_BUFFER_NEXT_SIG(Get_Buffer_Next_Function);
typedef GET_BUFFER_SIG(Get_Buffer_Function);
typedef GET_BUFFER_BY_NAME_SIG(Get_Buffer_By_Name_Function);
typedef GET_BUFFER_BY_FILE_NAME_SIG(Get_Buffer_By_File_Name_Function);
typedef BUFFER_READ_RANGE_SIG(Buffer_Read_Range_Function);
typedef BUFFER_REPLACE_RANGE_SIG(Buffer_Replace_Range_Function);
typedef BUFFER_COMPUTE_CURSOR_SIG(Buffer_Compute_Cursor_Function);
@ -167,6 +169,7 @@ Get_Buffer_First_Function *get_buffer_first;
Get_Buffer_Next_Function *get_buffer_next;
Get_Buffer_Function *get_buffer;
Get_Buffer_By_Name_Function *get_buffer_by_name;
Get_Buffer_By_File_Name_Function *get_buffer_by_file_name;
Buffer_Read_Range_Function *buffer_read_range;
Buffer_Replace_Range_Function *buffer_replace_range;
Buffer_Compute_Cursor_Function *buffer_compute_cursor;
@ -245,6 +248,7 @@ Get_Buffer_First_Function *get_buffer_first_;
Get_Buffer_Next_Function *get_buffer_next_;
Get_Buffer_Function *get_buffer_;
Get_Buffer_By_Name_Function *get_buffer_by_name_;
Get_Buffer_By_File_Name_Function *get_buffer_by_file_name_;
Buffer_Read_Range_Function *buffer_read_range_;
Buffer_Replace_Range_Function *buffer_replace_range_;
Buffer_Compute_Cursor_Function *buffer_compute_cursor_;
@ -331,6 +335,7 @@ app_links->get_buffer_first_ = Get_Buffer_First;\
app_links->get_buffer_next_ = Get_Buffer_Next;\
app_links->get_buffer_ = Get_Buffer;\
app_links->get_buffer_by_name_ = Get_Buffer_By_Name;\
app_links->get_buffer_by_file_name_ = Get_Buffer_By_File_Name;\
app_links->buffer_read_range_ = Buffer_Read_Range;\
app_links->buffer_replace_range_ = Buffer_Replace_Range;\
app_links->buffer_compute_cursor_ = Buffer_Compute_Cursor;\
@ -409,6 +414,7 @@ static inline Buffer_Summary get_buffer_first(Application_Links *app, Access_Fla
static inline void get_buffer_next(Application_Links *app, Buffer_Summary *buffer, Access_Flag access){(app->get_buffer_next(app, buffer, access));}
static inline Buffer_Summary get_buffer(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer(app, buffer_id, access));}
static inline Buffer_Summary get_buffer_by_name(Application_Links *app, char *name, int32_t len, Access_Flag access){return(app->get_buffer_by_name(app, name, len, access));}
static inline Buffer_Summary get_buffer_by_file_name(Application_Links *app, char *name, int32_t len, Access_Flag access){return(app->get_buffer_by_file_name(app, name, len, access));}
static inline bool32 buffer_read_range(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *out){return(app->buffer_read_range(app, buffer, start, end, out));}
static inline bool32 buffer_replace_range(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *str, int32_t len){return(app->buffer_replace_range(app, buffer, start, end, str, len));}
static inline bool32 buffer_compute_cursor(Application_Links *app, Buffer_Summary *buffer, Buffer_Seek seek, Partial_Cursor *cursor_out){return(app->buffer_compute_cursor(app, buffer, seek, cursor_out));}
@ -487,6 +493,7 @@ static inline Buffer_Summary get_buffer_first(Application_Links *app, Access_Fla
static inline void get_buffer_next(Application_Links *app, Buffer_Summary *buffer, Access_Flag access){(app->get_buffer_next_(app, buffer, access));}
static inline Buffer_Summary get_buffer(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer_(app, buffer_id, access));}
static inline Buffer_Summary get_buffer_by_name(Application_Links *app, char *name, int32_t len, Access_Flag access){return(app->get_buffer_by_name_(app, name, len, access));}
static inline Buffer_Summary get_buffer_by_file_name(Application_Links *app, char *name, int32_t len, Access_Flag access){return(app->get_buffer_by_file_name_(app, name, len, access));}
static inline bool32 buffer_read_range(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *out){return(app->buffer_read_range_(app, buffer, start, end, out));}
static inline bool32 buffer_replace_range(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *str, int32_t len){return(app->buffer_replace_range_(app, buffer, start, end, str, len));}
static inline bool32 buffer_compute_cursor(Application_Links *app, Buffer_Summary *buffer, Buffer_Seek seek, Partial_Cursor *cursor_out){return(app->buffer_compute_cursor_(app, buffer, seek, cursor_out));}

View File

@ -1,6 +1,6 @@
#define MAJOR 4
#define MINOR 0
#define PATCH 21
#define PATCH 22
// string
#define VN__(a,b,c) #a"."#b"."#c

View File

@ -104,8 +104,7 @@ make_batch_from_indent_marks(Application_Links *app, Partition *part, Buffer_Sum
for (int32_t line_i = line_start; line_i < line_end; ++line_i){
int32_t line_start_pos = buffer_get_line_start(app, buffer, line_i);
Hard_Start_Result hard_start =
buffer_find_hard_start(app, buffer, line_start_pos, opts.tab_width);
Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, line_start_pos, opts.tab_width);
int32_t correct_indentation = indent_marks[line_i];
if (hard_start.all_whitespace && opts.empty_blank_lines){
@ -158,8 +157,7 @@ make_batch_from_indent_marks(Application_Links *app, Partition *part, Buffer_Sum
static void
set_line_indents(Application_Links *app, Partition *part, Buffer_Summary *buffer, int32_t line_start, int32_t line_end, int32_t *indent_marks, Indent_Options opts){
Buffer_Batch_Edit batch =
make_batch_from_indent_marks(app, part, buffer, line_start, line_end, indent_marks, opts);
Buffer_Batch_Edit batch = make_batch_from_indent_marks(app, part, buffer, line_start, line_end, indent_marks, opts);
if (batch.edit_count > 0){
buffer_batch_edit(app, buffer, batch.str, batch.str_len, batch.edits, batch.edit_count, BatchEdit_PreserveTokens);
@ -252,27 +250,29 @@ find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Arra
}
out_of_loop2:;
Cpp_Token_Type open_type = CPP_TOKEN_JUNK;
Cpp_Token_Type close_type = CPP_TOKEN_JUNK;
switch (close){
case 0: token = start_token; found_safe_start_position = 1; break;
case 0: token = start_token; found_safe_start_position = true; break;
case CPP_TOKEN_PARENTHESE_CLOSE:
token = seek_matching_token_backwards(tokens, token-1,
CPP_TOKEN_PARENTHESE_OPEN,
CPP_TOKEN_PARENTHESE_CLOSE);
open_type = CPP_TOKEN_PARENTHESE_OPEN;
close_type = CPP_TOKEN_PARENTHESE_CLOSE;
break;
case CPP_TOKEN_BRACKET_CLOSE:
token = seek_matching_token_backwards(tokens, token-1,
CPP_TOKEN_BRACKET_OPEN,
CPP_TOKEN_BRACKET_CLOSE);
open_type = CPP_TOKEN_BRACKET_OPEN;
close_type = CPP_TOKEN_BRACKET_CLOSE;
break;
case CPP_TOKEN_BRACE_CLOSE:
token = seek_matching_token_backwards(tokens, token-1,
CPP_TOKEN_BRACE_OPEN,
CPP_TOKEN_BRACE_CLOSE);
open_type = CPP_TOKEN_BRACE_OPEN;
close_type = CPP_TOKEN_BRACE_CLOSE;
break;
}
if (open_type != CPP_TOKEN_JUNK){
token = seek_matching_token_backwards(tokens, token-1, open_type, close_type);
}
}
} while(found_safe_start_position == 0);
*current_indent_out = current_indent;

View File

@ -1047,14 +1047,14 @@ default_4coder_side_by_side_panels(Application_Links *app, char **command_line_f
Buffer_Identifier right = buffer_identifier(literal("*messages*"));
if (file_count > 0){
char *name = command_line_files[0];
int32_t len = str_size(name);
left = buffer_identifier(name, len);
char *left_name = command_line_files[0];
int32_t left_len = str_size(name);
left = buffer_identifier(left_name, left_len);
if (file_count > 1){
char *name = command_line_files[1];
int32_t len = str_size(name);
right = buffer_identifier(name, len);
char *right_name = command_line_files[1];
int32_t right_len = str_size(name);
right = buffer_identifier(right_name, right_len);
}
}

View File

@ -178,19 +178,6 @@ buffer_identifier(Buffer_ID id){
return(identifier);
}
static Buffer_ID
buffer_identifier_to_id(Application_Links *app, Buffer_Identifier identifier){
Buffer_ID id = 0;
if (identifier.id != 0){
id = identifier.id;
}
else{
Buffer_Summary buffer = get_buffer_by_name(app, identifier.name, identifier.name_len, AccessAll);
id = buffer.buffer_id;
}
return(id);
}
static Buffer_Summary
create_buffer(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags){
Buffer_Summary buffer = {0};
@ -346,6 +333,23 @@ open_file(Application_Links *app, Buffer_Summary *buffer_out, char *filename, in
return(result);
}
static Buffer_ID
buffer_identifier_to_id(Application_Links *app, Buffer_Identifier identifier){
Buffer_ID id = 0;
if (identifier.id != 0){
id = identifier.id;
}
else{
Buffer_Summary buffer = get_buffer_by_name(app, identifier.name, identifier.name_len, AccessAll);
id = buffer.buffer_id;
if (id == 0){
buffer = get_buffer_by_file_name(app, identifier.name, identifier.name_len, AccessAll);
id = buffer.buffer_id;
}
}
return(id);
}
static bool32
view_open_file(Application_Links *app, View_Summary *view, char *filename, int32_t filename_len, bool32 never_new){
bool32 result = false;

View File

@ -513,14 +513,14 @@ DOC_SEE(get_buffer_next)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Working_Set *working_set = &cmd->models->working_set;
Buffer_Summary result = {};
Buffer_Summary buffer = {0};
internal_get_buffer_first(working_set, &result);
while (result.exists && !access_test(result.lock_flags, access)){
internal_get_buffer_next(working_set, &result);
internal_get_buffer_first(working_set, &buffer);
while (buffer.exists && !access_test(buffer.lock_flags, access)){
internal_get_buffer_next(working_set, &buffer);
}
return(result);
return(buffer);
}
API_EXPORT void
@ -560,10 +560,10 @@ DOC_SEE(Buffer_ID)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Working_Set *working_set = &cmd->models->working_set;
Buffer_Summary buffer = {};
Buffer_Summary buffer = {0};
Editing_File *file = working_set_get_active_file(working_set, buffer_id);
if (file != 0){
if (file != 0 && !file->is_dummy){
fill_buffer_summary(&buffer, file, working_set);
if (!access_test(buffer.lock_flags, access)){
buffer = null_buffer_summary;
@ -584,11 +584,32 @@ DOC_SEE(Buffer_Summary)
DOC_SEE(Access_Flag)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Buffer_Summary buffer = {};
Buffer_Summary buffer = {0};
Working_Set *working_set = &cmd->models->working_set;
Editing_File *file = working_set_name_contains(working_set, make_string(name, len));
if (file && !file->is_dummy){
if (file != 0 && !file->is_dummy){
fill_buffer_summary(&buffer, file, working_set);
if (!access_test(buffer.lock_flags, access)){
buffer = null_buffer_summary;
}
}
return(buffer);
}
API_EXPORT Buffer_Summary
Get_Buffer_By_File_Name(Application_Links *app, char *name, int32_t len, Access_Flag access){
Command_Data *cmd = (Command_Data*)app->cmd_context;
Buffer_Summary buffer = {0};
System_Functions *system = cmd->system;
Models *models = cmd->models;
Working_Set *working_set = &models->working_set;
String fname = make_string(name, len);
Editing_File_Canon_Name canon = {0};
if (get_canon_name(system, &canon, fname)){
Editing_File *file = working_set_canon_contains(working_set, canon.name);
fill_buffer_summary(&buffer, file, working_set);
if (!access_test(buffer.lock_flags, access)){
buffer = null_buffer_summary;
@ -1238,7 +1259,7 @@ End_Buffer_Creation(Application_Links *app, Buffer_Creation_Data *data)
/*
DOC_PARAM(data, a local user handle for buffer creation that has already been initialized by begin_buffer_creation and used in subsequent buffer creation flags)
DOC_RETURN(returns a summary of the newly created buffer or of the existing buffer that already has the specified name. If there is not enough creation data to make the buffer the returned summary will be null.)
DOC_RETURN(Returns a summary of the newly created buffer or of the existing buffer that already has the specified name. If there is not enough creation data to make the buffer the returned summary will be null.)
DOC_SEE(begin_buffer_creation)
*/{
@ -1253,11 +1274,11 @@ DOC_SEE(begin_buffer_creation)
Buffer_Summary result = {0};
if (data && data->fname_len > 0){
if (data != 0 && data->fname_len > 0){
String fname = make_string(data->fname_space, data->fname_len);
Editing_File *file = 0;
b32 do_new_file = 0;
b32 do_new_file = false;
Plat_Handle handle = {0};
Temp_Memory temp = begin_temp_memory(part);
@ -1267,23 +1288,23 @@ DOC_SEE(begin_buffer_creation)
file = working_set_canon_contains(working_set, canon.name);
}
else{
do_new_file = 1;
do_new_file = true;
}
if (!file){
if (file == 0){
file = working_set_name_contains(working_set, fname);
}
u32 flags = data->flags;
if (!file){
if (file == 0){
if (!do_new_file){
if (flags & BufferCreate_AlwaysNew){
do_new_file = 1;
do_new_file = true;
}
else{
if (!system->load_handle(canon.name.str, &handle)){
do_new_file = 1;
do_new_file = true;
}
}
}
@ -1292,13 +1313,13 @@ DOC_SEE(begin_buffer_creation)
Assert(!handle_equal(handle, null_plat_handle));
i32 size = system->load_size(handle);
b32 in_general_mem = 0;
b32 in_general_mem = false;
char *buffer = push_array(part, char, size);
if (buffer == 0){
buffer = (char*)general_memory_allocate(general, size);
Assert(buffer != 0);
in_general_mem = 1;
in_general_mem = true;
}
if (system->load_file(handle, buffer, size)){

View File

@ -19,16 +19,12 @@ non-infringement.
The following parts of the Software are separately licensed as follows:
- The Liberation font family is licensed under the SIL Open Font License (version 2 onwards).
The full text of this license is available in the accompanying 3rdparty/sil.txt file
- The Hack font family is licensed under the a modified SIL license
The full text of this license is available in the accompanying 3rdparty/hacksil.txt file
- The Inconsolata font family is licensed under the SIL Open Font License
Copyright (c) 2011, Raph Levien (firstname.lastname@gmail.com), Copyright (c) 2012, Cyreal (cyreal.org)
The full text of this license is available in the accompanying 3rdpart/sil.txt
Copyright (c) 2011, Raph Levien (raph.levien@gmail.com), Copyright (c) 2012, Cyreal (cyreal.org)
- The Cutive font family is licensed under the SIL Open Font License
Copyright (c) 2012 by vernon adams (vern@newtypography.co.uk)
The full text of this license is available in the accompanying 3rdpart/sil.txt

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,2 +0,0 @@
#!/bin/sh

View File

@ -15,6 +15,10 @@ Extending your project with a project.4coder file:
\VIDEO{youtube:https://www.youtube.com/embed/iZLtS3IoatE}
Using customizable keywords in the 4coder custom API:
\VIDEO{youtube:https://www.youtube.com/watch?v=qoEvc4uC9Uw}
More tutorials coming soon.