fix: Prevent crash in fteapot when rendering very narrow columns (#76)
Co-authored-by: Glen Whitney <glen@studioinfinity.org> Reviewed-on: #76
This commit is contained in:
parent
efdd63d351
commit
118374c46e
8
INSTALL
8
INSTALL
@ -1,6 +1,14 @@
|
||||
The new build system uses CMake (http://www.cmake.org). It handles
|
||||
all platform differences.
|
||||
|
||||
Once all prerequisites are in place, you should be able to build teapot via
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
In addition to the information in the README.md file on prerequisites, here
|
||||
are some additional guidelines:
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef WK1_H
|
||||
#define WK1_H
|
||||
/* Functions for reading Lotus 1-2-3 file format. */
|
||||
|
||||
#include "sheet.h"
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* Notes */ /*{{{C}}}*//*{{{*/
|
||||
/*
|
||||
This file contains code to read the legacy binary XDR format for
|
||||
spreadsheet files, typically written in files with the .tp extension.
|
||||
|
||||
xdr_enum() is unusable, because enum_t may have a different size than
|
||||
an enum. The construction
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef XDR_H
|
||||
#define XDR_H
|
||||
/* Functions used for reading the legacy XDR binary file format */
|
||||
|
||||
/* Thanks to curses. */
|
||||
#if 0
|
||||
|
@ -78,6 +78,12 @@ class TeapotTable {open : {public Fl_Table}}
|
||||
{draw_cell(TableContext context, int R, int C, int xx, int yy,
|
||||
int W, int H)} {open return_type void} {code
|
||||
{
|
||||
// Fl_Table calls this function to draw each visible cell in the table.
|
||||
// context specifies what part of the table is being drawn;
|
||||
// R and C give the row and column of the cell in the table;
|
||||
// xx and yy give the screen coordinates where the cell is to be drawn;
|
||||
// and W and H give the width and height of the rectangle into which to
|
||||
// draw.
|
||||
char s[1024];
|
||||
if (debug_level > 2)
|
||||
printf("DRAW: %i @%i,%i - (%i,%i) %ix%i\\n",
|
||||
@ -167,13 +173,14 @@ class TeapotTable {open : {public Fl_Table}}
|
||||
if (sc.italic) cellfont |= FL_ITALIC;
|
||||
fl_font(cellfont, 14);
|
||||
|
||||
size_t len = printvalue(s, sizeof(s), 0, quote, sc.fform,
|
||||
size_t ulen = printvalue(s, sizeof(s), 0, quote, sc.fform,
|
||||
sc.precision, cursheet, test);
|
||||
size_t nlen = len;
|
||||
ptrdiff_t len = ulen;
|
||||
ptrdiff_t nlen = len;
|
||||
int ww = 0, hh = 0;
|
||||
fl_measure(s, ww, hh, 0);
|
||||
while (ww > W-6) {
|
||||
char *dc = mbspos(s+nlen-1, -1);
|
||||
char *dc = mbspos(s+nlen, -1);
|
||||
nlen = dc - s;
|
||||
s[nlen] = (char)0;
|
||||
ww = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user