Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ impl App {
}
InternalEvent::RenameBranch(branch_ref, cur_name) => {
self.rename_branch_popup
.open(branch_ref, cur_name)?;
.open(branch_ref, &cur_name)?;
}
InternalEvent::SelectBranch => {
self.select_branch_popup.open()?;
Expand Down
6 changes: 3 additions & 3 deletions src/components/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ impl CommitComponent {

let message = message.trim().to_string();

self.input.set_text(message);
self.input.set_text(&message);
self.input.show()?;

Ok(())
}

fn commit(&mut self) -> Result<()> {
self.commit_msg(self.input.get_text().clone())
self.commit_msg(self.input.get_text())
}

fn commit_msg(&mut self, msg: String) -> Result<()> {
Expand Down Expand Up @@ -272,7 +272,7 @@ impl CommitComponent {
.set_title(strings::commit_title_amend(&self.key_config));

if let Some(msg) = details.message {
self.input.set_text(msg.combine());
self.input.set_text(&msg.combine());
}

Ok(())
Expand Down
12 changes: 2 additions & 10 deletions src/components/cred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,15 @@ impl Component for CredComponent {
} else if e == self.key_config.enter {
if self.input_username.is_visible() {
self.cred = BasicAuthCredential::new(
Some(
self.input_username
.get_text()
.to_owned(),
),
Some(self.input_username.get_text()),
None,
);
self.input_username.hide();
self.input_password.show()?;
} else if self.input_password.is_visible() {
self.cred = BasicAuthCredential::new(
self.cred.username.clone(),
Some(
self.input_password
.get_text()
.to_owned(),
),
Some(self.input_password.get_text()),
);
self.input_password.hide();
self.input_password.clear();
Expand Down
4 changes: 2 additions & 2 deletions src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ fn dialog_paragraph<'a>(

fn popup_paragraph<'a>(
title: &'a str,
content: Vec<Span<'a>>,
content: Vec<Spans<'a>>,
theme: &Theme,
focused: bool,
) -> Paragraph<'a> {
Paragraph::new(Spans::from(content))
Paragraph::new(content)
.block(
Block::default()
.title(Span::styled(title, theme.title(focused)))
Expand Down
2 changes: 1 addition & 1 deletion src/components/rename_branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl RenameBranchComponent {
pub fn open(
&mut self,
branch_ref: String,
cur_name: String,
cur_name: &str,
) -> Result<()> {
self.branch_ref = None;
self.branch_ref = Some(branch_ref);
Expand Down
7 changes: 4 additions & 3 deletions src/components/reset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use anyhow::Result;
use crossterm::event::Event;
use std::borrow::Cow;
use tui::{
backend::Backend, layout::Rect, text::Span, widgets::Clear, Frame,
backend::Backend, layout::Rect, text::Span, text::Spans,
widgets::Clear, Frame,
};
use ui::style::SharedTheme;

Expand All @@ -33,10 +34,10 @@ impl DrawableComponent for ResetComponent {
if self.visible {
let (title, msg) = self.get_text();

let txt = vec![Span::styled(
let txt = vec![Spans::from(Span::styled(
Cow::from(msg),
self.theme.text_danger(),
)];
))];

let area = ui::centered_rect(30, 20, f.size());
f.render_widget(Clear, area);
Expand Down
6 changes: 4 additions & 2 deletions src/components/stashmsg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ impl Component for StashMsgComponent {

if let Event::Key(e) = ev {
if e == self.key_config.enter {
let msg = self.input.get_text();

match sync::stash_save(
CWD,
if self.input.get_text().is_empty() {
if msg.is_empty() {
None
} else {
Some(self.input.get_text().as_str())
Some(&msg)
},
self.options.stash_untracked,
self.options.keep_index,
Expand Down
2 changes: 1 addition & 1 deletion src/components/tag_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl TagCommitComponent {
///
pub fn tag(&mut self) {
if let Some(commit_id) = self.commit_id {
match sync::tag(CWD, &commit_id, self.input.get_text()) {
match sync::tag(CWD, &commit_id, &self.input.get_text()) {
Ok(_) => {
self.input.clear();
self.hide();
Expand Down
Loading