mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Ensure correct coordinate ordering in selection file write
When writing selected text to file, use `topLeft` and `bottomRight` instead of `start` and `end` to ensure correct coordinate ordering. This fixes an issue where selection files could be empty when selecting text in reverse order. - Use `terminal.Selection.topLeft()` for start coordinate - Use `terminal.Selection.bottomRight()` for end coordinate
This commit is contained in:

committed by
Jonathan Lopez

parent
2584468276
commit
995bc54639
@ -4293,11 +4293,16 @@ fn writeScreenFile(
|
|||||||
tmp_dir.deinit();
|
tmp_dir.deinit();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Use topLeft and bottomRight to ensure correct coordinate ordering
|
||||||
|
const tl = sel.topLeft(&self.io.terminal.screen);
|
||||||
|
const br = sel.bottomRight(&self.io.terminal.screen);
|
||||||
|
|
||||||
try self.io.terminal.screen.dumpString(
|
try self.io.terminal.screen.dumpString(
|
||||||
buf_writer.writer(),
|
buf_writer.writer(),
|
||||||
.{
|
.{
|
||||||
.tl = sel.start(),
|
.tl = tl,
|
||||||
.br = sel.end(),
|
.br = br,
|
||||||
.unwrap = true,
|
.unwrap = true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user