mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-29 05:44:14 +02:00
4c7d4e7c53
https://github.com/qelectrotech/qelectrotech-source-mirror/issues/413 ## Bug Copy-pasting an element pair joined by a conductor with no label results in the pasted conductor having a literal "_" label, even though the source conductor's label was empty. Repeating copy+paste on the result keeps stacking the same "_" back on, since the pasted conductor now legitimately has that text. ## Root cause PasteDiagramCommand::redo() (sources/diagramcommands.cpp), when the "erase label on copy" option is enabled (the default), resets each pasted element's formula/label/comment/location to "" - a real erase. Right next to it, the equivalent reset for conductors doesn't erase: cp.text = c->diagram() ? c->diagram()->defaultConductorProperties.text : "_"; It unconditionally overwrites the conductor's text with the *project's configured default text for newly drawn conductors* - a setting that happens to default to a literal "_" character (visible in the project/ new-folio "Conductors" tab), and is otherwise unrelated to whether this particular copy's label should be kept or cleared. The `: "_"` fallback for the "no diagram" case doesn't help either, since these conductors are already added to the scene before this code runs. ## Fix Reset conductor text to "" too, matching every other field reset in the same block. "Erase on copy" should erase, not "replace with whatever the project's unrelated new-conductor default happens to be." ## Verification Built clean. I was not able to get a reliable live GUI reproduction under Xvfb + xdotool for this one - drawing conductors between terminals via simulated drag kept mis-firing as element placement instead in this environment, the same class of automation friction noted on PR #743. Confidence rests on tracing the exact code path (confirmed defaultConductorProperties.text is a project-level setting for freshly-drawn conductors, unrelated to paste; confirmed the sibling element-info reset four lines above uses "" specifically) plus the fact this is a one-line change to match an already-correct pattern right next to it, not new logic.