summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-06-16 09:43:49 -0300
committerAndrés <andmarti@gmail.com>2021-06-16 09:43:49 -0300
commita17b8e773800a1a9609ff55ea964e77d2bd5c978 (patch)
treec67870f5c045f0a72d9b1c5424f95884f0180089
parent362e462d6ed36daf5c1103fade84b801fd821cb8 (diff)
parente97db9da1442464c8638804af784f8a29c9ea2bd (diff)
Merge work done by @npitre on issue #578
-rw-r--r--src/tui.c24
-rw-r--r--src/tui.h2
2 files changed, 19 insertions, 7 deletions
diff --git a/src/tui.c b/src/tui.c
index 8a3f690..be0006c 100644
--- a/src/tui.c
+++ b/src/tui.c
@@ -435,14 +435,19 @@ void ui_update(int header) {
* frozen rows/cols, the fewer mobile rows/cols.
*/
int nb_mobile_cols = calc_mobile_cols(sh, NULL);
- int nb_mobile_rows = calc_mobile_rows(sh, NULL);
// Show sc_col headings: A, B, C, D..
ui_show_sc_col_headings(main_win, nb_mobile_cols);
- // Show the content of the cells
- // Numeric values, strings.
- ui_show_content(main_win, nb_mobile_rows, nb_mobile_cols);
+ int nb_mobile_rows;
+ int redraw_needed;
+ do {
+ nb_mobile_rows = calc_mobile_rows(sh, NULL);
+
+ // Show the content of the cells
+ // Numeric values, strings.
+ redraw_needed = ui_show_content(main_win, nb_mobile_rows, nb_mobile_cols);
+ } while (redraw_needed);
// Show sc_row headings: 0, 1, 2, 3..
ui_show_sc_row_headings(main_win, nb_mobile_rows); // schow_sc_row_headings must be after show_content
@@ -809,10 +814,11 @@ void ui_show_sc_col_headings(WINDOW * win, int nb_mobile_cols) {
*
* \return none
*/
-void ui_show_content(WINDOW * win, int nb_mobile_rows, int nb_mobile_cols) {
+int ui_show_content(WINDOW * win, int nb_mobile_rows, int nb_mobile_cols) {
struct roman * roman = session->cur_doc;
struct sheet * sh = roman->cur_sh;
int row, col;
+ int redraw_needed = FALSE;
srange * s = get_selected_range();
int conf_underline_grid = get_conf_int("underline_grid");
@@ -1013,7 +1019,11 @@ void ui_show_content(WINDOW * win, int nb_mobile_rows, int nb_mobile_cols) {
if (!conf_truncate && !conf_overlap && conf_autowrap) {
// auto wrap
int newheight = (wcslen(out) + sh->fwidth[col] - 1) / sh->fwidth[col];
- if (sh->row_format[row] < newheight) sh->row_format[row] = newheight;
+ if (sh->row_format[row] < newheight) {
+ sh->row_format[row] = newheight;
+ /* calc_mobile_rows() didn't know about this */
+ redraw_needed = TRUE;
+ }
}
if (!conf_overlap || sh->row_format[row] != 1) {
@@ -1056,6 +1066,8 @@ void ui_show_content(WINDOW * win, int nb_mobile_rows, int nb_mobile_cols) {
}
winrow += sh->row_format[row];
}
+
+ return redraw_needed;
}
diff --git a/src/tui.h b/src/tui.h
index 1f46c8f..fef0459 100644
--- a/src/tui.h
+++ b/src/tui.h
@@ -91,7 +91,7 @@ void ui_start_colors();
void ui_sc_msg(char * s, int type, ...);
void ui_set_ucolor(WINDOW * w, struct ucolor * uc, int bg_override);
-void ui_show_content(WINDOW * win, int mxrow, int mxcol);
+int ui_show_content(WINDOW * win, int mxrow, int mxcol);
void ui_show_sc_row_headings(WINDOW * win, int mxrow);
void ui_show_sc_col_headings(WINDOW * win, int mxcol);
void ui_add_cell_detail(char * d, struct ent * p1);