wip
This commit is contained in:
@@ -2190,6 +2190,10 @@ impl Editor {
|
||||
font_cache.em_width(font_id, settings.buffer_font_size)
|
||||
}
|
||||
|
||||
pub fn set_width(&self, width: f32) {
|
||||
self.display_map.set_wrap_width(Some(width));
|
||||
}
|
||||
|
||||
// TODO: Can we make this not return a result?
|
||||
pub fn max_line_number_width(
|
||||
&self,
|
||||
|
||||
@@ -293,6 +293,14 @@ struct BackgroundWrapper {
|
||||
snapshot: Snapshot,
|
||||
}
|
||||
|
||||
enum WrapChange {
|
||||
InputChange {
|
||||
snapshot: InputSnapshot,
|
||||
edits: Vec<tab_map::Edit>,
|
||||
},
|
||||
WidthChange(Option<f32>),
|
||||
}
|
||||
|
||||
impl BackgroundWrapper {
|
||||
fn new(
|
||||
snapshot: Snapshot,
|
||||
@@ -313,7 +321,7 @@ impl BackgroundWrapper {
|
||||
async fn run(
|
||||
&mut self,
|
||||
snapshot: InputSnapshot,
|
||||
edits_rx: channel::Receiver<(InputSnapshot, Vec<InputEdit>)>,
|
||||
edits_rx: channel::Receiver<WrapChange>,
|
||||
mut snapshot_tx: watch::Sender<Snapshot>,
|
||||
) {
|
||||
let edit = InputEdit {
|
||||
|
||||
@@ -338,6 +338,8 @@ impl Element for EditorElement {
|
||||
}
|
||||
|
||||
let view = self.view(app);
|
||||
view.set_width(size.x());
|
||||
|
||||
let font_cache = &cx.font_cache;
|
||||
let layout_cache = &cx.text_layout_cache;
|
||||
let line_height = view.line_height(font_cache);
|
||||
|
||||
Reference in New Issue
Block a user