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