Fix some drawing bugs
parent
a8fed3a042
commit
2932dd0dc0
|
@ -189,7 +189,7 @@ impl AccountMenu {
|
||||||
if highlight && idx > 1 && self.cursor.unwrap().1 == idx - 2 {
|
if highlight && idx > 1 && self.cursor.unwrap().1 == idx - 2 {
|
||||||
change_colors(
|
change_colors(
|
||||||
grid,
|
grid,
|
||||||
((x, y), (get_x(bottom_right) + 1, y)),
|
((x, y), (get_x(bottom_right), y)),
|
||||||
color_fg,
|
color_fg,
|
||||||
color_bg,
|
color_bg,
|
||||||
);
|
);
|
||||||
|
|
|
@ -187,10 +187,17 @@ impl Default for CellBuffer {
|
||||||
|
|
||||||
impl<'a> From<&'a String> for CellBuffer {
|
impl<'a> From<&'a String> for CellBuffer {
|
||||||
fn from(s: &'a String) -> Self {
|
fn from(s: &'a String) -> Self {
|
||||||
|
let lines: Vec<&str> = s.lines().map(|l| l.trim_right()).collect();
|
||||||
let len = s.len();
|
let len = s.len();
|
||||||
let mut buf = CellBuffer::new(len, 1, Cell::default());
|
let mut buf = CellBuffer::new(len, 1, Cell::default());
|
||||||
for (idx, c) in s.chars().enumerate() {
|
let mut x = 0;
|
||||||
buf[(idx, 0)].set_ch(c);
|
for l in lines.iter() {
|
||||||
|
for (idx, c) in l.chars().enumerate() {
|
||||||
|
buf[(x + idx, 0)].set_ch(c);
|
||||||
|
}
|
||||||
|
x += l.chars().count();
|
||||||
|
buf[(x, 0)].set_ch('\n');
|
||||||
|
x += 1;
|
||||||
}
|
}
|
||||||
buf
|
buf
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
mod position;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod cells;
|
mod cells;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod helpers;
|
mod helpers;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod keys;
|
mod keys;
|
||||||
#[macro_use]
|
|
||||||
mod position;
|
|
||||||
pub use self::cells::*;
|
pub use self::cells::*;
|
||||||
pub use self::helpers::*;
|
pub use self::helpers::*;
|
||||||
pub use self::keys::*;
|
pub use self::keys::*;
|
||||||
|
|
Loading…
Reference in New Issue