FIX: Copied csv had an extra line

Fixes #393
This commit is contained in:
Nicolás Hatcher
2025-07-04 23:15:18 +02:00
committed by Nicolás Hatcher Andrés
parent 5d7f4a31d6
commit 3a68145848
3 changed files with 3 additions and 3 deletions

View File

@@ -167,7 +167,7 @@ fn copy_paste_internal() {
let copy = model.copy_to_clipboard().unwrap();
assert_eq!(
copy.csv,
"42\t127\n\"A season of faith\t \"\"perfection\"\"\"\t\n"
"42\t127\n\"A season of faith\t \"\"perfection\"\"\""
);
assert_eq!(copy.range, (1, 1, 2, 2));

View File

@@ -1641,7 +1641,7 @@ impl UserModel {
.map_err(|e| format!("Error converting from utf8: '{e}'"))?;
Ok(Clipboard {
csv,
csv: csv.trim().to_string(),
data,
sheet,
range: (row_start, column_start, row_end, column_end),

View File

@@ -473,7 +473,7 @@ const Workbook = (props: { model: Model; workbookState: WorkbookState }) => {
sheet,
clipboardId,
});
event.clipboardData.setData("text/plain", data.csv);
event.clipboardData.setData("text/plain", data.csv.trim());
event.clipboardData.setData("application/json", clipboardJsonStr);
event.preventDefault();
event.stopPropagation();