Skip to content

Commit

Permalink
Merge pull request #345 from zxcalc/selection-across-undo
Browse files Browse the repository at this point in the history
Preserve selection across undo/redo
  • Loading branch information
RazinShaikh authored Aug 1, 2024
2 parents 5419eef + 3dad904 commit ce51805
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions zxlive/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def undo(self) -> None:

def redo(self) -> None:
self.old_g = self.graph_view.graph_scene.g
self.old_selected = set(self.graph_view.graph_scene.selected_vertices)
if not self.old_selected:
self.old_selected = set(self.graph_view.graph_scene.selected_vertices)
self.g = self.new_g
self.update_graph_view(True)

Expand Down Expand Up @@ -333,7 +334,7 @@ def redo(self) -> None:


@dataclass
class AddRewriteStep(SetGraph):
class AddRewriteStep(UpdateGraph):
"""Adds a new rewrite to the proof.
The rewrite is inserted after the currently selected step. In particular, it
Expand Down
1 change: 0 additions & 1 deletion zxlive/editor_base_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def delete_selection(self) -> None:
rem_vertices.append(get_w_partner(self.graph_scene.g, v))
if not rem_vertices and not selected_edges: return
new_g = copy.deepcopy(self.graph_scene.g)
self.graph_scene.clearSelection()
new_g.remove_edges(selected_edges)
new_g.remove_vertices(list(set(rem_vertices)))
cmd = SetGraph(self.graph_view,new_g) if len(set(rem_vertices)) > 128 \
Expand Down

0 comments on commit ce51805

Please sign in to comment.