diff options
author | mongo <andmarti@gmail.com> | 2017-02-22 15:59:08 -0300 |
---|---|---|
committer | mongo <andmarti@gmail.com> | 2017-02-22 15:59:08 -0300 |
commit | 9c0591861a825a8c6e575c6fcf3936af470237d1 (patch) | |
tree | 50da358da0b576936aa2240f3791139d97da769a /src/file.c | |
parent | 3684f63c548484fcd67e4535da1b4cd23cd7833a (diff) |
freeze ranges now are store when saving a file
Diffstat (limited to 'src/file.c')
-rw-r--r-- | src/file.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -205,8 +205,8 @@ void write_fd(register FILE *f, int r0, int c0, int rn, int cn) { if (row_hidden[r]) (void) fprintf(f, "hide %d\n", r); - //write_ranges(f); write_marks(f); + write_franges(f); write_cells(f, r0, c0, rn, cn, r0, c0); @@ -320,6 +320,23 @@ void write_fd(register FILE *f, int r0, int c0, int rn, int cn) { fprintf(f, "\n"); } +void write_franges(register FILE *f) { + if (! freeze_ranges) return; + if (freeze_ranges->type == 'a') { + fprintf(f, "freeze %s%d", coltoa(freeze_ranges->tl->col), freeze_ranges->tl->row); + fprintf(f, ":%s%d\n", coltoa(freeze_ranges->br->col), freeze_ranges->br->row); + } else if (freeze_ranges->type == 'c' && freeze_ranges->tl->col == freeze_ranges->br->col) { + fprintf(f, "freeze %s\n", coltoa(freeze_ranges->tl->col)); + } else if (freeze_ranges->type == 'c') { + fprintf(f, "freeze %s:", coltoa(freeze_ranges->tl->col)); + fprintf(f, "%s\n", coltoa(freeze_ranges->br->col)); + } else if (freeze_ranges->type == 'r' && freeze_ranges->tl->row == freeze_ranges->br->row) { + fprintf(f, "freeze %d\n", freeze_ranges->tl->row); + } else if (freeze_ranges->type == 'r') { + fprintf(f, "freeze %d:%d\n", freeze_ranges->tl->row, freeze_ranges->br->row); + } +} + void write_marks(register FILE *f) { int i; struct mark * m; |