Update cosmic-text to allow for line selection
This commit is contained in:
parent
94fe82f38e
commit
3ba99aaab5
3 changed files with 155 additions and 70 deletions
|
|
@ -15,7 +15,7 @@ use cosmic::{
|
|||
widget::{self, button, icon, nav_bar, segmented_button, view_switcher},
|
||||
Application, ApplicationExt, Apply, Element,
|
||||
};
|
||||
use cosmic_text::{Cursor, Edit, Family, FontSystem, SwashCache, SyntaxSystem, ViMode};
|
||||
use cosmic_text::{Cursor, Edit, Family, FontSystem, Selection, SwashCache, SyntaxSystem, ViMode};
|
||||
use std::{
|
||||
any::TypeId,
|
||||
env, fs,
|
||||
|
|
@ -889,7 +889,7 @@ impl Application for App {
|
|||
let buffer = editor.buffer();
|
||||
let last_line = buffer.lines.len().saturating_sub(1);
|
||||
let last_index = buffer.lines[last_line].text().len();
|
||||
editor.set_select_opt(Some(Cursor::new(last_line, last_index)));
|
||||
editor.set_selection(Selection::Normal(Cursor::new(last_line, last_index)));
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,7 +350,16 @@ where
|
|||
image_color |= (color.0 & 0x00FF0000) >> 16;
|
||||
// Shift blue channel
|
||||
image_color |= (color.0 & 0x000000FF) << 16;
|
||||
draw_rect(buffer, image_w, image_h, x, y, w as i32, h as i32, image_color);
|
||||
draw_rect(
|
||||
buffer,
|
||||
image_w,
|
||||
image_h,
|
||||
x,
|
||||
y,
|
||||
w as i32,
|
||||
h as i32,
|
||||
image_color,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue