cleanup code

This commit is contained in:
Nawaf 2023-08-21 15:17:29 -04:00
parent 4699a9edf0
commit 275ef79f48

View File

@ -29,7 +29,7 @@
keyboard::{KeyCode, KeyModifiers},
Document, Editor, Theme, View,
};
use std::{cmp::Ordering, mem::take, num::NonZeroUsize, path::PathBuf, rc::Rc, sync::Arc};
use std::{mem::take, num::NonZeroUsize, path::PathBuf, rc::Rc, sync::Arc};
use tui::{buffer::Buffer as Surface, text::Span};
@ -569,18 +569,13 @@ pub fn render_bufferline(editor: &Editor, viewport: Rect, surface: &mut Surface)
let mut to_trim = needed_width.saturating_sub(viewport.width as usize);
for (idx, filename) in entries.iter().enumerate() {
let mut text = filename.as_str();
if to_trim > 0 {
match to_trim.cmp(&text.len()) {
Ordering::Less => {
if to_trim > 0 && to_trim < text.len() {
text = &filename[to_trim..];
to_trim = 0;
}
_ => {
} else if to_trim > 0 {
to_trim -= text.len();
continue;
}
}
}
let style = if idx == current_doc_idx.unwrap() {
bufferline_active
} else {