Commit Diff
Commit:
84892515ec94204f7208e7492a31439f8c0f82e3
Date:
Sat Nov 27 10:52:44 2021
UTC
Message:
use download_cols to wrap the text in the download buffer
download_lines is a very small value, for a normally sized terminal is
exactly 5. This was the cause behind the download pane glitch, 5 was
used as *column number* for the reflow.
Now, to be honest, the exact width passed to wrap_page is not
important. wrap_page will only wrap the size string, which we know is
less than or equal to FMT_SCALED_STRSIZE-1 (6). We could also
hardcode the value eventually, but using download_cols reads better.
--- downloads.c
+++ downloads.c
@@ -70,7 +70,13 @@ end:
}
end:
- wrap_page(&downloadwin, download_lines);
+ /*
+ * The exact value doesn't matter, as wrap_page only considers
+ * l->line, which is the human representation of the byte
+ * counter, and we know for sure is < FMT_SCALED_STRSIZE so it
+ * fits.
+ */
+ wrap_page(&downloadwin, download_cols);
}
void
--- ui.c
+++ ui.c
@@ -98,6 +98,7 @@ int download_lines;
/* not static so we can see them from download.c */
struct buffer downloadwin;
int download_lines;
+int download_cols;
static int side_window;
static int in_side_window;
@@ -343,11 +344,12 @@ rearrange_windows(void)
if (side_window & SIDE_WINDOW_BOTTOM) {
download_lines = MIN(5, lines/2);
+ download_cols = COLS;
mvwin(download, lines - download_lines, 0);
- wresize(download, download_lines, COLS);
+ wresize(download, download_lines, download_cols);
lines -= download_lines;
- wrap_page(&downloadwin, COLS);
+ wrap_page(&downloadwin, download_cols);
}
body_lines = show_tab_bar ? --lines : lines;
--- ui.h
+++ ui.h
@@ -129,6 +129,7 @@ extern int download_lines;
extern struct buffer downloadwin;
extern int download_lines;
+extern int download_cols;
void save_excursion(struct excursion *, struct buffer *);
void restore_excursion(struct excursion *, struct buffer *);
Omar Polo