mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-27 15:44:17 +02:00
bug: fix overflow/underflow with graph timespan zoom (#1219)
* bug: fix overflow/underflow with graph timespan zoom Basically, you could overflow/underflow the time span which would skip checks. * changelog
This commit is contained in:
parent
76e81df715
commit
6f1a8f7e5b
@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
|
||||||
- [https://github.com/ClementTsang/bottom/pull/1216](https://github.com/ClementTsang/bottom/pull/1216): Fix arguments not being sorted alphabetically.
|
- [#1216](https://github.com/ClementTsang/bottom/pull/1216): Fix arguments not being sorted alphabetically.
|
||||||
|
- [#1219](https://github.com/ClementTsang/bottom/pull/1219): Fix overflow/underflow in graph timespan zoom.
|
||||||
|
|
||||||
## [0.9.2] - 2023-06-11
|
## [0.9.2] - 2023-06-11
|
||||||
|
|
||||||
|
36
src/app.rs
36
src/app.rs
@ -2173,8 +2173,10 @@ impl App {
|
|||||||
.widget_states
|
.widget_states
|
||||||
.get_mut(&self.current_widget.widget_id)
|
.get_mut(&self.current_widget.widget_id)
|
||||||
{
|
{
|
||||||
let new_time = cpu_widget_state.current_display_time
|
let new_time = cpu_widget_state
|
||||||
+ self.app_config_fields.time_interval;
|
.current_display_time
|
||||||
|
.saturating_add(self.app_config_fields.time_interval);
|
||||||
|
|
||||||
if new_time <= self.app_config_fields.retention_ms {
|
if new_time <= self.app_config_fields.retention_ms {
|
||||||
cpu_widget_state.current_display_time = new_time;
|
cpu_widget_state.current_display_time = new_time;
|
||||||
self.states.cpu_state.force_update = Some(self.current_widget.widget_id);
|
self.states.cpu_state.force_update = Some(self.current_widget.widget_id);
|
||||||
@ -2199,8 +2201,10 @@ impl App {
|
|||||||
.widget_states
|
.widget_states
|
||||||
.get_mut(&self.current_widget.widget_id)
|
.get_mut(&self.current_widget.widget_id)
|
||||||
{
|
{
|
||||||
let new_time = mem_widget_state.current_display_time
|
let new_time = mem_widget_state
|
||||||
+ self.app_config_fields.time_interval;
|
.current_display_time
|
||||||
|
.saturating_add(self.app_config_fields.time_interval);
|
||||||
|
|
||||||
if new_time <= self.app_config_fields.retention_ms {
|
if new_time <= self.app_config_fields.retention_ms {
|
||||||
mem_widget_state.current_display_time = new_time;
|
mem_widget_state.current_display_time = new_time;
|
||||||
self.states.mem_state.force_update = Some(self.current_widget.widget_id);
|
self.states.mem_state.force_update = Some(self.current_widget.widget_id);
|
||||||
@ -2225,8 +2229,10 @@ impl App {
|
|||||||
.widget_states
|
.widget_states
|
||||||
.get_mut(&self.current_widget.widget_id)
|
.get_mut(&self.current_widget.widget_id)
|
||||||
{
|
{
|
||||||
let new_time = net_widget_state.current_display_time
|
let new_time = net_widget_state
|
||||||
+ self.app_config_fields.time_interval;
|
.current_display_time
|
||||||
|
.saturating_add(self.app_config_fields.time_interval);
|
||||||
|
|
||||||
if new_time <= self.app_config_fields.retention_ms {
|
if new_time <= self.app_config_fields.retention_ms {
|
||||||
net_widget_state.current_display_time = new_time;
|
net_widget_state.current_display_time = new_time;
|
||||||
self.states.net_state.force_update = Some(self.current_widget.widget_id);
|
self.states.net_state.force_update = Some(self.current_widget.widget_id);
|
||||||
@ -2257,8 +2263,10 @@ impl App {
|
|||||||
.widget_states
|
.widget_states
|
||||||
.get_mut(&self.current_widget.widget_id)
|
.get_mut(&self.current_widget.widget_id)
|
||||||
{
|
{
|
||||||
let new_time = cpu_widget_state.current_display_time
|
let new_time = cpu_widget_state
|
||||||
- self.app_config_fields.time_interval;
|
.current_display_time
|
||||||
|
.saturating_sub(self.app_config_fields.time_interval);
|
||||||
|
|
||||||
if new_time >= constants::STALE_MIN_MILLISECONDS {
|
if new_time >= constants::STALE_MIN_MILLISECONDS {
|
||||||
cpu_widget_state.current_display_time = new_time;
|
cpu_widget_state.current_display_time = new_time;
|
||||||
self.states.cpu_state.force_update = Some(self.current_widget.widget_id);
|
self.states.cpu_state.force_update = Some(self.current_widget.widget_id);
|
||||||
@ -2283,8 +2291,10 @@ impl App {
|
|||||||
.widget_states
|
.widget_states
|
||||||
.get_mut(&self.current_widget.widget_id)
|
.get_mut(&self.current_widget.widget_id)
|
||||||
{
|
{
|
||||||
let new_time = mem_widget_state.current_display_time
|
let new_time = mem_widget_state
|
||||||
- self.app_config_fields.time_interval;
|
.current_display_time
|
||||||
|
.saturating_sub(self.app_config_fields.time_interval);
|
||||||
|
|
||||||
if new_time >= constants::STALE_MIN_MILLISECONDS {
|
if new_time >= constants::STALE_MIN_MILLISECONDS {
|
||||||
mem_widget_state.current_display_time = new_time;
|
mem_widget_state.current_display_time = new_time;
|
||||||
self.states.mem_state.force_update = Some(self.current_widget.widget_id);
|
self.states.mem_state.force_update = Some(self.current_widget.widget_id);
|
||||||
@ -2309,8 +2319,10 @@ impl App {
|
|||||||
.widget_states
|
.widget_states
|
||||||
.get_mut(&self.current_widget.widget_id)
|
.get_mut(&self.current_widget.widget_id)
|
||||||
{
|
{
|
||||||
let new_time = net_widget_state.current_display_time
|
let new_time = net_widget_state
|
||||||
- self.app_config_fields.time_interval;
|
.current_display_time
|
||||||
|
.saturating_sub(self.app_config_fields.time_interval);
|
||||||
|
|
||||||
if new_time >= constants::STALE_MIN_MILLISECONDS {
|
if new_time >= constants::STALE_MIN_MILLISECONDS {
|
||||||
net_widget_state.current_display_time = new_time;
|
net_widget_state.current_display_time = new_time;
|
||||||
self.states.net_state.force_update = Some(self.current_widget.widget_id);
|
self.states.net_state.force_update = Some(self.current_widget.widget_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user