package mode

import (
	
	
)

// Stub is a mode that just shows a modeline and keeps the focus on the code
// area. It is mainly useful to apply some special non-default bindings.
type Stub interface {
	tk.Widget
}

// StubSpec specifies the configuration for the stub mode.
type StubSpec struct {
	// Key bindings.
	Bindings tk.Bindings
	// Name to show in the modeline.
	Name string
}

type stub struct {
	StubSpec
}

func ( stub) (,  int) *term.Buffer {
	 := term.NewBufferBuilder().
		WriteStyled(modeLine(.Name, false)).SetDotHere().Buffer()
	.TrimToLines(0, )
	return 
}

func ( stub) ( term.Event) bool {
	return .Bindings.Handle(, )
}

func ( stub) () bool {
	return false
}

// NewStub creates a new Stub mode.
func ( StubSpec) Stub {
	if .Bindings == nil {
		.Bindings = tk.DummyBindings{}
	}
	return stub{}
}