mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Add some doc
This commit is contained in:
parent
602ec49332
commit
94e723d3f0
@ -22,6 +22,8 @@ fn main() {
|
||||
thread::spawn(|| { generate_logs(tx); });
|
||||
|
||||
// And sets the view to read from the other end of the channel.
|
||||
// (We use FullView to force fullscreen because
|
||||
// we have no min_size for the BufferView).
|
||||
siv.add_layer(FullView::new(BufferView::new(200, rx)));
|
||||
|
||||
siv.run();
|
||||
@ -68,8 +70,8 @@ impl BufferView {
|
||||
while let Ok(line) = self.rx.try_recv() {
|
||||
i = (i+1) % self.buffer.len();
|
||||
self.buffer[i] = line;
|
||||
self.pos = i;
|
||||
}
|
||||
self.pos = i;
|
||||
}
|
||||
|
||||
// Chain together the two parts of the buffer to appear as a circular one.
|
||||
|
@ -8,6 +8,7 @@ use std::path::Path;
|
||||
use ncurses;
|
||||
use toml;
|
||||
|
||||
/// Represents a colorpair from a Theme.
|
||||
pub type ThemeColor = i16;
|
||||
|
||||
/// Application background, where no view is present.
|
||||
|
@ -1,7 +1,9 @@
|
||||
/// Integer division that rounds up.
|
||||
pub fn div_up_usize(p: usize, q: usize) -> usize {
|
||||
div_up(p as u32, q as u32) as usize
|
||||
}
|
||||
|
||||
/// Integer division that rounds up.
|
||||
pub fn div_up(p: u32, q: u32) -> u32 {
|
||||
if p % q == 0 { p/q }
|
||||
else { 1 + p/q }
|
||||
|
@ -1,11 +1,14 @@
|
||||
use view::{View,ViewWrapper,SizeRequest,DimensionRequest};
|
||||
use vec::Vec2;
|
||||
|
||||
/// Simple wrapper view that asks for all the space it can get.
|
||||
pub struct FullView<T: View> {
|
||||
/// Wrapped view.
|
||||
pub view: T,
|
||||
}
|
||||
|
||||
impl <T: View> FullView<T> {
|
||||
/// Wraps the given view into a new FullView.
|
||||
pub fn new(view: T) -> Self {
|
||||
FullView {
|
||||
view: view,
|
||||
|
Loading…
Reference in New Issue
Block a user