gitlab.com/apertussolutions/u-root@v7.0.0+incompatible/cmds/core/elvish/edit/mode.go (about)

     1  package edit
     2  
     3  import "github.com/u-root/u-root/cmds/core/elvish/edit/ui"
     4  
     5  // Additional interfaces mode implementations may satisfy.
     6  
     7  // cursorOnModeLiner is an optional interface that modes can implement. If a
     8  // mode does and the method returns true, the cursor is placed on the modeline
     9  // when that mode is active.
    10  type cursorOnModeLiner interface {
    11  	CursorOnModeLine() bool
    12  }
    13  
    14  type replacementer interface {
    15  	// Replacement returns the part of the buffer that is replaced.
    16  	Replacement() (begin, end int, text string)
    17  }
    18  
    19  type redrawModeLiner interface {
    20  	// RedrawModelLine indicates that the modeline should be redrawn after
    21  	// listing. This is only used in completion mode now.
    22  	RedrawModeLine()
    23  }
    24  
    25  // lister is an optional interface that modes can implement. If a mode
    26  // implements this interface, the result of this method will be shown in the
    27  // listing area.
    28  type lister interface {
    29  	List(maxHeight int) ui.Renderer
    30  }
    31  
    32  // listRenderer is similar to lister, but the mode handles the rendering itself.
    33  // NOTE(xiaq): This interface is being deprecated in favor of Lister.
    34  type listRenderer interface {
    35  	// ListRender renders the listing under the given constraint of width and
    36  	// maximum height. It returns a rendered buffer.
    37  	ListRender(width, maxHeight int) *ui.Buffer
    38  }