fix: don't respond to editor events in mainview during project switch
This commit is contained in:
parent
335f1bedab
commit
008950255b
1 changed files with 18 additions and 11 deletions
|
|
@ -58,6 +58,7 @@ file_list_type: FileListType = .find_in_files,
|
||||||
panel_height: ?usize = null,
|
panel_height: ?usize = null,
|
||||||
symbols: std.ArrayListUnmanaged(u8) = .empty,
|
symbols: std.ArrayListUnmanaged(u8) = .empty,
|
||||||
symbols_complete: bool = true,
|
symbols_complete: bool = true,
|
||||||
|
closing_project: bool = false,
|
||||||
|
|
||||||
const FileListType = enum {
|
const FileListType = enum {
|
||||||
diagnostics,
|
diagnostics,
|
||||||
|
|
@ -413,6 +414,9 @@ const cmds = struct {
|
||||||
|
|
||||||
const project_state = try project_manager.open(project_dir);
|
const project_state = try project_manager.open(project_dir);
|
||||||
|
|
||||||
|
{
|
||||||
|
self.closing_project = true;
|
||||||
|
defer self.closing_project = false;
|
||||||
try self.close_all_editors();
|
try self.close_all_editors();
|
||||||
self.delete_all_buffers();
|
self.delete_all_buffers();
|
||||||
self.clear_find_in_files_results(.diagnostics);
|
self.clear_find_in_files_results(.diagnostics);
|
||||||
|
|
@ -420,6 +424,7 @@ const cmds = struct {
|
||||||
try self.toggle_panel_view(filelist_view, false);
|
try self.toggle_panel_view(filelist_view, false);
|
||||||
self.buffer_manager.deinit();
|
self.buffer_manager.deinit();
|
||||||
self.buffer_manager = Buffer.Manager.init(self.allocator);
|
self.buffer_manager = Buffer.Manager.init(self.allocator);
|
||||||
|
}
|
||||||
|
|
||||||
const project = tp.env.get().str("project");
|
const project = tp.env.get().str("project");
|
||||||
tui.rdr().set_terminal_working_directory(project);
|
tui.rdr().set_terminal_working_directory(project);
|
||||||
|
|
@ -1416,10 +1421,12 @@ pub fn handle_editor_event(self: *Self, _: tp.pid_ref, m: tp.message) tp.result
|
||||||
return self.location_update(m);
|
return self.location_update(m);
|
||||||
|
|
||||||
if (try m.match(.{ "E", "close" })) {
|
if (try m.match(.{ "E", "close" })) {
|
||||||
|
if (!self.closing_project) {
|
||||||
if (self.get_next_mru_buffer(.non_hidden)) |file_path|
|
if (self.get_next_mru_buffer(.non_hidden)) |file_path|
|
||||||
self.show_file_async(file_path)
|
self.show_file_async(file_path)
|
||||||
else
|
else
|
||||||
self.show_home_async();
|
self.show_home_async();
|
||||||
|
} else self.show_home_async();
|
||||||
self.active_editor = null;
|
self.active_editor = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue