diff --git a/internal/control/edit/editors/composite_editor.go b/internal/control/edit/editors/composite_editor.go index 269b4cf5..5e429bef 100644 --- a/internal/control/edit/editors/composite_editor.go +++ b/internal/control/edit/editors/composite_editor.go @@ -127,10 +127,10 @@ func ConstructEditor(id string, obj any, extraSpec map[string]any, parentEditor parts := strings.Split(tag, ",") // build the edit spec - subeditorID := parts[0] editspec := dpedit{ - ID: subeditorID, + ID: parts[0], } + log.Trace().Interface("dpedit", editspec).Msgf("have editspec") if len(parts) == 2 { switch parts[1] { case "ignore": @@ -148,14 +148,14 @@ func ConstructEditor(id string, obj any, extraSpec map[string]any, parentEditor if !editspec.Ignore { // set the active field to the first field if constructedCompositeEditor.activeFieldID == "___unassigned" { - constructedCompositeEditor.activeFieldID = subeditorID + constructedCompositeEditor.activeFieldID = editspec.ID } - constructedCompositeEditor.fieldOrder = append(constructedCompositeEditor.fieldOrder, subeditorID) + constructedCompositeEditor.fieldOrder = append(constructedCompositeEditor.fieldOrder, editspec.ID) switch field.Type.Kind() { case reflect.String: f := structValue.Field(i) - constructedCompositeEditor.fields[subeditorID] = &StringEditor{ + constructedCompositeEditor.fields[editspec.ID] = &StringEditor{ Name: editspec.ID, Content: f.String(), CursorPos: 0, @@ -165,7 +165,7 @@ func ConstructEditor(id string, obj any, extraSpec map[string]any, parentEditor case edit.EditorInactive, edit.EditorSelected: return edit.EditorInactive case edit.EditorChildActive, edit.EditorFocussed: - if constructedCompositeEditor.activeFieldID == subeditorID { + if constructedCompositeEditor.activeFieldID == editspec.ID { if constructedCompositeEditor.inField { return edit.EditorFocussed } @@ -178,7 +178,7 @@ func ConstructEditor(id string, obj any, extraSpec map[string]any, parentEditor } }, QuitCallback: func() { - if constructedCompositeEditor.activeFieldID == subeditorID { + if constructedCompositeEditor.activeFieldID == editspec.ID { constructedCompositeEditor.inField = false } }, @@ -198,21 +198,21 @@ func ConstructEditor(id string, obj any, extraSpec map[string]any, parentEditor } else { fAsPtr = f.Addr().Interface() } - log.Debug().Msgf("constructing subeditor for field '%s' of type '%s'", field.Name, field.Type.String()) - sube, err := ConstructEditor(field.Name, fAsPtr, nil, constructedCompositeEditor) + log.Debug().Msgf("constructing subeditor for field '%s' (tagged '%s') of type '%s'", field.Name, editspec.ID, field.Type.String()) + sube, err := ConstructEditor(editspec.ID, fAsPtr, nil, constructedCompositeEditor) if err != nil { - return nil, fmt.Errorf("unable to construct subeditor for field '%s' of type '%s' (%s)", field.Name, field.Type.String(), err.Error()) + return nil, fmt.Errorf("unable to construct subeditor for field '%s' (tagged '%s') of type '%s' (%s)", field.Name, editspec.ID, field.Type.String(), err.Error()) } sube.AddQuitCallback(func() { constructedCompositeEditor.inField = false }) - log.Debug().Msgf("successfully constructed subeditor for field '%s' of type '%s'", field.Name, field.Type.String()) - constructedCompositeEditor.fields[subeditorID] = sube + log.Debug().Msgf("successfully constructed subeditor for field '%s' (tagged '%s') of type '%s'", field.Name, editspec.ID, field.Type.String()) + constructedCompositeEditor.fields[editspec.ID] = sube } case reflect.Ptr: // TODO log.Warn().Msgf("ignoring PTR '%s' tagged '%s' (ignore:%t) of type '%s'", field.Name, editspec.ID, editspec.Ignore, field.Type.String()) default: - return nil, fmt.Errorf("unable to edit non-ignored field '%s' of type '%s'", field.Name, field.Type.Kind()) + return nil, fmt.Errorf("unable to edit non-ignored field '%s' (tagged '%s') of type '%s'", field.Name, editspec.ID, field.Type.Kind()) } } } diff --git a/internal/ui/panes/composite_editor_ui_pane.go b/internal/ui/panes/composite_editor_ui_pane.go index 10aacbee..c8a7d015 100644 --- a/internal/ui/panes/composite_editor_ui_pane.go +++ b/internal/ui/panes/composite_editor_ui_pane.go @@ -47,7 +47,7 @@ func (p *CompositeEditorPane) Draw() { p.Renderer.DrawText(x, y, 1, 1, style.Bolded(), ">") } - p.Renderer.DrawText(x, y, w, 1, style.Italicized(), string(status)) + // p.Renderer.DrawText(x, y, w, 1, style.Italicized(), string(status)) // draw all subpanes for _, subpane := range p.subpanes {