Refactor: Extract monospace_attrs() helper to eliminate code duplication
- Add monospace_attrs() function in main.rs to centralize monospace font attributes creation - Replace duplicated Attrs::new().family(Family::Monospace) calls in: * line_number.rs: LineNumberCache::get() method * main.rs: App::init() font enumeration * tab.rs: EditorTab::new() constructor - Remove unused imports (Attrs, Family) from line_number.rs - Resolves TODO comments about code repetition across modules This change improves maintainability by having a single source of truth for monospace font configuration.
This commit is contained in:
parent
2d6d2d381e
commit
4bf88ae6ad
3 changed files with 10 additions and 7 deletions
|
|
@ -47,8 +47,7 @@ pub struct EditorTab {
|
|||
|
||||
impl EditorTab {
|
||||
pub fn new(config: &Config) -> Self {
|
||||
//TODO: do not repeat, used in App::init
|
||||
let attrs = Attrs::new().family(cosmic_text::Family::Monospace);
|
||||
let attrs = crate::monospace_attrs();
|
||||
let zoom_adj = Default::default();
|
||||
let mut buffer = Buffer::new_empty(config.metrics(zoom_adj));
|
||||
buffer.set_text(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue