blacknon / hwatch

A modern alternative to the watch command, records the differences in execution results and can check this differences at after.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

switch library to ratatui

blacknon opened this issue · comments

The library (tui-rs) we were using is no longer under development, so we switch to ratatui, which we forked.

For some reason, as soon as I switched to ratatui, watch/history disappeared...

b6e4be7

For some reason, as soon as I switched to ratatui, watch/history disappeared...

b6e4be7

The following areas are likely to be the cause of the problem.

hwatch/src/app.rs

Lines 288 to 305 in b6e4be7

// get Area's chunks
let top_chunks = Layout::default()
.constraints([Constraint::Length(header_height), Constraint::Max(0)].as_ref())
.split(total_area);
let main_chunks = Layout::default()
.constraints(
[
Constraint::Max(total_area.width - history_width),
Constraint::Length(history_width),
]
.as_ref(),
)
.direction(Direction::Horizontal)
.split(top_chunks[1]);
self.header_area.set_area(top_chunks[0]);
self.watch_area.set_area(main_chunks[0]);
self.history_area.set_area(main_chunks[1]);


The cause of the bug was found.
Constraint::Max(0) does not calculate the maximum value in ratatui and it is 0.
Therefore, it is corrected to calculate it properly.

f9cc1d6

Hey, maintainer of ratatui here. Can you point out to me the code/change that broke Constraint::Max for you? I would like to understand what happened there and possibly add a note to the changelog.

Sorry, it was a long time ago and my memory has faded.
I will look into it and if I find out, I will describe it. 🙇