Fix repaint of underscore
This commit is contained in:
parent
9413af5a4e
commit
751c4eb6fa
52
src/shell.rs
52
src/shell.rs
@ -454,27 +454,12 @@ fn get_model_clip(state: &State, line_height: f64, char_width: f64, clip: (f64,
|
|||||||
model_clip
|
model_clip
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw(state: &State, ctx: &cairo::Context) {
|
#[inline]
|
||||||
ctx.set_source_rgb(state.bg_color.0, state.bg_color.1, state.bg_color.2);
|
fn draw_backgound(state: &State, ctx: &cairo::Context, line_height: f64, char_width: f64, model_clip: &ModelRect) {
|
||||||
ctx.paint();
|
|
||||||
|
|
||||||
let line_height = state.line_height.unwrap();
|
|
||||||
let char_width = state.char_width.unwrap();
|
|
||||||
|
|
||||||
let model_clip = get_model_clip(state, line_height, char_width, ctx.clip_extents());
|
|
||||||
|
|
||||||
let line_x = model_clip.left as f64 * char_width;
|
let line_x = model_clip.left as f64 * char_width;
|
||||||
let mut line_y: f64 = model_clip.top as f64 * line_height;
|
let mut line_y: f64 = model_clip.top as f64 * line_height;
|
||||||
|
|
||||||
let (row, col) = state.model.get_cursor();
|
for (_, line) in state.model.clip_model(model_clip) {
|
||||||
let mut buf = String::with_capacity(4);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let layout = pc::create_layout(ctx);
|
|
||||||
let mut desc = state.create_pango_font();
|
|
||||||
|
|
||||||
for (line_idx, line) in state.model.clip_model(&model_clip) {
|
|
||||||
ctx.move_to(line_x, line_y);
|
ctx.move_to(line_x, line_y);
|
||||||
|
|
||||||
// first draw background
|
// first draw background
|
||||||
@ -508,6 +493,33 @@ fn draw(state: &State, ctx: &cairo::Context) {
|
|||||||
line_height,
|
line_height,
|
||||||
from_bg.take().unwrap());
|
from_bg.take().unwrap());
|
||||||
|
|
||||||
|
line_y += line_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn draw(state: &State, ctx: &cairo::Context) {
|
||||||
|
ctx.set_source_rgb(state.bg_color.0, state.bg_color.1, state.bg_color.2);
|
||||||
|
ctx.paint();
|
||||||
|
|
||||||
|
let line_height = state.line_height.unwrap();
|
||||||
|
let char_width = state.char_width.unwrap();
|
||||||
|
|
||||||
|
let model_clip = get_model_clip(state, line_height, char_width, ctx.clip_extents());
|
||||||
|
|
||||||
|
let line_x = model_clip.left as f64 * char_width;
|
||||||
|
let mut line_y: f64 = model_clip.top as f64 * line_height;
|
||||||
|
|
||||||
|
let (row, col) = state.model.get_cursor();
|
||||||
|
let mut buf = String::with_capacity(4);
|
||||||
|
|
||||||
|
|
||||||
|
let layout = pc::create_layout(ctx);
|
||||||
|
let mut desc = state.create_pango_font();
|
||||||
|
|
||||||
|
draw_backgound(state, ctx, line_height, char_width, &model_clip);
|
||||||
|
|
||||||
|
for (line_idx, line) in state.model.clip_model(&model_clip) {
|
||||||
|
|
||||||
ctx.move_to(line_x, line_y);
|
ctx.move_to(line_x, line_y);
|
||||||
|
|
||||||
for (col_idx, cell) in line.iter() {
|
for (col_idx, cell) in line.iter() {
|
||||||
@ -707,6 +719,10 @@ impl RedrawEvents for State {
|
|||||||
&RepaintMode::Area(ref rect) => {
|
&RepaintMode::Area(ref rect) => {
|
||||||
match (&self.line_height, &self.char_width) {
|
match (&self.line_height, &self.char_width) {
|
||||||
(&Some(line_height), &Some(char_width)) => {
|
(&Some(line_height), &Some(char_width)) => {
|
||||||
|
let mut rect = rect.clone();
|
||||||
|
// this need to repain also line under curren line
|
||||||
|
// in case underscore or 'g' symbol is go here
|
||||||
|
rect.extend(0, 1, 0, 0);
|
||||||
let (x, y, width, height) = rect.to_area(line_height, char_width);
|
let (x, y, width, height) = rect.to_area(line_height, char_width);
|
||||||
self.drawing_area.queue_draw_area(x, y, width, height);
|
self.drawing_area.queue_draw_area(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user