fortrangoingonforty/sniffly / f0f1463

Browse files

create empty tabs with no path to prevent accidental scans

Authored by espadonne
SHA
f0f1463d3a540d3cfdac6114ecce0fe61a583a4a
Parents
dcced97
Tree
b008e30

2 changed files

StatusFile+-
M src/gui/tab_manager.f90 6 0
M src/gui/tab_widget.f90 4 11
src/gui/tab_manager.f90modified
@@ -256,6 +256,12 @@ contains
256
     character(len=256) :: basename
256
     character(len=256) :: basename
257
     integer :: last_slash
257
     integer :: last_slash
258
 
258
 
259
+    ! Special case: empty path (new empty tabs)
260
+    if (len_trim(path) == 0) then
261
+      basename = "Empty"
262
+      return
263
+    end if
264
+
259
     ! Find last slash
265
     ! Find last slash
260
     last_slash = index(trim(path), "/", back=.true.)
266
     last_slash = index(trim(path), "/", back=.true.)
261
 
267
 
src/gui/tab_widget.f90modified
@@ -195,18 +195,11 @@ contains
195
 
195
 
196
     print *, "Plus button clicked - creating new tab"
196
     print *, "Plus button clicked - creating new tab"
197
 
197
 
198
-    ! Get the current tab's path and use that for the new tab
198
+    ! New tabs start completely empty - no path to avoid accidental scans
199
-    ! TODO: Add directory picker to let user choose path
199
+    new_tab_path = ""
200
-    current_tab => get_tab(active_tab_index)
201
-    if (associated(current_tab)) then
202
-      new_tab_path = current_tab%scan_path
203
-    else
204
-      ! Fallback to home directory using environment variable
205
-      call get_environment_variable("HOME", new_tab_path)
206
-    end if
207
 
200
 
208
-    ! Create a new tab with the same path as current tab
201
+    ! Create a new empty tab
209
-    new_tab_index = create_tab(trim(new_tab_path))
202
+    new_tab_index = create_tab(new_tab_path)
210
 
203
 
211
     if (new_tab_index < 0) then
204
     if (new_tab_index < 0) then
212
       print *, "ERROR: Failed to create new tab (max tabs reached?)"
205
       print *, "ERROR: Failed to create new tab (max tabs reached?)"