aboutsummaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-03-26 22:18:53 +0200
committerThomas White <taw@physics.org>2018-03-26 22:20:08 +0200
commitbd4c1352535ddb2bc67adc1065a7c1902a3ac86f (patch)
treebc1bd7ef7de311bd73baa5c3332df5a64451b85c /src/frame.c
parent0338aefd86abc68337b2423a799576569ec45c48 (diff)
Ensure no empty paragraphs before deleting
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/frame.c b/src/frame.c
index c9189d2..5793e97 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1427,8 +1427,19 @@ void delete_text_from_frame(struct frame *fr, struct edit_pos p1, struct edit_po
sort_positions(&p1, &p2);
+ /* To make sure there are no nasty surprises ahead, run through the
+ * paragraphs we're about to touch, and make sure they all have at least
+ * an empty dummy run */
+ for ( i=p1.para; i<=p2.para; i++ ) {
+ struct edit_pos ep;
+ ep.para = i;
+ ep.pos = 0;
+ ep.trail = 0;
+ ensure_run(fr, ep);
+ }
+
if ( !position_editable(fr, p1) || !position_editable(fr, p2) ) {
- fprintf(stderr, "Block delete outside editable region\n");
+ fprintf(stderr, "Delete outside editable region\n");
return;
}