Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions source/copybuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ Position CopyBuffer::getPosition() const {
}

void CopyBuffer::clear() {
if (!tiles) {
return;
}

if (g_gui.secondary_map == tiles) {
g_gui.secondary_map = nullptr;
}
Comment on lines +54 to +56

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Instead of manually setting secondary_map to nullptr, you should call g_gui.EndPasting(). This will not only clear the secondary_map pointer but also reset the pasting flag to false. This fixes the "visual bug" mentioned in the PR description where the ghost paste remains active (but invisible) and allows for accidental pasting after the buffer has been cleared.

	if (g_gui.secondary_map == tiles) {
		g_gui.EndPasting();
	}

delete tiles;
tiles = nullptr;
}
Expand Down