Commit Diff
Commit:
84892515ec94204f7208e7492a31439f8c0f82e3
From:
Omar Polo <op@omarpolo.com>
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.
commit - 4cb3882fc37e82ef668967ce6c12f1d24f558e79
commit + 84892515ec94204f7208e7492a31439f8c0f82e3
blob - 7eac1ea80b9e83a4ba9fc7682a396035f8ab5fa1
blob + 2c73f2f2bc4d359f0c0d2656f433383400dc4a3d
--- 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
blob - 6c42e5806cab85597ac2d28fd336ae5f9c539be5
blob + d3daf6676325507906928c647dd44905b605dc83
--- 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;
blob - bdcb4079be72b7857407318281256c69b7c064db
blob + 91f25e72264b4b2b92e490dcce6e798344b7166e
--- 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