package completion

import (
	
	
)

// CompleteSyntax updates the line with either user-defined syntax completers, or with the builtin ones.
func ( *Engine) ( func([]rune, int) ([]rune, int)) {
	if  == nil {
		return
	}

	 := []rune(*.line)
	 := .cursor.Pos() - 1

	,  := (, )
	if string() == string() {
		return
	}

	++

	.line.Set(...)
	.cursor.Set()
}

// AutopairInsertOrJump checks if the character to be inserted in the line is a pair character.
// If the character is an opening one, its inserted along with its closing equivalent.
// If it's a closing one and the next character in line is the same, the cursor jumps over it.
func ( rune,  *core.Line,  *core.Cursor) ( bool) {
	,  := strutil.SurroundType()

	if ! {
		return
	}

	switch {
	case  && .Char() == :
		 = true

		.Inc()
	case  &&  != '\'' &&  != '"':
		return
	default:
		,  := strutil.MatchSurround()
		.Insert(.Pos(), )
	}

	return
}

// AutopairDelete checks if the character under the cursor is an opening pair
// character which is immediately followed by its closing equivalent. If yes,
// the closing character is removed.
func ( *core.Line,  *core.Cursor) {
	if .Pos() == 0 {
		return
	}

	 := (*)[.Pos()-1]
	,  := strutil.SurroundType()
	 := strutil.IsSurround(, .Char())

	// Cut the (closing) rune under the cursor.
	if  &&  {
		.CutRune(.Pos())
	}
}