@@ -1595,10 +1595,24 @@ impl App { |
| 1595 | 1595 | let unique_name = make_unique_name(&pending.dest_dir, &name_str); |
| 1596 | 1596 | let final_dest = pending.dest_dir.join(&unique_name); |
| 1597 | 1597 | |
| 1598 | + // Perform the copy/move with the unique name |
| 1598 | 1599 | let result = match pending.operation { |
| 1599 | 1600 | ClipboardOperation::Copy => { |
| 1600 | 1601 | if conflict_file.is_dir() { |
| 1601 | | - garfield::core::copy_path(&conflict_file, &pending.dest_dir) |
| 1602 | + // For directories, copy then rename to unique name |
| 1603 | + match garfield::core::copy_path(&conflict_file, &pending.dest_dir) { |
| 1604 | + Ok(copied_path) => { |
| 1605 | + // Rename to unique name if different |
| 1606 | + if copied_path != final_dest { |
| 1607 | + std::fs::rename(&copied_path, &final_dest) |
| 1608 | + .map(|_| final_dest.clone()) |
| 1609 | + .or(Ok(copied_path)) |
| 1610 | + } else { |
| 1611 | + Ok(copied_path) |
| 1612 | + } |
| 1613 | + } |
| 1614 | + Err(e) => Err(e), |
| 1615 | + } |
| 1602 | 1616 | } else { |
| 1603 | 1617 | std::fs::copy(&conflict_file, &final_dest).map(|_| final_dest.clone()) |
| 1604 | 1618 | } |
@@ -1631,14 +1645,25 @@ impl App { |
| 1631 | 1645 | self.refresh(); |
| 1632 | 1646 | |
| 1633 | 1647 | // Select the newly pasted file and start rename |
| 1634 | | - if let Some(pane) = self.focused_pane_mut() { |
| 1648 | + let found = if let Some(pane) = self.focused_pane_mut() { |
| 1635 | 1649 | if let Some(tab) = pane.active_tab_mut() { |
| 1636 | 1650 | // Find and select the file by name |
| 1637 | 1651 | if tab.select_by_name(&unique_name) { |
| 1638 | 1652 | // Start rename with the suggested name pre-populated |
| 1639 | 1653 | tab.start_rename_with_text(&unique_name); |
| 1654 | + true |
| 1655 | + } else { |
| 1656 | + false |
| 1640 | 1657 | } |
| 1658 | + } else { |
| 1659 | + false |
| 1641 | 1660 | } |
| 1661 | + } else { |
| 1662 | + false |
| 1663 | + }; |
| 1664 | + |
| 1665 | + if !found { |
| 1666 | + self.status_bar.set_status_message(format!("Pasted as '{}' - press F2 to rename", unique_name)); |
| 1642 | 1667 | } |
| 1643 | 1668 | |
| 1644 | 1669 | // Store remaining conflicts if not apply_to_all |