mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-14 22:14:23 +00:00
WIP: Print autoindents on tab
This commit is contained in:
parent
1cd04bd0d1
commit
362b369448
1 changed files with 7 additions and 1 deletions
|
@ -41,7 +41,7 @@ pub fn init(app: &mut MutableAppContext) {
|
|||
Binding::new("delete", "buffer:delete", Some("BufferView")),
|
||||
Binding::new("ctrl-d", "buffer:delete", Some("BufferView")),
|
||||
Binding::new("enter", "buffer:newline", Some("BufferView")),
|
||||
Binding::new("tab", "buffer:insert", Some("BufferView")).with_arg("\t".to_string()),
|
||||
Binding::new("tab", "buffer:print_autoindents", Some("BufferView")),
|
||||
Binding::new("ctrl-shift-K", "buffer:delete_line", Some("BufferView")),
|
||||
Binding::new(
|
||||
"alt-backspace",
|
||||
|
@ -177,6 +177,7 @@ pub fn init(app: &mut MutableAppContext) {
|
|||
),
|
||||
]);
|
||||
|
||||
app.add_action("buffer:print_autoindents", BufferView::print_autoindents);
|
||||
app.add_action("buffer:scroll", BufferView::scroll);
|
||||
app.add_action("buffer:select", BufferView::select);
|
||||
app.add_action("buffer:cancel", BufferView::cancel);
|
||||
|
@ -638,6 +639,11 @@ impl BufferView {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn print_autoindents(&mut self, _: &(), ctx: &mut ViewContext<Self>) {
|
||||
let buf = self.buffer.read(ctx);
|
||||
dbg!(buf.autoindent_for_rows(0..buf.row_count()));
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, text: &String, ctx: &mut ViewContext<Self>) {
|
||||
let mut old_selections = SmallVec::<[_; 32]>::new();
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue