Commit f5a62550 authored by Jody Goldberg's avatar Jody Goldberg

When an X app requests that a region that was cut we should be consistant

and clear the region after the operation.
parent c2637d6a
......@@ -10,6 +10,8 @@
(clipboard_export_cell_region) : Delete.
(find_local_workbook_with_selection) : Delete.
(workbook_selection_locator) : Delete.
(x_selection_handler) : We need to clear the region when we paste a
region that was marked for cut rather than copy.
* ./src/item-grid.c (item_grid_popup_menu) : Always enable paste,
only enable paste special when we have a local cut. This matches
......
......@@ -10,6 +10,8 @@
(clipboard_export_cell_region) : Delete.
(find_local_workbook_with_selection) : Delete.
(workbook_selection_locator) : Delete.
(x_selection_handler) : We need to clear the region when we paste a
region that was marked for cut rather than copy.
* ./src/item-grid.c (item_grid_popup_menu) : Always enable paste,
only enable paste special when we have a local cut. This matches
......
......@@ -404,6 +404,9 @@ x_selection_handler (GtkWidget *widget, GtkSelectionData *selection_data, guint
CellRegion *clipboard = application_clipboard_contents_get ();
char *rendered_selection;
/* If the region was marked for a cut we need to copy it for pasting
* then clear it
*/
if (clipboard == NULL) {
Sheet *sheet = application_clipboard_sheet_get ();
Range const *a = application_clipboard_area_get ();
......@@ -412,6 +415,12 @@ x_selection_handler (GtkWidget *widget, GtkSelectionData *selection_data, guint
clipboard_copy_cell_range (sheet,
a->start.col, a->start.row,
a->end.col, a->end.row);
/* Clear the region that was pasted into another application */
sheet_clear_region (workbook_command_context_gui (sheet->workbook),
sheet,
a->start.col, a->start.row,
a->end.col, a->end.row, FALSE);
}
g_return_if_fail (clipboard != NULL);
......@@ -423,8 +432,10 @@ x_selection_handler (GtkWidget *widget, GtkSelectionData *selection_data, guint
rendered_selection, strlen (rendered_selection));
g_free (rendered_selection);
if (content_needs_free)
if (content_needs_free) {
clipboard_release (clipboard);
application_clipboard_clear ();
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment