Skip to content

Commit

Permalink
fix: Fix editor field ordering
Browse files Browse the repository at this point in the history
maybe this time
  • Loading branch information
ja-he committed Jul 1, 2024
1 parent 6fce717 commit 9ce2a38
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/ui/panes/composite_editor_ui_pane.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,16 @@ func translateEditorsCompositeToTUI(e *editors.Composite, minX, minY, maxWidth,
var children []ui.BoxRepresentation[edit.Editor]
computedHeight := 1
rollingY := minY + 1
for _, child := range e.GetFields() {
for _, childID := range e.GetFieldOrder() {
child, ok := e.GetFields()[childID]
if !ok {
log.Warn().
Str("id", childID).
Int("num-fields-per-order", len(e.GetFieldOrder())).
Int("num-fields-per-map", len(e.GetFields())).
Msg("found composite editor inconsistency: field-ID in order but not in map of fields")
continue
}
childBoxRepresentation, err := translateEditorsEditorToTUI(child, minX+1, rollingY, maxWidth-2, maxHeight-2)
if err != nil {
return ui.BoxRepresentation[edit.Editor]{}, fmt.Errorf("error translating child '%s' (%s)", child.GetID(), err.Error())
Expand Down

0 comments on commit 9ce2a38

Please sign in to comment.