Skip to content

Commit

Permalink
fix: correct behaviour of ClearType::All (#63)
Browse files Browse the repository at this point in the history
fix #63
  • Loading branch information
Piturnah committed Aug 30, 2023
1 parent cacdc43 commit 2e3127c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased](https://github.com/Piturnah/gex/compare/v0.6.2...main)
### Fixed
- Entering unreachable code on inserting trailing newline ([#62](https://github.com/Piturnah/gex/issues/62))
- Incorrect positioning of "new branch" prompt ([#63](https://github.com/Piturnah/gex/issues/63))

## [0.6.2](https://github.com/Piturnah/gex/compare/v0.6.1...v0.6.2) - 2023-08-10
### Added
Expand Down
3 changes: 2 additions & 1 deletion src/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ impl BranchList {
pub fn checkout_new() -> Result<Output> {
terminal::disable_raw_mode().context("failed to exit raw mode")?;
print!(
"{}{}Name for the new branch: ",
"{}{}{}Name for the new branch: ",
cursor::MoveTo(0, 0),
Clear(ClearType::All),
cursor::Show
);
Expand Down
4 changes: 2 additions & 2 deletions src/render/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ impl fmt::Display for Clear {
write!(f, "{}", style::SetBackgroundColor(color))?;
match self.0 {
ClearType::All => {
write!(f, "{}", cursor::MoveTo(0, 0),)?;
write!(f, "{}{}", cursor::SavePosition, cursor::MoveTo(0, 0),)?;
for _ in 0..rows {
write!(f, "{:width$}", ' ', width = cols as usize)?;
}
write!(f, "{}", cursor::MoveTo(0, 0))
write!(f, "{}", cursor::RestorePosition)
}
ClearType::Purge => write!(
f,
Expand Down

0 comments on commit 2e3127c

Please sign in to comment.