#include ONCE "window9.bi"

function GetCurrentIndexCharEditor(iGadget as Long) as Long export 
	
	dim as GtkTextBuffer ptr buffer
	
	dim  as GtkTextMark ptr mark
	
	dim as GtkTextIter iter
	
	buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( gadgetid(iGadget)))
	
	mark = gtk_text_buffer_get_insert (buffer)
	
	gtk_text_buffer_get_iter_at_mark (buffer, @iter, mark)
	
	return  gtk_text_iter_get_offset(@iter)	
	
End Function