mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-14 02:57:52 +08:00
newedit/core: Unexport Highlighter.
This commit is contained in:
parent
6a625751e2
commit
31a88b7ba4
|
@ -30,8 +30,9 @@ type Editor struct {
|
|||
// that has been read.
|
||||
AfterReadline func(string)
|
||||
|
||||
// Callback for highlighting the code the user has typed.
|
||||
Highlighter Highlighter
|
||||
// Callback for computing the highlight and errors of the code the user has
|
||||
// typed.
|
||||
Highlighter func(string) (styled.Text, []error)
|
||||
|
||||
// Left-hand and right-hand prompt.
|
||||
Prompt, RPrompt Prompt
|
||||
|
@ -204,11 +205,11 @@ func (ed *Editor) Notify(note string) {
|
|||
ed.Redraw(false)
|
||||
}
|
||||
|
||||
// Highlighter is the type of callbacks for highlighting code.
|
||||
type Highlighter func(string) (styled.Text, []error)
|
||||
// Callbacks for highlighting code.
|
||||
type highlighter func(string) (styled.Text, []error)
|
||||
|
||||
// Calls the highlighter, falling back to no highlighting if hl is nil.
|
||||
func (hl Highlighter) call(code string) (styled.Text, []error) {
|
||||
func (hl highlighter) call(code string) (styled.Text, []error) {
|
||||
if hl == nil {
|
||||
return styled.Unstyled(code), nil
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ type renderSetup struct {
|
|||
prompt styled.Text
|
||||
rprompt styled.Text
|
||||
|
||||
highlighter Highlighter
|
||||
highlighter highlighter
|
||||
|
||||
initMode types.Mode
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func render(st *types.RawState, r *renderSetup) (notes, main *ui.Buffer) {
|
|||
|
||||
var transformerForPending = "underline"
|
||||
|
||||
func prepareCode(code string, dot int, pending *types.PendingCode, hl Highlighter) (
|
||||
func prepareCode(code string, dot int, pending *types.PendingCode, hl highlighter) (
|
||||
styledCode styled.Text, newDot int, errors []error) {
|
||||
|
||||
newDot = dot
|
||||
|
|
Loading…
Reference in New Issue
Block a user