#include ONCE "window9.bi"

function LineFromCharEditor (iGadget as Long , iIndex as Long = -1) as Long export
	
	dim as GtkTextBuffer ptr  buffer
	
	dim as gint iRow , iCol
	
	dim as GtkTextIter  iter
	
	buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( gadgetid(iGadget) ))
	
	if iIndex = -1 then
	
		gtk_text_buffer_get_iter_at_mark(buffer,@iter, gtk_text_buffer_get_insert(buffer))
		
	else
	
		gtk_text_buffer_get_iter_at_offset(buffer, @iter, iIndex)

	EndIf		
	
	return gtk_text_iter_get_line(@iter)
	
End Function