Skip to content

Commit

Permalink
Fix a couple of crashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
focus-editor committed Apr 27, 2023
1 parent 91a0bc8 commit 8ec1859
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
19 changes: 9 additions & 10 deletions LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@

===========================

+ Save All
+ BUG: crash when trying to delete line near the top
- BUG: crash when trying to open the newly created file

- Switch project
- Don't skip spaces when editing with multiple cursors
- Show default config (readonly)

- Line wrap:
- Sticky viewport
Expand All @@ -27,17 +24,13 @@
- Have a maximum allowed line length (then force a line wrap, but with a possibility to disable and face the consequences)
- Inspect all places where we use line_starts and consider using real_line_starts (with a switch?)

- Don't skip spaces when editing with multiple cursors

- Drop a folder into the editor to add it to workspace

- Make sure behaviour is consistent when selecting by cursor or by mouse (either with ctrl+D or with ctrl+arrows)

- Highlight C/C++

- Detect conflicting keys in the same context in the same config

- Use keyboard in the confirmation dialog
- Drop a folder into the editor to add it to workspace

- Highlight matching braces

Expand All @@ -59,6 +52,8 @@
- Ignore project folders which are children of another project folder?
- Profile the whole project to see if we're doing something stupid

- Detect conflicting keys in the same context in the same config

- Add horizontal scrollbar
- Alt-HL smooth scroll

Expand Down Expand Up @@ -146,6 +141,10 @@
- Investigate a crash when font size is too large - copy glyph to buffer segfaults

# DONE
+ BUG: crash when trying to open the newly created file
+ Save All
+ BUG: crash when trying to delete line near the top
+ Switch project
+ Open projects folder
+ Open global config
+ Open project config
Expand Down
4 changes: 2 additions & 2 deletions src/main.jai
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION :: "0.1.0";
RELEASE_DATE :: "26 April 2023";
VERSION :: "0.1.1";
RELEASE_DATE :: "28 April 2023";

main :: () {
cpu_info = get_cpu_info();
Expand Down
14 changes: 10 additions & 4 deletions src/widgets/open_file_dialog.jai
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ open_file_dialog_open_entry :: (selected: s64, placement: Editor_Placement, fold

case .file;
if folder_only return;
path := entry.full_path;
editors_open_file(path, placement);
if entry.buffer_id >= 0 {
editors_open_buffer(entry.buffer_id, placement);
} else {
path := entry.full_path;
editors_open_file(path, placement);
}
hide_open_file_dialog();

case .drive;
Expand Down Expand Up @@ -272,7 +276,7 @@ refresh_entries :: (scan_folder := false) {
// This bit will be set when we want to make sure an entry appears on top
top_priority_bit: u64 = 1 << 62; // NOT the topmost bit because we'll be converting to s64 later

for buffer : open_buffers {
for buffer, buffer_id : open_buffers {
if buffer.deleted && !buffer.modified continue; // NOTE: we might still want to see externally deleted buffers.
// Maybe use 'deleted' and 'modified_on_disk' to distingiush the buffers
// we haven't deleted ourselves?
Expand All @@ -286,6 +290,7 @@ refresh_entries :: (scan_folder := false) {
if score < 0 continue;

entry := array_add(*entries.filtered);
entry.buffer_id = buffer_id;
entry.file = buffer.file;
entry.entry_name = buffer_name;
if !buffer.has_file {
Expand Down Expand Up @@ -430,8 +435,9 @@ Open_File_Dialog :: struct {
#scope_file

Entry :: struct {
buffer_id := -1; // not all entries have buffers
using file: File_Info;
flags: enum_flags u8 {
flags: enum_flags u8 { // TODO: remove and just use the buffer pointer, now it should be safe
MODIFIED;
MODIFIED_ON_DISK;
}
Expand Down

0 comments on commit 8ec1859

Please sign in to comment.