Skip to content

Commit

Permalink
fix(clafrica): previous out not always write back (#39)
Browse files Browse the repository at this point in the history
The previous out was not write back when the output was not aligned.
eg. None, Some, None, None, Some
The problem was that the logic was not in a good place.
  • Loading branch information
pythonbrad committed May 17, 2023
1 parent 1033eef commit 8ed3518
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Correct logic of writing back of the previous out after backspace (#39)

## [0.2.1] - 2023-05-15

### Added
Expand All @@ -23,14 +27,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Implement the initial binary application
- (lib) Implement a cursor
- Implement the initial binary application (#8)
- (lib) Implement a cursor (#6)
- (lib) Each node hold his key (#16)
- (lib) Each node hold his depth on the tree
- (lib) Each node hold his depth on the tree (#5)

### Changed

- (lib) Rename bst to text_buffer
- (lib) Rename bst to text_buffer (#9)

## [0.1.1] - 2023-04-28

Expand Down
8 changes: 4 additions & 4 deletions clafrica/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ pub fn run(config: config::Config, mut frontend: impl Frontend) -> Result<(), io
let i = out.chars().count();
(1..i).for_each(|_| keyboard.key_click(Key::Backspace));

if let (Some(prev_out), ..) = cursor.state() {
keyboard.key_sequence(&prev_out);
}

rdev::simulate(&EventType::KeyRelease(E_Key::Pause))
.expect("We could resume the listeners");

// Clear the remaining code
while let (None, _i @ 1.., ..) = cursor.state() {
cursor.undo();
}

if let (Some(prev_out), ..) = cursor.state() {
keyboard.key_sequence(&prev_out);
}
}

frontend.update_text(cursor.to_path());
Expand Down

0 comments on commit 8ed3518

Please sign in to comment.