summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-05-12 13:06:51 -0300
committerAndrés <andmarti@gmail.com>2021-05-12 13:06:51 -0300
commit9a75045a764cb5bc4605102a0bdb97ba023df88a (patch)
tree8bd6d5fba4e4ecf5542019c2d2138122a5d0ca0f
parent695eac1028399da9dd28d1b37e34a53a0a88e3c5 (diff)
calc_offscr_sc_rows()/cols(): refresh first_frozen_after_rows/cols when decrementing rows/col to fit frozen rows/cols
-rw-r--r--CHANGES1
-rw-r--r--src/cmds.c13
-rwxr-xr-xsrc/doc2
3 files changed, 9 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index 948a419..1e2e10b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -86,6 +86,7 @@ Added :showcols command that was missing.
Handled issue #429
handled issue #374
Ignore SIGWINCH outside ncurses.
+triggers: Avoid segfault when not being able to load module. Issue #325
diff --git a/src/cmds.c b/src/cmds.c
index dd69013..0c43a41 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -68,15 +68,15 @@
void syncref(register struct enode *e);
extern int shall_quit;
char insert_edit_submode;
-struct ent * freeents = NULL; // keep deleted ents around before sync_refs
+struct ent * freeents = NULL; // keep deleted ents around before sync_refs
wchar_t interp_line[BUFFERSIZE];
extern graphADT graph;
extern int yyparse(void);
int offscr_sc_rows = 0, offscr_sc_cols = 0; // off screen spreadsheet rows and columns
-int num_frozen_after_rows = 0; // number of frozen rows after the calculated rows of calc_offscr_sc_rows()
-int first_frozen_after_rows =0; // starting point for such rows
-int num_frozen_after_cols = 0; // number of frozen cols after the calculated cols of calc_offscr_sc_cols()
+int num_frozen_after_rows = 0; // number of frozen rows after the calculated rows of calc_offscr_sc_rows()
+int first_frozen_after_rows =0; // starting point for such rows
+int num_frozen_after_cols = 0; // number of frozen cols after the calculated cols of calc_offscr_sc_cols()
int first_frozen_after_cols = 0; // starting point for such columns
int center_hidden_cols = 0; // to be removed
@@ -2374,10 +2374,10 @@ int calc_offscr_sc_rows() {
if (row_frozen[i]) {
rows--;
num_frozen_after_rows++;
+ if (i < first_frozen_after_rows) first_frozen_after_rows = i;
fmtaft += row_format[i--]; // count the screen lines needed to display them as well
continue;
}
- //rows--;
}
int changed = offscr_sc_rows;
@@ -2395,7 +2395,7 @@ int calc_offscr_sc_rows() {
} else break;
}
if (changed != offscr_sc_rows) goto count;
- //sc_info("1.OU off:%d rows%d RESROW:%d fmtbef:%d fmtaft:%d currow:%d maxrows:%d numbef:%d", offscr_sc_rows, rows, -RESROW, -fmtbef, fmtaft, currow, maxrows, numbef);
+ //sc_debug("off:%d, row_boundary:%d, num:%d first:%d", offscr_sc_rows, offscr_sc_rows + rows - num_frozen_after_rows - numbef, num_frozen_after_rows, first_frozen_after_rows);
return rows - num_frozen_after_rows - numbef;
}
@@ -2449,6 +2449,7 @@ int calc_offscr_sc_cols() {
if (col_frozen[i]) {
cols--;
num_frozen_after_cols++;
+ if (i < first_frozen_after_cols) first_frozen_after_cols = i;
fmtaft += fwidth[i--]; // count the screen lines needed to display them as well
continue;
}
diff --git a/src/doc b/src/doc
index f093bd2..7ef4730 100755
--- a/src/doc
+++ b/src/doc
@@ -401,7 +401,7 @@ Commands for handling cell content:
:q[uit]! Quit sc-im, ignoring unsaved changes.
:load {file}
- Load {file} into the sc-im database.
+ Load (or reload) {file} into the sc-im database.
{file} can be an sc format file (.sc), a comma-separated file
(.csv), a tab-separated file (.tab, .tsv),a markdown table