pub struct ChangesPanel { /* private fields */ }Expand description
The Changes panel.
Implementations§
Source§impl ChangesPanel
impl ChangesPanel
Sourcepub fn new(files: Vec<PathBuf>, cx: &mut Context<'_, Self>) -> Self
pub fn new(files: Vec<PathBuf>, cx: &mut Context<'_, Self>) -> Self
Watches files (each read now: that is the last save and the session’s start until the
app says otherwise), checking them for changes every second.
Sourcepub fn refresh(&mut self, cx: &mut Context<'_, Self>)
pub fn refresh(&mut self, cx: &mut Context<'_, Self>)
Reads again the files that changed on disk.
Sourcepub fn changed_lines(&self) -> usize
pub fn changed_lines(&self) -> usize
Changed lines over every watched file (added and removed): the badge.
Sourcepub fn diff_of(&self, name: &str) -> Option<&Diff>
pub fn diff_of(&self, name: &str) -> Option<&Diff>
The diff of the watched file name against the baseline.
Sourcepub fn set_baseline(
&mut self,
baseline: Baseline,
cx: &mut Context<'_, Self>,
) -> Result<(), String>
pub fn set_baseline( &mut self, baseline: Baseline, cx: &mut Context<'_, Self>, ) -> Result<(), String>
Compares against baseline; the last commit is refused, with the reason, when no watched
file is in a git repository.
Sourcepub fn mark_saved(&mut self, cx: &mut Context<'_, Self>)
pub fn mark_saved(&mut self, cx: &mut Context<'_, Self>)
The files as they are now are the last save (the app calls this when it saves).
Sourcepub fn start_session(&mut self, cx: &mut Context<'_, Self>)
pub fn start_session(&mut self, cx: &mut Context<'_, Self>)
The files as they are now are the session’s start (an agent session begins).
Sourcepub fn propose(
&mut self,
name: &str,
new_text: &str,
cx: &mut Context<'_, Self>,
) -> Result<usize, String>
pub fn propose( &mut self, name: &str, new_text: &str, cx: &mut Context<'_, Self>, ) -> Result<usize, String>
Shows new_text proposed for the watched file name as a diff with Accept / Reject per
hunk. JSON is compared as pretty JSON with sorted keys, so the accepted hunks make a valid
file.
Sourcepub fn proposal(&self) -> Option<Entity<DiffView>>
pub fn proposal(&self) -> Option<Entity<DiffView>>
The proposal’s diff view, while one is under review.
Sourcepub fn apply_proposal(
&mut self,
cx: &mut Context<'_, Self>,
) -> Result<usize, String>
pub fn apply_proposal( &mut self, cx: &mut Context<'_, Self>, ) -> Result<usize, String>
Writes the proposal’s accepted hunks to its file (undecided hunks count as rejected) and closes it; returns how many were accepted.
Sourcepub fn discard_proposal(&mut self, cx: &mut Context<'_, Self>)
pub fn discard_proposal(&mut self, cx: &mut Context<'_, Self>)
Drops the proposal without writing anything.
Trait Implementations§
impl EventEmitter<ChangesEvent> for ChangesPanel
Source§impl Render for ChangesPanel
impl Render for ChangesPanel
Auto Trait Implementations§
impl !RefUnwindSafe for ChangesPanel
impl !UnwindSafe for ChangesPanel
impl Forget for ChangesPanel
impl Freeze for ChangesPanel
impl Move for ChangesPanel
impl Send for ChangesPanel
impl Sync for ChangesPanel
impl Unpin for ChangesPanel
impl UnsafeUnpin for ChangesPanel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more