Soft'N'Design Software
/
projects
/
fm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ab0e601
)
fix a segfault
author
Laurent Mazet
<mazet@softndesign.org>
Sun, 16 Mar 2025 08:04:58 +0000
(09:04 +0100)
committer
Laurent Mazet
<mazet@softndesign.org>
Sun, 16 Mar 2025 08:04:58 +0000
(09:04 +0100)
display.c
patch
|
blob
|
blame
|
history
diff --git
a/display.c
b/display.c
index 74a699c49ed18040bce6f4834c8255f403ffd53b..983469af8cc3a51e83e7efee8557c6790b6e3309 100644
(file)
--- a/
display.c
+++ b/
display.c
@@
-629,6
+629,15
@@
char *filewindow (char *name, window_t *win)
_dobound (win->xsize, win->ysize, win->xoffset, win->yoffset);
char percent[4] = {' ', ' ', ' ', 0};
+
+ if (GETSKIP (skip, sskip) + win ->ysize> len ) {
+ sskip = 0;
+ skip = len - win ->ysize;
+ if (skip < 0) {
+ skip = 0;
+ }
+ }
+
int ratio = (GETSKIP (skip, sskip) + win->ysize > len) ? 100 : 100 * (GETSKIP (skip, sskip) + win->ysize) / len;
for (i = 2; (i >= 0) && (ratio > 0); i--, ratio /= 10) {
percent[i] = '0' + (ratio % 10);