@@ -2224,6 +2224,9 @@ void EditorApp::render_menu_split() {
22242224 if (ImGui::MenuItem (" Split Tab Horizontally" , " Ctrl+Shift+H" )) split_horizontal ();
22252225 if (ImGui::MenuItem (" Split Tab Vertically" , " Ctrl+Shift+V" )) split_vertical ();
22262226 ImGui::Separator ();
2227+ if (ImGui::MenuItem (" Split and Open Horizontally" )) open_file_split (" " );
2228+ if (ImGui::MenuItem (" Split and Open Vertically" )) open_file_split_vertical (" " );
2229+ ImGui::Separator ();
22272230 if (ImGui::MenuItem (" Focus Next" , " Ctrl+K" )) next_split ();
22282231 if (ImGui::MenuItem (" Focus Previous" , " Ctrl+J" )) prev_split ();
22292232 ImGui::Separator ();
@@ -2788,6 +2791,24 @@ void EditorApp::render_dir_tree(const std::string& dir_path, std::unordered_map<
27882791 open_file (e.path );
27892792 }
27902793 }
2794+ if (ImGui::BeginPopupContextItem (e.path .c_str ())) {
2795+ if (ImGui::MenuItem (" Open" )) {
2796+ bool already_open = false ;
2797+ for (size_t i = 0 ; i < tabs_.size (); i++) {
2798+ if (tabs_[i].file_path == e.path ) { already_open = true ; break ; }
2799+ }
2800+ if (!already_open) open_file (e.path );
2801+ }
2802+ if (ImGui::MenuItem (" Open in HSplit" )) {
2803+ split_horizontal ();
2804+ open_file (e.path );
2805+ }
2806+ if (ImGui::MenuItem (" Open in VSplit" )) {
2807+ split_vertical ();
2808+ open_file (e.path );
2809+ }
2810+ ImGui::EndPopup ();
2811+ }
27912812 ImGui::PopID ();
27922813 }
27932814 }
@@ -3942,6 +3963,28 @@ void EditorApp::open_file_split(const std::string& path) {
39423963 }
39433964}
39443965
3966+ void EditorApp::open_file_split_vertical (const std::string& path) {
3967+ if (active_tab_ < 0 || active_tab_ >= (int )tabs_.size ()) return ;
3968+
3969+ std::string selected_path = path;
3970+ if (path.empty ()) {
3971+ nfdchar_t * out_path = nullptr ;
3972+ nfdresult_t result = NFD_OpenDialog (&out_path, nullptr , 0 , nullptr );
3973+ if (result == NFD_OKAY && out_path) {
3974+ selected_path = out_path;
3975+ settings_.last_open_dir = std::filesystem::path (out_path).parent_path ().string ();
3976+ NFD_FreePath (out_path);
3977+ } else if (result == NFD_CANCEL) {
3978+ return ;
3979+ }
3980+ }
3981+
3982+ if (!selected_path.empty ()) {
3983+ split_vertical ();
3984+ open_file (selected_path);
3985+ }
3986+ }
3987+
39453988void EditorApp::rotate_splits () {
39463989 if (active_tab_ < 0 || active_tab_ >= (int )tabs_.size ()) return ;
39473990 auto & tab = tabs_[active_tab_];
0 commit comments