@@ -208,6 +208,23 @@ contains |
| 208 | 208 | |
| 209 | 209 | ! Route keys to symbols panel when visible |
| 210 | 210 | if (is_symbols_panel_visible(editor%symbols_panel)) then |
| 211 | + ! Handle Enter specially - jump to symbol location |
| 212 | + if (trim(key_str) == 'enter') then |
| 213 | + block |
| 214 | + use iso_fortran_env, only: int32 |
| 215 | + integer(int32) :: sym_line, sym_col |
| 216 | + if (get_selected_symbol_location(editor%symbols_panel, sym_line, sym_col)) then |
| 217 | + ! Jump to the symbol location |
| 218 | + editor%cursors(editor%active_cursor)%line = sym_line |
| 219 | + editor%cursors(editor%active_cursor)%column = sym_col |
| 220 | + ! Center the view on the target line |
| 221 | + editor%viewport_line = max(1, sym_line - editor%screen_rows / 2) |
| 222 | + ! Hide the panel after jumping |
| 223 | + call hide_symbols_panel(editor%symbols_panel) |
| 224 | + end if |
| 225 | + end block |
| 226 | + return |
| 227 | + end if |
| 211 | 228 | if (symbols_panel_handle_key(editor%symbols_panel, trim(key_str))) then |
| 212 | 229 | return |
| 213 | 230 | end if |
@@ -5959,16 +5976,6 @@ contains |
| 5959 | 5976 | result_array = response%result |
| 5960 | 5977 | num_symbols = json_array_size(result_array) |
| 5961 | 5978 | |
| 5962 | | - ! Debug: log to file |
| 5963 | | - block |
| 5964 | | - integer :: dbg_unit |
| 5965 | | - open(newunit=dbg_unit, file='/tmp/fac_symbols_debug.log', status='replace', action='write') |
| 5966 | | - write(dbg_unit, '(A,I0)') 'result_array%value_type = ', result_array%value_type |
| 5967 | | - write(dbg_unit, '(A,L1)') 'result_array%array_value associated = ', associated(result_array%array_value) |
| 5968 | | - write(dbg_unit, '(A,I0)') 'num_symbols = ', num_symbols |
| 5969 | | - close(dbg_unit) |
| 5970 | | - end block |
| 5971 | | - |
| 5972 | 5979 | if (num_symbols == 0) then |
| 5973 | 5980 | call clear_symbols(editor%symbols_panel) |
| 5974 | 5981 | call terminal_move_cursor(editor%screen_rows, 1) |
@@ -5980,31 +5987,19 @@ contains |
| 5980 | 5987 | allocate(symbols(num_symbols)) |
| 5981 | 5988 | |
| 5982 | 5989 | ! Parse each symbol |
| 5983 | | - block |
| 5984 | | - integer :: dbg_unit |
| 5985 | | - open(newunit=dbg_unit, file='/tmp/fac_symbols_debug.log', status='old', position='append', action='write') |
| 5986 | | - |
| 5987 | | - do i = 1, num_symbols |
| 5988 | | - ! json_get_array_element expects 0-based index |
| 5989 | | - symbol_obj = json_get_array_element(result_array, i - 1) |
| 5990 | | - |
| 5991 | | - write(dbg_unit, '(A,I0,A,I0)') 'Symbol ', i, ': value_type = ', symbol_obj%value_type |
| 5992 | | - write(dbg_unit, '(A,L1)') ' object_value associated = ', associated(symbol_obj%object_value) |
| 5993 | | - if (associated(symbol_obj%object_value)) then |
| 5994 | | - write(dbg_unit, '(A,I0)') ' object pair count = ', symbol_obj%object_value%count |
| 5995 | | - end if |
| 5996 | | - write(dbg_unit, '(A,L1)') ' has_key(name) = ', json_has_key(symbol_obj, 'name') |
| 5997 | | - |
| 5998 | | - ! Get symbol name (required) |
| 5999 | | - if (json_has_key(symbol_obj, 'name')) then |
| 6000 | | - name = json_get_string(symbol_obj, 'name', '') |
| 6001 | | - write(dbg_unit, '(A,I0,A,A,A)') ' name len=', len(name), ' value="', trim(name), '"' |
| 6002 | | - if (len(name) > 0) then |
| 6003 | | - if (allocated(symbols(i)%name)) deallocate(symbols(i)%name) |
| 6004 | | - allocate(character(len=len(name)) :: symbols(i)%name) |
| 6005 | | - symbols(i)%name = name |
| 6006 | | - end if |
| 5990 | + do i = 1, num_symbols |
| 5991 | + ! json_get_array_element expects 0-based index |
| 5992 | + symbol_obj = json_get_array_element(result_array, i - 1) |
| 5993 | + |
| 5994 | + ! Get symbol name (required) |
| 5995 | + if (json_has_key(symbol_obj, 'name')) then |
| 5996 | + name = json_get_string(symbol_obj, 'name', '') |
| 5997 | + if (len(name) > 0) then |
| 5998 | + if (allocated(symbols(i)%name)) deallocate(symbols(i)%name) |
| 5999 | + allocate(character(len=len(name)) :: symbols(i)%name) |
| 6000 | + symbols(i)%name = name |
| 6007 | 6001 | end if |
| 6002 | + end if |
| 6008 | 6003 | |
| 6009 | 6004 | ! Get detail (optional) |
| 6010 | 6005 | if (json_has_key(symbol_obj, 'detail')) then |
@@ -6083,10 +6078,7 @@ contains |
| 6083 | 6078 | |
| 6084 | 6079 | symbols(i)%depth = 0 ! Top level |
| 6085 | 6080 | symbols(i)%is_expanded = .true. |
| 6086 | | - end do |
| 6087 | | - |
| 6088 | | - close(dbg_unit) |
| 6089 | | - end block |
| 6081 | + end do |
| 6090 | 6082 | |
| 6091 | 6083 | ! Update the symbols panel |
| 6092 | 6084 | call set_symbols(editor%symbols_panel, symbols, num_symbols) |