Add terminal inline assistant (#13638)
Release Notes: - N/A --------- Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
parent
c516b8f038
commit
e243856559
11 changed files with 1587 additions and 141 deletions
|
@ -945,6 +945,18 @@ impl Terminal {
|
|||
&self.last_content
|
||||
}
|
||||
|
||||
pub fn total_lines(&self) -> usize {
|
||||
let term = self.term.clone();
|
||||
let terminal = term.lock_unfair();
|
||||
terminal.total_lines()
|
||||
}
|
||||
|
||||
pub fn viewport_lines(&self) -> usize {
|
||||
let term = self.term.clone();
|
||||
let terminal = term.lock_unfair();
|
||||
terminal.screen_lines()
|
||||
}
|
||||
|
||||
//To test:
|
||||
//- Activate match on terminal (scrolling and selection)
|
||||
//- Editor search snapping behavior
|
||||
|
@ -999,11 +1011,21 @@ impl Terminal {
|
|||
.push_back(InternalEvent::Scroll(AlacScroll::Delta(1)));
|
||||
}
|
||||
|
||||
pub fn scroll_up_by(&mut self, lines: usize) {
|
||||
self.events
|
||||
.push_back(InternalEvent::Scroll(AlacScroll::Delta(lines as i32)));
|
||||
}
|
||||
|
||||
pub fn scroll_line_down(&mut self) {
|
||||
self.events
|
||||
.push_back(InternalEvent::Scroll(AlacScroll::Delta(-1)));
|
||||
}
|
||||
|
||||
pub fn scroll_down_by(&mut self, lines: usize) {
|
||||
self.events
|
||||
.push_back(InternalEvent::Scroll(AlacScroll::Delta(-(lines as i32))));
|
||||
}
|
||||
|
||||
pub fn scroll_page_up(&mut self) {
|
||||
self.events
|
||||
.push_back(InternalEvent::Scroll(AlacScroll::PageUp));
|
||||
|
@ -1436,6 +1458,13 @@ impl Terminal {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn working_directory(&self) -> Option<PathBuf> {
|
||||
self.pty_info
|
||||
.current
|
||||
.as_ref()
|
||||
.map(|process| process.cwd.clone())
|
||||
}
|
||||
|
||||
pub fn title(&self, truncate: bool) -> String {
|
||||
const MAX_CHARS: usize = 25;
|
||||
match &self.task {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue