aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sc_editor.c6
-rw-r--r--src/shape.c2
-rw-r--r--src/wrap.c6
3 files changed, 14 insertions, 0 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 463e090..4c0e58a 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -852,6 +852,12 @@ static void insert_text(char *t, SCEditor *e)
sbx = e->cursor_box;
sps = e->cursor_pos;
sbox = &e->cursor_frame->lines[sln].boxes[sbx];
+
+ if ( sbox->type == WRAP_BOX_NOTHING ) {
+ printf("Upgrading nothing box to Pango box\n");
+ return;
+ }
+
sseg = which_segment(sbox, sps, &err);
if ( err ) return;
diff --git a/src/shape.c b/src/shape.c
index 84f8f03..08ca8d1 100644
--- a/src/shape.c
+++ b/src/shape.c
@@ -114,6 +114,8 @@ static void add_nothing_box(struct wrap_line *line, SCBlock *scblock,
box->height = sc_interp_get_height(scin);
box->filename = NULL;
box->editable = editable;
+ box->segs = NULL;
+ box->n_segs = 0;
line->n_boxes++;
}
diff --git a/src/wrap.c b/src/wrap.c
index c4ce531..fa383b3 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -126,6 +126,12 @@ int which_segment(struct wrap_box *box, int pos, int *err)
int i = 0;
int ch = 0;
+ if ( box->type != WRAP_BOX_PANGO ) {
+ fprintf(stderr, "which_segment() called on wrong box type.\n");
+ *err = 1;
+ return 0;
+ }
+
do {
if ( ch + box->segs[i].len_chars >= pos ) break;
ch += box->segs[i++].len_chars;