Make sure text passed to insert_text is null terminated

Based on Jesse's commit d50108e57935871125cb42f275ebc2f096448452 in
gedit.

https://bugzilla.gnome.org/show_bug.cgi?id=726390