mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
bug fixes
This commit is contained in:
parent
b791a82ec6
commit
2ffba2c528
@ -118,6 +118,9 @@ impl TextContent {
|
|||||||
|
|
||||||
/// Remove lines from the beginning until we have no more than 'count' from the end
|
/// Remove lines from the beginning until we have no more than 'count' from the end
|
||||||
pub fn resize_back(&self, count: usize) {
|
pub fn resize_back(&self, count: usize) {
|
||||||
|
if self.get_content().len() <= count {
|
||||||
|
return;
|
||||||
|
}
|
||||||
self.with_content(|c| {
|
self.with_content(|c| {
|
||||||
while c.len() > count {
|
while c.len() > count {
|
||||||
c.remove(0);
|
c.remove(0);
|
||||||
@ -127,13 +130,15 @@ impl TextContent {
|
|||||||
|
|
||||||
/// Remove lines from the end until we have no more than 'count' from the beginning
|
/// Remove lines from the end until we have no more than 'count' from the beginning
|
||||||
pub fn resize_front(&self, count: usize) {
|
pub fn resize_front(&self, count: usize) {
|
||||||
|
if self.get_content().len() <= count {
|
||||||
|
return;
|
||||||
|
}
|
||||||
self.with_content(|c| {
|
self.with_content(|c| {
|
||||||
while c.len() > count {
|
while c.len() > count {
|
||||||
c.remove(c.len() - 1);
|
c.remove(c.len() - 1);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a reference to the content.
|
/// Returns a reference to the content.
|
||||||
///
|
///
|
||||||
/// This locks the data while the returned value is alive,
|
/// This locks the data while the returned value is alive,
|
||||||
|
@ -239,9 +239,9 @@ impl UI {
|
|||||||
fn node_events_view(s: &mut Cursive) -> ViewRef<CachedTextView> {
|
fn node_events_view(s: &mut Cursive) -> ViewRef<CachedTextView> {
|
||||||
s.find_name("node-events-view").unwrap()
|
s.find_name("node-events-view").unwrap()
|
||||||
}
|
}
|
||||||
// fn node_events_scroll_view(s: &mut Cursive) -> ViewRef<ScrollView<CachedTextView>> {
|
fn node_events_scroll_view(s: &mut Cursive) -> ViewRef<ScrollView<NamedView<CachedTextView>>> {
|
||||||
// s.find_name("node-events-scroll-view").unwrap()
|
s.find_name("node-events-scroll-view").unwrap()
|
||||||
// }
|
}
|
||||||
fn command_line(s: &mut Cursive) -> ViewRef<EditView> {
|
fn command_line(s: &mut Cursive) -> ViewRef<EditView> {
|
||||||
s.find_name("command-line").unwrap()
|
s.find_name("command-line").unwrap()
|
||||||
}
|
}
|
||||||
@ -894,6 +894,12 @@ impl UI {
|
|||||||
.with_name("node-events-view")
|
.with_name("node-events-view")
|
||||||
.scrollable()
|
.scrollable()
|
||||||
.scroll_strategy(cursive::view::ScrollStrategy::StickToBottom)
|
.scroll_strategy(cursive::view::ScrollStrategy::StickToBottom)
|
||||||
|
.on_scroll(|s, _r| {
|
||||||
|
let mut sv = UI::node_events_scroll_view(s);
|
||||||
|
if sv.is_at_bottom() {
|
||||||
|
sv.set_scroll_strategy(cursive::view::ScrollStrategy::StickToBottom);
|
||||||
|
}
|
||||||
|
})
|
||||||
.with_name("node-events-scroll-view"),
|
.with_name("node-events-scroll-view"),
|
||||||
)
|
)
|
||||||
.title_position(HAlign::Left)
|
.title_position(HAlign::Left)
|
||||||
|
@ -1645,7 +1645,9 @@ impl VeilidAPI {
|
|||||||
}
|
}
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
};
|
};
|
||||||
|
if ts.as_u64() == 0 {
|
||||||
|
return Ok("Failed to watch value".to_owned());
|
||||||
|
}
|
||||||
Ok(format!("Success: expiration={:?}", debug_ts(ts.as_u64())))
|
Ok(format!("Success: expiration={:?}", debug_ts(ts.as_u64())))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user