aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-01-25 21:08:58 +0100
committerThomas White <taw@physics.org>2020-01-25 21:08:58 +0100
commit4fbcf2caee32f8efa82b98a94dab4e33dc62154f (patch)
treea4028a6df1b37c6b25411d7d2c5264130aad396f
parentc958526ab1128067dc752ffa502a04df1d4986d2 (diff)
Put the cursor in the right place after adding narrative item
-rw-r--r--libstorycode/gtk/gtknarrativeview.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libstorycode/gtk/gtknarrativeview.c b/libstorycode/gtk/gtknarrativeview.c
index b47f4a4..65d292d 100644
--- a/libstorycode/gtk/gtknarrativeview.c
+++ b/libstorycode/gtk/gtknarrativeview.c
@@ -1323,10 +1323,10 @@ int maybe_split_para(GtkNarrativeView *e)
}
-static void post_add_stuff(GtkNarrativeView *e)
+static void post_add_stuff(GtkNarrativeView *e, int para)
{
rewrap_range(e, e->cpos.para, e->cpos.para+2);
- e->cpos.para++;
+ e->cpos.para = para;
e->cpos.pos = 0;
e->cpos.trail = 0;
update_size(e);
@@ -1343,7 +1343,7 @@ void gtk_narrative_view_add_slide_at_cursor(GtkNarrativeView *e)
if ( s == NULL ) return;
insert_pos = maybe_split_para(e);
narrative_insert_slide(e->n, insert_pos, s);
- post_add_stuff(e);
+ post_add_stuff(e, insert_pos);
}
@@ -1372,7 +1372,7 @@ void gtk_narrative_view_add_prestitle_at_cursor(GtkNarrativeView *e)
if ( runs == NULL ) return;
insert_pos = maybe_split_para(e);
narrative_insert_prestitle(e->n, insert_pos, runs, 1);
- post_add_stuff(e);
+ post_add_stuff(e, insert_pos);
}
@@ -1383,7 +1383,7 @@ void gtk_narrative_view_add_segstart_at_cursor(GtkNarrativeView *e)
if ( runs == NULL ) return;
insert_pos = maybe_split_para(e);
narrative_insert_segstart(e->n, insert_pos, runs, 1);
- post_add_stuff(e);
+ post_add_stuff(e, insert_pos);
}
@@ -1392,7 +1392,7 @@ void gtk_narrative_view_add_segend_at_cursor(GtkNarrativeView *e)
int insert_pos;
insert_pos = maybe_split_para(e);
narrative_insert_segend(e->n, insert_pos);
- post_add_stuff(e);
+ post_add_stuff(e, insert_pos);
}
@@ -1403,7 +1403,7 @@ void gtk_narrative_view_add_bp_at_cursor(GtkNarrativeView *e)
if ( runs == NULL ) return;
insert_pos = maybe_split_para(e);
narrative_insert_bp(e->n, insert_pos, runs, 1);
- post_add_stuff(e);
+ post_add_stuff(e, insert_pos);
}
@@ -1411,7 +1411,7 @@ void gtk_narrative_view_add_eop_at_cursor(GtkNarrativeView *e)
{
int insert_pos = maybe_split_para(e);
narrative_insert_eop(e->n, insert_pos);
- post_add_stuff(e);
+ post_add_stuff(e, insert_pos);
}