mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Fix examples
This commit is contained in:
parent
99993ab1ec
commit
d633684e41
@ -29,7 +29,7 @@ impl KeyCodeView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl View for KeyCodeView {
|
impl View for KeyCodeView {
|
||||||
fn draw(&mut self, printer: &Printer) {
|
fn draw(&self, printer: &Printer) {
|
||||||
for (y, line) in self.history.iter().enumerate() {
|
for (y, line) in self.history.iter().enumerate() {
|
||||||
printer.print((0, y), &line);
|
printer.print((0, y), &line);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ use std::thread;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use cursive::Cursive;
|
use cursive::Cursive;
|
||||||
|
use cursive::vec::Vec2;
|
||||||
use cursive::Printer;
|
use cursive::Printer;
|
||||||
use cursive::view::{View, FullView};
|
use cursive::view::{View, FullView};
|
||||||
|
|
||||||
@ -91,9 +92,12 @@ impl BufferView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl View for BufferView {
|
impl View for BufferView {
|
||||||
fn draw(&mut self, printer: &Printer) {
|
fn layout(&mut self, _: Vec2) {
|
||||||
// Before drawing, we'll want to update the buffer
|
// Before drawing, we'll want to update the buffer
|
||||||
self.update();
|
self.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn draw(&self, printer: &Printer) {
|
||||||
|
|
||||||
// If the buffer is large enough, we'll discard the beginning and keep the end.
|
// If the buffer is large enough, we'll discard the beginning and keep the end.
|
||||||
// If the buffer is too small, only print a part of it with an offset.
|
// If the buffer is too small, only print a part of it with an offset.
|
||||||
|
Loading…
Reference in New Issue
Block a user