dankamongmen / growlight

notcurses block device manager / system installation tool
https://nick-black.com/dankwiki/index.php/Growlight
GNU General Public License v3.0
85 stars 12 forks source link

Not always drawing top on bottom-truncated adapters #92

Closed dankamongmen closed 3 years ago

dankamongmen commented 3 years ago

Since fixing #88, we're pretty much correct on the UI front, save that we sometimes leave the top off of adapters truncated on the bottom. See attached.

2020-10-07-013124_722x857_scrot

dankamongmen commented 3 years ago

For the attached screenshot, here are the callbacks from our app's perspective:

REDRAW--------------------------------------
DRAW ADAPTER Virtual devices DRAWT/B: 1/1
bevel 0x7f414c0238a0: 11x79 DT: 1 DB: 1
DREW ADAPTER Virtual devices
total lines: 5 line: 50 rows: 56
DRAW ADAPTER Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller DRAWT/B: 1/1
bevel 0x7f414c006130: 7x79 DT: 1 DB: 1
DREW ADAPTER Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller
total lines: 3 line: 44 rows: 48
DRAW ADAPTER Sandisk Corp WD Black 2018 / PC SN720 NVMe SSD DRAWT/B: 1/1
bevel 0x7f414c0064e0: 5x79 DT: 1 DB: 1
DREW ADAPTER Sandisk Corp WD Black 2018 / PC SN720 NVMe SSD
total lines: 3 line: 38 rows: 42
DRAW ADAPTER Intel Corporation unknown model DRAWT/B: 1/1
bevel 0x7f414c023960: 5x79 DT: 1 DB: 1
DREW ADAPTER Intel Corporation unknown model
total lines: 3 line: 32 rows: 36
DRAW ADAPTER Sandisk Corp WD Black 2018 / PC SN720 NVMe SSD DRAWT/B: 1/1
bevel 0x7f414c003040: 5x79 DT: 1 DB: 1
DREW ADAPTER Sandisk Corp WD Black 2018 / PC SN720 NVMe SSD
total lines: 24 line: 5 rows: 30
DRAW ADAPTER Broadcom / LSI SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] DRAWT/B: 1/1
bevel 0x7f414c003e30: 26x79 DT: 1 DB: 1
DREW ADAPTER Broadcom / LSI SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon]
total lines: 6 line: -4 rows: 3
DRAW ADAPTER Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] DRAWT/B: 0/1
bevel 0x7f414c015ef0: 3x79 DT: 0 DB: 1
DREW ADAPTER Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode]
REDRAW--------------------------------------

2020-11-17-212218_802x1417_scrot

dankamongmen commented 3 years ago

So what's going on here is that it looks like we're drawing from the bottom up, and then that's reversed when we actually display. The topmost tablet is the Virtual bus, and yet it's drawn the lowest, at row 50. We then work backwards towards the bottom -- USB, NVMe, NVMe, NVMe, SAS, and finally AHCI at line -4. Since this one is drawn above the top border, we don't draw the top border of this adapter, which is exactly correct.

So this, I'm pretty certain, is a Notcurses bug. It can freely reorder things, but it can't tell us "you're gonna be drawn above the top of the reel", and then move us below the bottom of the reel.

dankamongmen commented 3 years ago

Is it possible that we ought actually just be keying off drawfromtop, which is 1 for all of these?

dankamongmen commented 3 years ago

Yeah, that actually got it, sweet! We're not completely fixed, though, because while we're drawing the correct border now, we're not drawing the internals correctly, nor are we labeling correctly (because those are still keying off our flawed drawtop/drawbot approach). But progress!

dankamongmen commented 3 years ago

Creating a new bug for the internals, marking this closed. Fix is present in 1.2.20.