github.com/jmigpin/editor@v1.6.0/util/iout/iorw/rwedit/selectline.go (about)

     1  package rwedit
     2  
     3  import (
     4  	"github.com/jmigpin/editor/util/uiutil/event"
     5  )
     6  
     7  func SelectLine(ctx *Ctx) error {
     8  	ctx.C.SetSelectionOff()
     9  	a, b, _, err := ctx.CursorSelectionLinesIndexes()
    10  	if err != nil {
    11  		return err
    12  	}
    13  	ctx.C.SetSelection(a, b)
    14  	// set primary copy
    15  	if b, ok := ctx.Selection(); ok {
    16  		ctx.Fns.SetClipboardData(event.CIPrimary, string(b))
    17  	}
    18  	return nil
    19  }