Remove wrap method from Frame
This commit is contained in:
parent
f48901f543
commit
06aefd562b
2 changed files with 2 additions and 6 deletions
|
|
@ -30,7 +30,8 @@ fn draw(f: &mut Frame) {
|
||||||
"123456789\tx\n",
|
"123456789\tx\n",
|
||||||
);
|
);
|
||||||
|
|
||||||
let breaks = f.wrap(text, f.size().width.into());
|
let width = f.size().width.into();
|
||||||
|
let breaks = f.widthdb().wrap(text, width);
|
||||||
let lines = Styled::new_plain(text).split_at_indices(&breaks);
|
let lines = Styled::new_plain(text).split_at_indices(&breaks);
|
||||||
for (i, mut line) in lines.into_iter().enumerate() {
|
for (i, mut line) in lines.into_iter().enumerate() {
|
||||||
line.trim_end();
|
line.trim_end();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ use crate::buffer::Buffer;
|
||||||
pub use crate::buffer::{Pos, Size};
|
pub use crate::buffer::{Pos, Size};
|
||||||
use crate::styled::Styled;
|
use crate::styled::Styled;
|
||||||
use crate::widthdb::WidthDb;
|
use crate::widthdb::WidthDb;
|
||||||
use crate::wrap;
|
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct Frame {
|
pub struct Frame {
|
||||||
|
|
@ -49,10 +48,6 @@ impl Frame {
|
||||||
&mut self.widthdb
|
&mut self.widthdb
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn wrap(&mut self, text: &str, width: usize) -> Vec<usize> {
|
|
||||||
wrap::wrap(&mut self.widthdb, text, width)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn write<S: Into<Styled>>(&mut self, pos: Pos, styled: S) {
|
pub fn write<S: Into<Styled>>(&mut self, pos: Pos, styled: S) {
|
||||||
self.buffer.write(&mut self.widthdb, pos, &styled.into());
|
self.buffer.write(&mut self.widthdb, pos, &styled.into());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue