Record start columns when writing to the clipboard from Zed
This commit is contained in:
parent
2d05f906f1
commit
7a26fa18c7
5 changed files with 214 additions and 45 deletions
|
@ -1,5 +1,6 @@
|
|||
use editor::{ClipboardSelection, Editor};
|
||||
use gpui::{ClipboardItem, MutableAppContext};
|
||||
use std::cmp;
|
||||
|
||||
pub fn copy_selections_content(editor: &mut Editor, linewise: bool, cx: &mut MutableAppContext) {
|
||||
let selections = editor.selections.all_adjusted(cx);
|
||||
|
@ -17,6 +18,10 @@ pub fn copy_selections_content(editor: &mut Editor, linewise: bool, cx: &mut Mut
|
|||
clipboard_selections.push(ClipboardSelection {
|
||||
len: text.len() - initial_len,
|
||||
is_entire_line: linewise,
|
||||
first_line_indent: cmp::min(
|
||||
start.column,
|
||||
buffer.indent_size_for_line(start.row).len,
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue