diff --git a/held_core/src/interface/app.rs b/held_core/src/interface/app.rs index b7c9a75..66ce813 100644 --- a/held_core/src/interface/app.rs +++ b/held_core/src/interface/app.rs @@ -1,4 +1,4 @@ -use super::{get_application, APPLICATION}; +use super::get_application; pub trait App { fn exit(&mut self); diff --git a/held_core/src/view/render/mod.rs b/held_core/src/view/render/mod.rs index 5d8ec3c..9ba1854 100644 --- a/held_core/src/view/render/mod.rs +++ b/held_core/src/view/render/mod.rs @@ -1,5 +1,3 @@ -use std::str::Chars; - use cell::Cell; use crate::utils::{position::Position, rectangle::Rectangle}; diff --git a/src/application/handler/app.rs b/src/application/handler/app.rs index 0dce3d8..49eea72 100644 --- a/src/application/handler/app.rs +++ b/src/application/handler/app.rs @@ -1,4 +1,3 @@ -use crate::application::mode::command::CommandData; use crate::application::mode::{ModeData, ModeKey}; use crate::application::Application; use crate::errors::*; diff --git a/src/application/mod.rs b/src/application/mod.rs index f92f69b..59b72c2 100644 --- a/src/application/mod.rs +++ b/src/application/mod.rs @@ -12,7 +12,7 @@ use mode::{ use smallvec::SmallVec; use state::ApplicationStateData; -use std::{cell::RefCell, collections::HashMap, mem, rc::Rc, sync::Arc}; +use std::{cell::RefCell, collections::HashMap, mem, rc::Rc}; use crate::{ modules::perferences::{Perferences, PerferencesManager}, diff --git a/src/application/mode/command.rs b/src/application/mode/command.rs index f8b4b99..65dd41a 100644 --- a/src/application/mode/command.rs +++ b/src/application/mode/command.rs @@ -1,5 +1,3 @@ -use std::{collections::HashMap, process::CommandArgs}; - use held_core::{ utils::position::Position, view::{colors::Colors, style::CharStyle}, diff --git a/src/modules/perferences/yaml.rs b/src/modules/perferences/yaml.rs index 6305790..0f91816 100644 --- a/src/modules/perferences/yaml.rs +++ b/src/modules/perferences/yaml.rs @@ -1,13 +1,5 @@ -use std::path::PathBuf; - -use super::{ - Perferences, APP_INFO, LINE_WRAPPING_KEY, SOFT_TAB_KEY, TAB_WIDTH_KEY, THEME_KET, THEME_PATH, -}; -use crate::{ - errors::*, - modules::perferences::{LANGUAGE_KEY, LANGUAGE_SYNTAX_KEY, SYNTAX_PATH}, -}; -use app_dirs2::{app_dir, AppDataType}; +use super::{Perferences, LINE_WRAPPING_KEY, SOFT_TAB_KEY, TAB_WIDTH_KEY, THEME_KET}; +use crate::modules::perferences::{LANGUAGE_KEY, LANGUAGE_SYNTAX_KEY}; use yaml_rust::Yaml; pub struct YamlPerferences { diff --git a/src/view/presenter.rs b/src/view/presenter.rs index 5ca3793..37b8ec2 100644 --- a/src/view/presenter.rs +++ b/src/view/presenter.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, cell::RefCell, fmt::Debug, rc::Rc}; +use std::{borrow::Cow, fmt::Debug}; use super::{ colors::map::ColorMap, diff --git a/src/view/render/render_buffer.rs b/src/view/render/render_buffer.rs index 1d00906..e484e0e 100644 --- a/src/view/render/render_buffer.rs +++ b/src/view/render/render_buffer.rs @@ -59,11 +59,12 @@ impl CachedRenderBuffer { if !equal { let mut cache_cell = CachedCell::default(); - let content_len = cell_content.len(); + let grapheme_count = cell.content.graphemes(true).count().max(1); cache_cell.colors = cell.colors; cache_cell.style = cell.style; cache_cell.content = cell_content; - for i in (index + 1)..(index + content_len) { + let end_index = (index + grapheme_count).min(self.cells.len()); + for i in (index + 1)..end_index { self.cells[i] = None } diff --git a/src/workspace.rs b/src/workspace.rs index 391dc45..d100c3a 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -190,7 +190,6 @@ impl Workspace { .or_else(|| Some(self.syntax_set.find_syntax_plain_text())) .cloned(); - drop(buffer); self.get_buffer_mut(id) .ok_or(ErrorKind::EmptyWorkspace)? .syntax_definition = definition;