_id stringlengths 2 7 | title stringlengths 1 118 | partition stringclasses 3
values | text stringlengths 52 85.5k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q22200 | SetView | train | func (t *TextBar) SetView(view View) {
t.initialize()
t.view = view
t.lview.SetView(view)
t.rview.SetView(view)
t.cview.SetView(view)
t.changed = true
} | go | {
"resource": ""
} |
q22201 | Draw | train | func (t *TextBar) Draw() {
t.initialize()
if t.changed {
t.layout()
}
w, h := t.view.Size()
for y := 0; y < h; y++ {
for x := 0; x < w; x++ {
t.view.SetContent(x, y, ' ', nil, t.style)
}
}
// Draw in reverse order -- if we clip, we will clip at the
// right side.
t.right.Draw()
t.center.Draw()
t.l... | go | {
"resource": ""
} |
q22202 | Resize | train | func (t *TextBar) Resize() {
t.initialize()
t.layout()
t.left.Resize()
t.center.Resize()
t.right.Resize()
t.PostEventWidgetResize(t)
} | go | {
"resource": ""
} |
q22203 | Size | train | func (t *TextBar) Size() (int, int) {
w, h := 0, 0
ww, wh := t.left.Size()
w += ww
if wh > h {
h = wh
}
ww, wh = t.center.Size()
w += ww
if wh > h {
h = wh
}
ww, wh = t.right.Size()
w += ww
if wh > h {
h = wh
}
return w, h
} | go | {
"resource": ""
} |
q22204 | HandleEvent | train | func (t *TextBar) HandleEvent(ev tcell.Event) bool {
switch ev.(type) {
case *EventWidgetContent:
t.changed = true
return true
}
return false
} | go | {
"resource": ""
} |
q22205 | Hex | train | func (c Color) Hex() int32 {
if c&ColorIsRGB != 0 {
return (int32(c) & 0xffffff)
}
if v, ok := ColorValues[c]; ok {
return v
}
return -1
} | go | {
"resource": ""
} |
q22206 | NewRGBColor | train | func NewRGBColor(r, g, b int32) Color {
return NewHexColor(((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff))
} | go | {
"resource": ""
} |
q22207 | Invalidate | train | func (cb *CellBuffer) Invalidate() {
for i := range cb.cells {
cb.cells[i].lastMain = rune(0)
}
} | go | {
"resource": ""
} |
q22208 | Dirty | train | func (cb *CellBuffer) Dirty(x, y int) bool {
if x >= 0 && y >= 0 && x < cb.w && y < cb.h {
c := &cb.cells[(y*cb.w)+x]
if c.lastMain == rune(0) {
return true
}
if c.lastMain != c.currMain {
return true
}
if c.lastStyle != c.currStyle {
return true
}
if len(c.lastComb) != len(c.currComb) {
re... | go | {
"resource": ""
} |
q22209 | Resize | train | func (cb *CellBuffer) Resize(w, h int) {
if cb.h == h && cb.w == w {
return
}
newc := make([]cell, w*h)
for y := 0; y < h && y < cb.h; y++ {
for x := 0; x < w && x < cb.w; x++ {
oc := &cb.cells[(y*cb.w)+x]
nc := &newc[(y*w)+x]
nc.currMain = oc.currMain
nc.currComb = oc.currComb
nc.currStyle = o... | go | {
"resource": ""
} |
q22210 | Fill | train | func (cb *CellBuffer) Fill(r rune, style Style) {
for i := range cb.cells {
c := &cb.cells[i]
c.currMain = r
c.currComb = nil
c.currStyle = style
c.width = 1
}
} | go | {
"resource": ""
} |
q22211 | Watch | train | func (ww *WidgetWatchers) Watch(handler tcell.EventHandler) {
if ww.watchers == nil {
ww.watchers = make(map[tcell.EventHandler]struct{})
}
ww.watchers[handler] = struct{}{}
} | go | {
"resource": ""
} |
q22212 | Unwatch | train | func (ww *WidgetWatchers) Unwatch(handler tcell.EventHandler) {
if ww.watchers != nil {
delete(ww.watchers, handler)
}
} | go | {
"resource": ""
} |
q22213 | PostEvent | train | func (ww *WidgetWatchers) PostEvent(wev EventWidget) {
for watcher := range ww.watchers {
// Deliver events to all listeners, ignoring return value.
watcher.HandleEvent(wev)
}
} | go | {
"resource": ""
} |
q22214 | PostEventWidgetContent | train | func (ww *WidgetWatchers) PostEventWidgetContent(w Widget) {
ev := &EventWidgetContent{}
ev.SetWidget(w)
ev.SetEventNow()
ww.PostEvent(ev)
} | go | {
"resource": ""
} |
q22215 | PostEventWidgetResize | train | func (ww *WidgetWatchers) PostEventWidgetResize(w Widget) {
ev := &EventWidgetResize{}
ev.SetWidget(w)
ev.SetEventNow()
ww.PostEvent(ev)
} | go | {
"resource": ""
} |
q22216 | PostEventWidgetMove | train | func (ww *WidgetWatchers) PostEventWidgetMove(w Widget) {
ev := &EventWidgetMove{}
ev.SetWidget(w)
ev.SetEventNow()
ww.PostEvent(ev)
} | go | {
"resource": ""
} |
q22217 | SetLines | train | func (ta *TextArea) SetLines(lines []string) {
ta.Init()
m := ta.model
m.width = 0
m.height = len(lines)
m.lines = append([]string{}, lines...)
for _, l := range lines {
if len(l) > m.width {
m.width = len(l)
}
}
ta.CellView.SetModel(m)
} | go | {
"resource": ""
} |
q22218 | EnableCursor | train | func (ta *TextArea) EnableCursor(on bool) {
ta.Init()
ta.model.cursor = on
} | go | {
"resource": ""
} |
q22219 | HideCursor | train | func (ta *TextArea) HideCursor(on bool) {
ta.Init()
ta.model.hide = on
} | go | {
"resource": ""
} |
q22220 | SetContent | train | func (ta *TextArea) SetContent(text string) {
ta.Init()
lines := strings.Split(strings.Trim(text, "\n"), "\n")
ta.SetLines(lines)
} | go | {
"resource": ""
} |
q22221 | Init | train | func (ta *TextArea) Init() {
ta.once.Do(func() {
lm := &linesModel{lines: []string{}, width: 0}
ta.model = lm
ta.CellView.Init()
ta.CellView.SetModel(lm)
})
} | go | {
"resource": ""
} |
q22222 | calcY | train | func (t *Text) calcY(height int) int {
if t.align&VAlignCenter != 0 {
return (height - len(t.lengths)) / 2
}
if t.align&VAlignBottom != 0 {
return height - len(t.lengths)
}
return 0
} | go | {
"resource": ""
} |
q22223 | calcX | train | func (t *Text) calcX(width, line int) int {
if t.align&HAlignCenter != 0 {
return (width - t.lengths[line]) / 2
}
if t.align&HAlignRight != 0 {
return width - t.lengths[line]
}
return 0
} | go | {
"resource": ""
} |
q22224 | Draw | train | func (t *Text) Draw() {
v := t.view
if v == nil {
return
}
width, height := v.Size()
if width == 0 || height == 0 {
return
}
t.clear()
// Note that we might wind up with a negative X if the width
// is larger than the length. That's OK, and correct even.
// The view will clip it properly in that case.... | go | {
"resource": ""
} |
q22225 | Size | train | func (t *Text) Size() (int, int) {
if len(t.text) != 0 {
return t.width, t.height
}
return 0, 0
} | go | {
"resource": ""
} |
q22226 | SetAlignment | train | func (t *Text) SetAlignment(align Alignment) {
if align != t.align {
t.align = align
t.PostEventWidgetContent(t)
}
} | go | {
"resource": ""
} |
q22227 | SetText | train | func (t *Text) SetText(s string) {
t.width = 0
t.text = []rune(s)
if len(t.widths) < len(t.text) {
t.widths = make([]int, len(t.text))
} else {
t.widths = t.widths[0:len(t.text)]
}
if len(t.styles) < len(t.text) {
t.styles = make([]tcell.Style, len(t.text))
} else {
t.styles = t.styles[0:len(t.text)]
}
... | go | {
"resource": ""
} |
q22228 | SetStyle | train | func (t *Text) SetStyle(style tcell.Style) {
t.style = style
for i := 0; i < len(t.text); i++ {
if t.widths[i] != 0 {
t.styles[i] = t.style
}
}
t.PostEventWidgetContent(t)
} | go | {
"resource": ""
} |
q22229 | StyleAt | train | func (t *Text) StyleAt(pos int) tcell.Style {
if pos < 0 || pos >= len(t.text) || t.widths[pos] < 1 {
return tcell.StyleDefault
}
return t.styles[pos]
} | go | {
"resource": ""
} |
q22230 | SetCenter | train | func (s *SimpleStyledTextBar) SetCenter(m string) {
s.initialize()
s.center.SetMarkup(m)
} | go | {
"resource": ""
} |
q22231 | Init | train | func Init() error {
outMode = OutputNormal
if s, e := tcell.NewScreen(); e != nil {
return e
} else if e = s.Init(); e != nil {
return e
} else {
screen = s
return nil
}
} | go | {
"resource": ""
} |
q22232 | Clear | train | func Clear(fg, bg Attribute) {
st := mkStyle(fg, bg)
w, h := screen.Size()
for row := 0; row < h; row++ {
for col := 0; col < w; col++ {
screen.SetContent(col, row, ' ', nil, st)
}
}
} | go | {
"resource": ""
} |
q22233 | SetOutputMode | train | func SetOutputMode(mode OutputMode) OutputMode {
if screen.Colors() < 256 {
mode = OutputNormal
}
switch mode {
case OutputCurrent:
return outMode
case OutputNormal, Output256, Output216, OutputGrayscale:
outMode = mode
return mode
default:
return outMode
}
} | go | {
"resource": ""
} |
q22234 | ParseEvent | train | func ParseEvent(data []byte) Event {
// Not supported
return Event{Type: EventError, Err: errors.New("no raw events")}
} | go | {
"resource": ""
} |
q22235 | NewEventError | train | func NewEventError(err error) *EventError {
return &EventError{t: time.Now(), err: err}
} | go | {
"resource": ""
} |
q22236 | Foreground | train | func (s Style) Foreground(c Color) Style {
if c == ColorDefault {
return (s &^ (0x1ffffff00000000 | styleFgSet))
}
return (s &^ Style(0x1ffffff00000000)) |
((Style(c) & 0x1ffffff) << 32) | styleFgSet
} | go | {
"resource": ""
} |
q22237 | Background | train | func (s Style) Background(c Color) Style {
if c == ColorDefault {
return (s &^ (0x1ffffff | styleBgSet))
}
return (s &^ (0x1ffffff)) | (Style(c) & 0x1ffffff) | styleBgSet
} | go | {
"resource": ""
} |
q22238 | Decompose | train | func (s Style) Decompose() (fg Color, bg Color, attr AttrMask) {
if s&styleFgSet != 0 {
fg = Color(s>>32) & 0x1ffffff
} else {
fg = ColorDefault
}
if s&styleBgSet != 0 {
bg = Color(s & 0x1ffffff)
} else {
bg = ColorDefault
}
attr = AttrMask(s) & attrAll
return fg, bg, attr
} | go | {
"resource": ""
} |
q22239 | Bold | train | func (s Style) Bold(on bool) Style {
return s.setAttrs(Style(AttrBold), on)
} | go | {
"resource": ""
} |
q22240 | Blink | train | func (s Style) Blink(on bool) Style {
return s.setAttrs(Style(AttrBlink), on)
} | go | {
"resource": ""
} |
q22241 | Dim | train | func (s Style) Dim(on bool) Style {
return s.setAttrs(Style(AttrDim), on)
} | go | {
"resource": ""
} |
q22242 | Underline | train | func (s Style) Underline(on bool) Style {
return s.setAttrs(Style(AttrUnderline), on)
} | go | {
"resource": ""
} |
q22243 | Name | train | func (ev *EventKey) Name() string {
s := ""
m := []string{}
if ev.mod&ModShift != 0 {
m = append(m, "Shift")
}
if ev.mod&ModAlt != 0 {
m = append(m, "Alt")
}
if ev.mod&ModMeta != 0 {
m = append(m, "Meta")
}
if ev.mod&ModCtrl != 0 {
m = append(m, "Ctrl")
}
ok := false
if s, ok = KeyNames[ev.key]; !o... | go | {
"resource": ""
} |
q22244 | FindColor | train | func FindColor(c Color, palette []Color) Color {
match := ColorDefault
dist := float64(0)
r, g, b := c.RGB()
c1 := colorful.Color{
R: float64(r) / 255.0,
G: float64(g) / 255.0,
B: float64(b) / 255.0,
}
for _, d := range palette {
r, g, b = d.RGB()
c2 := colorful.Color{
R: float64(r) / 255.0,
G: fl... | go | {
"resource": ""
} |
q22245 | buildAcsMap | train | func (t *tScreen) buildAcsMap() {
acsstr := t.ti.AltChars
t.acs = make(map[rune]string)
for len(acsstr) > 2 {
srcv := acsstr[0]
dstv := string(acsstr[1])
if r, ok := vtACSNames[srcv]; ok {
t.acs[r] = t.ti.EnterAcs + dstv + t.ti.ExitAcs
}
acsstr = acsstr[2:]
}
} | go | {
"resource": ""
} |
q22246 | parseXtermMouse | train | func (t *tScreen) parseXtermMouse(buf *bytes.Buffer) (bool, bool) {
b := buf.Bytes()
state := 0
btn := 0
x := 0
y := 0
for i := range b {
switch state {
case 0:
switch b[i] {
case '\x1b':
state = 1
case '\x9b':
state = 2
default:
return false, false
}
case 1:
if b[i] != '[' ... | go | {
"resource": ""
} |
q22247 | Resize | train | func (b *BoxLayout) Resize() {
b.layout()
// Now also let the children know we resized.
for i := range b.cells {
b.cells[i].widget.Resize()
}
b.PostEventWidgetResize(b)
} | go | {
"resource": ""
} |
q22248 | Draw | train | func (b *BoxLayout) Draw() {
if b.view == nil {
return
}
if b.changed {
b.layout()
}
b.view.Fill(' ', b.style)
for i := range b.cells {
b.cells[i].widget.Draw()
}
} | go | {
"resource": ""
} |
q22249 | SetView | train | func (b *BoxLayout) SetView(view View) {
b.changed = true
b.view = view
for _, c := range b.cells {
c.view.SetView(view)
}
} | go | {
"resource": ""
} |
q22250 | HandleEvent | train | func (b *BoxLayout) HandleEvent(ev tcell.Event) bool {
switch ev.(type) {
case *EventWidgetContent:
// This can only have come from one of our children.
b.changed = true
b.PostEventWidgetContent(b)
return true
}
for _, c := range b.cells {
if c.widget.HandleEvent(ev) {
return true
}
}
return false
... | go | {
"resource": ""
} |
q22251 | AddWidget | train | func (b *BoxLayout) AddWidget(widget Widget, fill float64) {
c := &boxLayoutCell{
widget: widget,
fill: fill,
view: NewViewPort(b.view, 0, 0, 0, 0),
}
widget.SetView(c.view)
b.cells = append(b.cells, c)
b.changed = true
widget.Watch(b)
b.layout()
b.PostEventWidgetContent(b)
} | go | {
"resource": ""
} |
q22252 | InsertWidget | train | func (b *BoxLayout) InsertWidget(index int, widget Widget, fill float64) {
c := &boxLayoutCell{
widget: widget,
fill: fill,
view: NewViewPort(b.view, 0, 0, 0, 0),
}
c.widget.SetView(c.view)
if index < 0 {
index = 0
}
if index > len(b.cells) {
index = len(b.cells)
}
b.cells = append(b.cells, c)
co... | go | {
"resource": ""
} |
q22253 | RemoveWidget | train | func (b *BoxLayout) RemoveWidget(widget Widget) {
changed := false
for i := 0; i < len(b.cells); i++ {
if b.cells[i].widget == widget {
b.cells = append(b.cells[:i], b.cells[i+1:]...)
changed = true
}
}
if !changed {
return
}
b.changed = true
widget.Unwatch(b)
b.layout()
b.PostEventWidgetContent(b)... | go | {
"resource": ""
} |
q22254 | Widgets | train | func (b *BoxLayout) Widgets() []Widget {
w := make([]Widget, 0, len(b.cells))
for _, c := range b.cells {
w = append(w, c.widget)
}
return w
} | go | {
"resource": ""
} |
q22255 | SetOrientation | train | func (b *BoxLayout) SetOrientation(orient Orientation) {
if b.orient != orient {
b.orient = orient
b.changed = true
b.PostEventWidgetContent(b)
}
} | go | {
"resource": ""
} |
q22256 | SetStyle | train | func (b *BoxLayout) SetStyle(style tcell.Style) {
b.style = style
b.PostEventWidgetContent(b)
} | go | {
"resource": ""
} |
q22257 | mod2mask | train | func mod2mask(cks uint32) ModMask {
mm := ModNone
// Left or right control
if (cks & (0x0008 | 0x0004)) != 0 {
mm |= ModCtrl
}
// Left or right alt
if (cks & (0x0002 | 0x0001)) != 0 {
mm |= ModAlt
}
// Any shift
if (cks & 0x0010) != 0 {
mm |= ModShift
}
return mm
} | go | {
"resource": ""
} |
q22258 | mapColor2RGB | train | func mapColor2RGB(c Color) uint16 {
winLock.Lock()
if v, ok := winColors[c]; ok {
c = v
} else {
v = FindColor(c, winPalette)
winColors[c] = v
c = v
}
winLock.Unlock()
if vc, ok := vgaColors[c]; ok {
return vc
}
return 0
} | go | {
"resource": ""
} |
q22259 | mapStyle | train | func (s *cScreen) mapStyle(style Style) uint16 {
f, b, a := style.Decompose()
fa := s.oscreen.attrs & 0xf
ba := (s.oscreen.attrs) >> 4 & 0xf
if f != ColorDefault {
fa = mapColor2RGB(f)
}
if b != ColorDefault {
ba = mapColor2RGB(b)
}
var attr uint16
// We simulate reverse by doing the color swap ourselves.
... | go | {
"resource": ""
} |
q22260 | LookupStyle | train | func (t *SimpleStyledText) LookupStyle(r rune) tcell.Style {
return t.styles[r]
} | go | {
"resource": ""
} |
q22261 | NewSimpleStyledText | train | func NewSimpleStyledText() *SimpleStyledText {
ss := &SimpleStyledText{}
// Create map and establish default styles.
ss.styles = make(map[rune]tcell.Style)
ss.styles['N'] = tcell.StyleDefault
ss.styles['S'] = tcell.StyleDefault.Reverse(true)
ss.styles['U'] = tcell.StyleDefault.Underline(true)
ss.styles['B'] = tc... | go | {
"resource": ""
} |
q22262 | Draw | train | func (p *Panel) Draw() {
p.BoxLayout.SetOrientation(Vertical)
p.BoxLayout.Draw()
} | go | {
"resource": ""
} |
q22263 | SetTitle | train | func (p *Panel) SetTitle(w Widget) {
if p.title != nil {
p.RemoveWidget(p.title)
}
p.InsertWidget(0, w, 0.0)
p.title = w
} | go | {
"resource": ""
} |
q22264 | SetMenu | train | func (p *Panel) SetMenu(w Widget) {
index := 0
if p.title != nil {
index++
}
if p.menu != nil {
p.RemoveWidget(p.menu)
}
p.InsertWidget(index, w, 0.0)
p.menu = w
} | go | {
"resource": ""
} |
q22265 | SetContent | train | func (p *Panel) SetContent(w Widget) {
index := 0
if p.title != nil {
index++
}
if p.menu != nil {
index++
}
if p.content != nil {
p.RemoveWidget(p.content)
}
p.InsertWidget(index, w, 1.0)
p.content = w
} | go | {
"resource": ""
} |
q22266 | SetStatus | train | func (p *Panel) SetStatus(w Widget) {
index := 0
if p.title != nil {
index++
}
if p.menu != nil {
index++
}
if p.content != nil {
index++
}
if p.status != nil {
p.RemoveWidget(p.status)
}
p.InsertWidget(index, w, 0.0)
p.status = w
} | go | {
"resource": ""
} |
q22267 | Draw | train | func (a *CellView) Draw() {
port := a.port
model := a.model
port.Fill(' ', a.style)
if a.view == nil {
return
}
if model == nil {
return
}
vw, vh := a.view.Size()
for y := 0; y < vh; y++ {
for x := 0; x < vw; x++ {
a.view.SetContent(x, y, ' ', nil, a.style)
}
}
ex, ey := model.GetBounds()
vx, ... | go | {
"resource": ""
} |
q22268 | MakeCursorVisible | train | func (a *CellView) MakeCursorVisible() {
if a.model == nil {
return
}
x, y, enabled, _ := a.model.GetCursor()
if enabled {
a.MakeVisible(x, y)
}
} | go | {
"resource": ""
} |
q22269 | HandleEvent | train | func (a *CellView) HandleEvent(e tcell.Event) bool {
if a.model == nil {
return false
}
switch e := e.(type) {
case *tcell.EventKey:
switch e.Key() {
case tcell.KeyUp, tcell.KeyCtrlP:
a.keyUp()
return true
case tcell.KeyDown, tcell.KeyCtrlN:
a.keyDown()
return true
case tcell.KeyRight, tcell.K... | go | {
"resource": ""
} |
q22270 | Size | train | func (a *CellView) Size() (int, int) {
// We always return a minimum of two rows, and two columns.
w, h := a.model.GetBounds()
// Clip to a 2x2 minimum square; we can scroll within that.
if w > 2 {
w = 2
}
if h > 2 {
h = 2
}
return w, h
} | go | {
"resource": ""
} |
q22271 | SetModel | train | func (a *CellView) SetModel(model CellModel) {
w, h := model.GetBounds()
model.SetCursor(0, 0)
a.model = model
a.port.SetContentSize(w, h, true)
a.port.ValidateView()
a.PostEventWidgetContent(a)
} | go | {
"resource": ""
} |
q22272 | SetView | train | func (a *CellView) SetView(view View) {
port := a.port
port.SetView(view)
a.view = view
if view == nil {
return
}
width, height := view.Size()
a.port.Resize(0, 0, width, height)
if a.model != nil {
w, h := a.model.GetBounds()
a.port.SetContentSize(w, h, true)
}
a.Resize()
} | go | {
"resource": ""
} |
q22273 | Resize | train | func (a *CellView) Resize() {
// We might want to reflow text
width, height := a.view.Size()
a.port.Resize(0, 0, width, height)
a.port.ValidateView()
a.MakeCursorVisible()
} | go | {
"resource": ""
} |
q22274 | SetCursor | train | func (a *CellView) SetCursor(x, y int) {
a.cursorX = x
a.cursorY = y
a.model.SetCursor(x, y)
} | go | {
"resource": ""
} |
q22275 | SetCursorX | train | func (a *CellView) SetCursorX(x int) {
a.SetCursor(x, a.cursorY)
} | go | {
"resource": ""
} |
q22276 | SetCursorY | train | func (a *CellView) SetCursorY(y int) {
a.SetCursor(a.cursorX, y)
} | go | {
"resource": ""
} |
q22277 | MakeVisible | train | func (a *CellView) MakeVisible(x, y int) {
a.port.MakeVisible(x, y)
} | go | {
"resource": ""
} |
q22278 | Init | train | func (a *CellView) Init() {
a.once.Do(func() {
a.port = NewViewPort(nil, 0, 0, 0, 0)
a.style = tcell.StyleDefault
})
} | go | {
"resource": ""
} |
q22279 | NewSimulationScreen | train | func NewSimulationScreen(charset string) SimulationScreen {
if charset == "" {
charset = "UTF-8"
}
s := &simscreen{charset: charset}
return s
} | go | {
"resource": ""
} |
q22280 | NewEventResize | train | func NewEventResize(width, height int) *EventResize {
return &EventResize{t: time.Now(), w: width, h: height}
} | go | {
"resource": ""
} |
q22281 | End | train | func (pb *paramsBuffer) End() string {
s := pb.out.String()
pb.lk.Unlock()
return s
} | go | {
"resource": ""
} |
q22282 | TGoto | train | func (t *Terminfo) TGoto(col, row int) string {
return t.TParm(t.SetCursor, row, col)
} | go | {
"resource": ""
} |
q22283 | TColor | train | func (t *Terminfo) TColor(fi, bi int) string {
rv := ""
// As a special case, we map bright colors to lower versions if the
// color table only holds 8. For the remaining 240 colors, the user
// is out of luck. Someday we could create a mapping table, but its
// not worth it.
if t.Colors == 8 {
if fi > 7 && f... | go | {
"resource": ""
} |
q22284 | AddTerminfo | train | func AddTerminfo(t *Terminfo) {
dblock.Lock()
terminfos[t.Name] = t
for _, x := range t.Aliases {
terminfos[x] = t
}
dblock.Unlock()
} | go | {
"resource": ""
} |
q22285 | NewScreen | train | func NewScreen() (Screen, error) {
// Windows is happier if we try for a console screen first.
if s, _ := NewConsoleScreen(); s != nil {
return s, nil
} else if s, e := NewTerminfoScreen(); s != nil {
return s, nil
} else {
return nil, e
}
} | go | {
"resource": ""
} |
q22286 | initialize | train | func (app *Application) initialize() error {
if app.screen == nil {
if app.screen, app.err = tcell.NewScreen(); app.err != nil {
return app.err
}
app.screen.SetStyle(app.style)
}
return nil
} | go | {
"resource": ""
} |
q22287 | Quit | train | func (app *Application) Quit() {
ev := &eventAppQuit{}
ev.SetEventNow()
if scr := app.screen; scr != nil {
go func() { scr.PostEventWait(ev) }()
}
} | go | {
"resource": ""
} |
q22288 | Refresh | train | func (app *Application) Refresh() {
ev := &eventAppRefresh{}
ev.SetEventNow()
if scr := app.screen; scr != nil {
go func() { scr.PostEventWait(ev) }()
}
} | go | {
"resource": ""
} |
q22289 | Update | train | func (app *Application) Update() {
ev := &eventAppUpdate{}
ev.SetEventNow()
if scr := app.screen; scr != nil {
go func() { scr.PostEventWait(ev) }()
}
} | go | {
"resource": ""
} |
q22290 | PostFunc | train | func (app *Application) PostFunc(fn func()) {
ev := &eventAppFunc{fn: fn}
ev.SetEventNow()
if scr := app.screen; scr != nil {
go func() { scr.PostEventWait(ev) }()
}
} | go | {
"resource": ""
} |
q22291 | SetScreen | train | func (app *Application) SetScreen(scr tcell.Screen) {
if app.screen == nil {
app.screen = scr
app.err = nil
}
} | go | {
"resource": ""
} |
q22292 | NewEventMouse | train | func NewEventMouse(x, y int, btn ButtonMask, mod ModMask) *EventMouse {
return &EventMouse{t: time.Now(), x: x, y: y, btn: btn, mod: mod}
} | go | {
"resource": ""
} |
q22293 | moveCoverprofiles | train | func (r *SpecRunner) moveCoverprofiles(runners []*testrunner.TestRunner) {
for _, runner := range runners {
_, filename := filepath.Split(runner.CoverageFile)
err := os.Rename(runner.CoverageFile, filepath.Join(r.getOutputDir(), filename))
if err != nil {
fmt.Printf("Unable to move coverprofile %s, %v\n", ru... | go | {
"resource": ""
} |
q22294 | combineCoverprofiles | train | func (r *SpecRunner) combineCoverprofiles(runners []*testrunner.TestRunner) error {
path, _ := filepath.Abs(r.getOutputDir())
if !fileExists(path) {
return fmt.Errorf("Unable to create combined profile, outputdir does not exist: %s", r.getOutputDir())
}
fmt.Println("path is " + path)
combined, err := os.OpenF... | go | {
"resource": ""
} |
q22295 | NewServer | train | func NewServer(parallelTotal int) (*Server, error) {
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
return nil, err
}
return &Server{
listener: listener,
lock: &sync.Mutex{},
alives: make([]func() bool, parallelTotal),
beforeSuiteData: types.RemoteBeforeSuiteD... | go | {
"resource": ""
} |
q22296 | readAll | train | func (server *Server) readAll(request *http.Request) []byte {
defer request.Body.Close()
body, _ := ioutil.ReadAll(request.Body)
return body
} | go | {
"resource": ""
} |
q22297 | Skip | train | func Skip(message string, callerSkip ...int) {
skip := 0
if len(callerSkip) > 0 {
skip = callerSkip[0]
}
globalFailer.Skip(message, codelocation.New(skip+1))
panic(GINKGO_PANIC)
} | go | {
"resource": ""
} |
q22298 | PDescribe | train | func PDescribe(text string, body func()) bool {
globalSuite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1))
return true
} | go | {
"resource": ""
} |
q22299 | FWhen | train | func FWhen(text string, body func()) bool {
globalSuite.PushContainerNode("when "+text, body, types.FlagTypeFocused, codelocation.New(1))
return true
} | go | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.