Skip to content

fix(gui): edit or delete part of a tag without losing the rest - #129

Open
dustenhubbard wants to merge 1 commit into
mainfrom
fix/tag-editing
Open

fix(gui): edit or delete part of a tag without losing the rest#129
dustenhubbard wants to merge 1 commit into
mainfrom
fix/tag-editing

Conversation

@dustenhubbard

@dustenhubbard dustenhubbard commented Jul 31, 2026

Copy link
Copy Markdown
Member

Makes an existing tag editable in place, so correcting one no longer means deleting it and retyping the whole thing. Reproducing the report turned up a separate cause on each surface that edits tags.

Object list. editObjectAttributes called editTraceAttributes(add_tags=True) unconditionally, and that branch only ever adds, so deleting a row and confirming did nothing. It now takes add_tags, defaulting to True so no caller changes meaning, and the object list sets it from whether the dialog was actually showing the selection's tags. Replacing on a multi-object selection would discard tags the user was never shown.

Trace attributes dialog. MultiInput's "-" ran self.inputs.pop(), removing the last row wherever the caret was, so fixing the first of several tags meant retyping the rest. It now removes the row being edited, which is why both buttons are Qt.NoFocus. Rows came from a set, so they moved between openings; they are sorted now.

Trace palette. The Tags cell is parsed with text.split(", "), so removing spine from axon, spine leaves an empty second tag, and "".split(", ") is [""] -- confirming Edit all palettes... untouched gave every untagged trace an empty tag. Splitting on the comma and dropping empties fixes both.

Includes 32 tests. The repo has no tests/ directory, so this adds one.

Closes #119

Correcting a tag meant deleting it and typing it again. Reproducing that
turned up a separate reason on each surface that edits tags:

- `MultiInput.remove` popped the last row wherever the caret was, so
  fixing the first of several tags deleted every row below it. It now
  removes the row being edited, and keeps one row alive by clearing it
  rather than leaving a field with nothing to type into.
- The tag rows and the palette's Tags cell were built straight from a
  set, so a tag moved between openings and a part-finished edit resumed
  on the wrong row. Both are sorted now.
- The palette's Tags cell was parsed with `text.split(", ")`, which
  turns the "axon, " left behind by deleting "spine" into two tags, the
  second empty, and turns an untagged trace's empty cell into a single
  empty tag. `parseTags` splits on the comma, strips, and drops empties.
- `Series.editObjectAttributes` passed `add_tags=True` to
  `Section.editTraceAttributes`, which iterates the incoming set and
  adds each element, so an edited set could add a tag but never drop
  one. It takes `add_tags` now, defaulting to True so no other caller
  changes, and the object list passes False when the dialog was
  actually showing that object's tags.

Adds a tests/ directory, which the repo did not have.

Closes #119
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot gracefully edit or delete part of a tag

1 participant