Fix syntect module

This commit is contained in:
Héctor Ramón Jiménez 2023-04-21 20:29:56 +02:00
parent 9e559e150d
commit a5c548b12f
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -9,7 +9,7 @@ use syntect::parsing::{ParseState, ScopeStack, SyntaxReference, SyntaxSet};
use crate::{ use crate::{
Action, AttrsList, BorrowedWithFontSystem, Buffer, Color, Cursor, Edit, Editor, FontSystem, Action, AttrsList, BorrowedWithFontSystem, Buffer, Color, Cursor, Edit, Editor, FontSystem,
Style, Weight, Wrap, Shaping, Style, Weight, Wrap,
}; };
pub struct SyntaxSystem { pub struct SyntaxSystem {
@ -75,7 +75,9 @@ impl<'a> SyntaxEditor<'a> {
let path = path.as_ref(); let path = path.as_ref();
let text = fs::read_to_string(path)?; let text = fs::read_to_string(path)?;
self.editor.buffer_mut().set_text(font_system, &text, attrs); self.editor
.buffer_mut()
.set_text(font_system, &text, attrs, Shaping::Advanced);
//TODO: re-use text //TODO: re-use text
self.syntax = match self.syntax_system.syntax_set.find_syntax_for_file(path) { self.syntax = match self.syntax_system.syntax_set.find_syntax_for_file(path) {