Skip to content

Commit

Permalink
correction for cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Oct 20, 2023
1 parent 5f345f1 commit 885a139
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions rio/src/screen/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,28 @@ impl State {
fn create_cursor(&self, square: &Square) -> Sugar {
let mut sugar = Sugar {
content: square.c,
foreground_color: [0., 0., 0., 0.],
background_color: [0., 0., 0., 0.],
foreground_color: self.compute_fg_color(square),
background_color: self.compute_bg_color(square),
style: None,
decoration: None,
};

let is_italic = square.flags.contains(Flags::ITALIC);
let is_bold_italic = square.flags.contains(Flags::BOLD_ITALIC);
let is_bold = square.flags.contains(Flags::BOLD);

if is_bold || is_bold_italic || is_italic {
sugar.style = Some(SugarStyle {
is_italic,
is_bold_italic,
is_bold,
});
}

if square.flags.contains(Flags::INVERSE) {
std::mem::swap(&mut sugar.background_color, &mut sugar.foreground_color);
}

// If IME is enabled we get the current content to cursor
if self.is_ime_enabled {
sugar.content = self.cursor.content;
Expand Down

0 comments on commit 885a139

Please sign in to comment.