mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-15 20:17:50 +08:00
Meaningless renames.
This commit is contained in:
parent
cfe742f62f
commit
dbce8a211f
|
@ -35,11 +35,11 @@ func (c *completion) needScrollbar() bool {
|
|||
}
|
||||
|
||||
func (c *completion) ModeLine() renderer {
|
||||
ml := modeLine{fmt.Sprintf(" COMPLETING %s ", c.completer), c.filter}
|
||||
ml := modeLineRenderer{fmt.Sprintf(" COMPLETING %s ", c.completer), c.filter}
|
||||
if !c.needScrollbar() {
|
||||
return ml
|
||||
}
|
||||
return modeLineWithScrollBar{ml,
|
||||
return modeLineWithScrollBarRenderer{ml,
|
||||
len(c.candidates), c.firstShown, c.lastShownInFull + 1}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ func (hist) Mode() ModeType {
|
|||
}
|
||||
|
||||
func (h *hist) ModeLine() renderer {
|
||||
return modeLine{fmt.Sprintf(" HISTORY #%d ", h.current), ""}
|
||||
return modeLineRenderer{fmt.Sprintf(" HISTORY #%d ", h.current), ""}
|
||||
}
|
||||
|
||||
func startHistory(ed *Editor) {
|
||||
|
|
|
@ -27,7 +27,7 @@ func (*insert) Mode() ModeType {
|
|||
// Insert mode is the default mode and has an empty mode.
|
||||
func (ins *insert) ModeLine() renderer {
|
||||
if ins.quotePaste {
|
||||
return modeLine{" INSERT (quote paste) ", ""}
|
||||
return modeLineRenderer{" INSERT (quote paste) ", ""}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func (*command) Mode() ModeType {
|
|||
}
|
||||
|
||||
func (*command) ModeLine() renderer {
|
||||
return modeLine{" COMMAND ", ""}
|
||||
return modeLineRenderer{" COMMAND ", ""}
|
||||
}
|
||||
|
||||
func startInsert(ed *Editor) {
|
||||
|
|
|
@ -39,7 +39,7 @@ func (l *listing) Mode() ModeType {
|
|||
}
|
||||
|
||||
func (l *listing) ModeLine() renderer {
|
||||
return modeLine{l.provider.ModeTitle(l.selected), l.filter}
|
||||
return modeLineRenderer{l.provider.ModeTitle(l.selected), l.filter}
|
||||
}
|
||||
|
||||
func (l *listing) List(maxHeight int) renderer {
|
||||
|
@ -116,7 +116,7 @@ func (l *listing) List(maxHeight int) renderer {
|
|||
ls := listingRenderer{lines}
|
||||
if low > 0 || high < n || lastShownIncomplete {
|
||||
// Need scrollbar
|
||||
return listingRendererWithScrollBar{ls, n, low, high, height}
|
||||
return listingWithScrollBarRenderer{ls, n, low, high, height}
|
||||
}
|
||||
return ls
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ func (n *navigation) ModeLine() renderer {
|
|||
if n.showHidden {
|
||||
title += "(show hidden) "
|
||||
}
|
||||
return modeLine{title, n.filter}
|
||||
return modeLineRenderer{title, n.filter}
|
||||
}
|
||||
|
||||
func startNav(ed *Editor) {
|
||||
|
|
|
@ -19,25 +19,25 @@ func render(r renderer, width int) *buffer {
|
|||
return b
|
||||
}
|
||||
|
||||
type modeLine struct {
|
||||
type modeLineRenderer struct {
|
||||
title string
|
||||
filter string
|
||||
}
|
||||
|
||||
func (ml modeLine) render(b *buffer) {
|
||||
func (ml modeLineRenderer) render(b *buffer) {
|
||||
b.writes(ml.title, styleForMode.String())
|
||||
b.writes(" ", "")
|
||||
b.writes(ml.filter, styleForFilter.String())
|
||||
b.dot = b.cursor()
|
||||
}
|
||||
|
||||
type modeLineWithScrollBar struct {
|
||||
modeLine
|
||||
type modeLineWithScrollBarRenderer struct {
|
||||
modeLineRenderer
|
||||
n, low, high int
|
||||
}
|
||||
|
||||
func (ml modeLineWithScrollBar) render(b *buffer) {
|
||||
ml.modeLine.render(b)
|
||||
func (ml modeLineWithScrollBarRenderer) render(b *buffer) {
|
||||
ml.modeLineRenderer.render(b)
|
||||
|
||||
scrollbarWidth := b.width - lineWidth(b.cells[len(b.cells)-1]) - 2
|
||||
if scrollbarWidth >= 3 {
|
||||
|
@ -67,12 +67,12 @@ func (ls listingRenderer) render(b *buffer) {
|
|||
}
|
||||
}
|
||||
|
||||
type listingRendererWithScrollBar struct {
|
||||
type listingWithScrollBarRenderer struct {
|
||||
listingRenderer
|
||||
n, low, high, height int
|
||||
}
|
||||
|
||||
func (ls listingRendererWithScrollBar) render(b *buffer) {
|
||||
func (ls listingWithScrollBarRenderer) render(b *buffer) {
|
||||
b1 := render(ls.listingRenderer, b.width-1)
|
||||
b.extendHorizontal(b1, 0)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user