id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c171300
if variables == nil { variables = map[string]interface{}{"input": input} } else { variables["input"] = input } return c.client.Mutate(ctx, m, variables) }
c171301
< strings.ToLower(finfos[j].Name()) } sort.Slice(finfos, fnLess) for _, finfo := range finfos { if !d.fileFitsMask(finfo) { continue } if finfo.IsDir() { d.listBox.AddItem(finfo.Name() + string(os.PathSeparator)) } else { d.listBox.AddItem(finfo.Name()) } } return nil }
c171302
break } dirUp := filepath.Dir(p) if dirUp == p { p, _ = os.Getwd() break } p = dirUp } d.currPath = p }
c171303
} d.currPath = dirUp d.populateFiles() d.selectFirst() }
c171304
dir) d.populateFiles() d.selectFirst() }
c171305
c.parent.SetConstraints(0, 0) }
c171306
= make([]string, columnInTable, columnInTable) d.data[i][0] = fNames[absIndex%len(fNames)] d.data[i][1] = lNames[absIndex%len(lNames)] d.data[i][2] = fmt.Sprintf("%08d", 100+absIndex) d.data[i][3] = posts[absIndex%len(posts)] d.data[i][4] = deps[absIndex%len(deps)] d.data[i][5] = fmt.Sprintf("%d k/year", salary[absIndex%len(salary)]/1000) } // do not forget to save the last values d.firstRow = firstRow d.rowCount = rowCount }
c171307
rowValues := d.data[rowId] if col >= len(rowValues) { return "" } return rowValues[col] }
c171308
WindowManager().BeginUpdate() PushAttributes() term.Flush() PopAttributes() WindowManager().EndUpdate() } } comp.BeginUpdate() term.Flush() comp.EndUpdate() }
c171309
comp.EndUpdate() window.Draw() term.Flush() comp.activateWindow(window) RefreshScreen() return window }
c171310
newOrder = append(newOrder, windows[i]) } } if len(newOrder) == 0 { go Stop() return } c.BeginUpdate() c.windows = newOrder c.EndUpdate() c.activateWindow(c.topWindow()) }
c171311
== term.KeyCtrlQ { return true } return false }
c171312
!= AlignRight { return } l.textDisplay = align }
c171313
= make([]*Radio, 0) return c }
c171314
selected = id break } } return selected }
c171315
item.SetSelected(true) } else { item.SetSelected(false) } } return found }
c171316
found = true item.SetSelected(true) } else { item.SetSelected(false) } } return found }
c171317
append(c.items, r) r.SetGroup(c) }
c171318
p.text = []rune(str) p.defBack, p.defText = defBack, defText p.currBack, p.currText = defBack, defText return p }
c171319
ElemBackColor { if attr == ColorDefault { p.currBack = p.defBack } else { p.currBack = attr } } else if atype == ElemTextColor { if attr == ColorDefault { p.currText = p.defText } else { p.currText = attr } } return TextElement{Type: atype, Fg: p.currText, Bg: p.currBack} }
c171320
e.setTitleInternal(title) e.offset = 0 e.end() }
c171321
{ e.title = xs.Slice(e.title, 0, w) e.end() } }
c171322
e.minH) { return } if width != KeepValue { e.width = width } e.height = 1 }
c171323
canvas.attrStack = canvas.attrStack[:len(canvas.attrStack)-1] SetTextColor(a.text) SetBackColor(a.back) }
c171324
canvas.clipStack = append(canvas.clipStack, c) }
c171325
canvas.clipStack = canvas.clipStack[:len(canvas.clipStack)-1] SetClipRect(c.x, c.y, c.w, c.h) }
c171326
y >= canvas.clipY && x < canvas.clipX+canvas.clipW && y < canvas.clipY+canvas.clipH }
c171327
return } canvas.width = width canvas.height = height canvas.clipStack = make([]rect, 0) SetClipRect(0, 0, width, height) }
c171328
return cells[y*canvas.width+x], true } return term.Cell{Ch: ' '}, false }
c171329
h = canvas.height - h } canvas.clipX = x canvas.clipY = y canvas.clipW = w canvas.clipH = h }
c171330
canvas.clipY, canvas.clipW, canvas.clipH }
c171331
:= x; i < x+w; i++ { putCharUnsafe(i, y, r) } }
c171332
:= y; i < y+h; i++ { putCharUnsafe(x, i, r) } }
c171333
x = cx } text = CutText(text, cw) dx := 0 for _, ch := range text { putCharUnsafe(x+dx, y, ch) dx++ } }
c171334
{ SetTextColor(elem.Fg) SetBackColor(elem.Bg) drawn := PutChar(x, y, elem.Ch) y += 1 if firstdrawn && !drawn { break } } elem = parser.NextElement() } }
c171335
y+length < cy { return } if y < cy { text = xs.Slice(text, cy-y, -1) length = length - (cy - y) y = cy } text = CutText(text, ch) dy := 0 for _, ch := range text { putCharUnsafe(x, y+dy, ch) dy++ } }
c171336
putCharUnsafe(x, y, UL) } if InClipRect(x+w-1, y+h-1) { putCharUnsafe(x+w-1, y+h-1, DR) } if InClipRect(x, y+h-1) { putCharUnsafe(x, y+h-1, DL) } if InClipRect(x+w-1, y) { putCharUnsafe(x+w-1, y, UR) } var xx, yy, ww, hh int xx, yy, ww, _ = clip(x+1, y, w-2, 1) if ww > 0 { DrawHorizontalLine(xx, yy, ww, H) } xx, yy, ww, _ = clip(x+1, y+h-1, w-2, 1) if ww > 0 { DrawHorizontalLine(xx, yy, ww, H) } xx, yy, _, hh = clip(x, y+1, 1, h-2) if hh > 0 { DrawVerticalLine(xx, yy, hh, V) } xx, yy, _, hh = clip(x+w-1, y+1, 1, h-2) if hh > 0 { DrawVerticalLine(xx, yy, hh, V) } }
c171337
yy++ { for xx := x; xx < x+w; xx++ { putCharUnsafe(xx, yy, r) } } }
c171338
s := UnColorizeText(p) l := len(s) if l > w { w = l } } return h, w }
c171339
>= 0 && diff < l.height { return } if diff < 0 { l.topLine = l.currSelection } else { top := l.currSelection - l.height + 1 if length-top > l.height { l.topLine = top } else { l.topLine = length - l.height } } }
c171340
make([]string, 0) l.currSelection = -1 l.topLine = 0 }
c171341
= append(l.items, item) return true }
c171342
false } l.currSelection = id l.EnsureVisible() return true }
c171343
return "", false } return l.items[id], true }
c171344
|| (caseSensitive && strings.EqualFold(itm, text)) { return idx } } return -1 }
c171345
{ if caseSensitive { if strings.HasPrefix(itm, text) { return idx } } else { low := strings.ToLower(itm) if strings.HasPrefix(low, text) { return idx } } } return -1 }
c171346
} return l.items[l.currSelection] }
c171347
l.items = append(l.items[:id], l.items[id+1:]...) return true }
c171348
thememtx.RLock() sch = themeManager.themes[sch.parent] clr, okclr = sch.colors[color] thememtx.RUnlock() if ok { break } else { if _, okSch := visited[sch.parent]; okSch { panic("Color + " + color + ". Theme loop detected: " + sch.title + " --> " + sch.parent) } else { visited[sch.parent] = 1 } } } } return clr }
c171349
sch = themeManager.themes[sch.parent] obj, okobj = sch.objects[object] thememtx.RUnlock() if ok { break } else { if _, okSch := visited[sch.parent]; okSch { panic("Object: " + object + ". Theme loop detected: " + sch.title + " --> " + sch.parent) } else { visited[sch.parent] = 1 } } } } return obj }
c171350
{ return } themeManager.themePath = path ThemeReset() }
c171351
if !ok { v := value // if color starts with 'parent.' it means the parent color // must be used always. It may be useful to load inversed // text and background colors of parent theme if strings.HasPrefix(v, "parent.") { v = strings.TrimPrefix(v, "parent.") } sch, schOk := s.themes[theme.parent] if schOk { clr, ok = sch.colors[v] } else { panic(fmt.Sprintf("%v: Parent theme '%v' not found", name, theme.parent)) } } if ok { theme.colors[key] = clr } else { panic(fmt.Sprintf("%v: Failed to find color '%v' by reference", name, value)) } } else { c := StringToColor(value) if c%32 == 0 { panic("Failed to read color: " + value) } theme.colors[key] = c } } else { theme.objects[key] = value } } s.themes[name] = theme }
c171352
} thememtx.Lock() if _, ok := themeManager.themes[name]; ok { delete(themeManager.themes, name) } thememtx.Unlock() themeManager.loadTheme(name) }
c171353
var theme ThemeDesc if t, ok := themeManager.themes[name]; !ok { theme.parent = t.parent theme.title = t.title theme.version = t.version } return theme }
c171354
/ 2) right := maxWidth - left - 3 return xs.Slice(str, 0, left) + "..." + xs.Slice(str, ln-right, -1) }
c171355
str } return xs.Slice(str, 0, maxWidth) }
c171356
width - length, str } else if align == AlignCenter { return (width - length) / 2, str } return 0, str }
c171357
ColorToString(elem.Bg) + ">" } case ElemPrintable: if curr == start { if fgChanged { out += "<t:" + ColorToString(elem.Fg) + ">" } if bgChanged { out += "<b:" + ColorToString(elem.Bg) + ">" } } if curr >= start { out += string(elem.Ch) } curr++ } } return out }
c171358
if attr&term.AttrUnderline != 0 { out += "underline " } if attr&term.AttrReverse != 0 { out += "reverse " } return strings.TrimSpace(out) }
c171359
case ev := <-eventQueue: switch ev.Type { case term.EventError: panic(ev.Err) default: ProcessEvent(termboxEventToLocal(ev)) } case cmd := <-loop.channel: if cmd.Type == EventQuit { return } ProcessEvent(cmd) } } }
c171360
if width == AutoSize { width = xs.Len(text) + 1 } e.SetSize(width, 1) e.cursorPos = xs.Len(text) e.offset = 0 e.parent = parent e.readonly = false e.SetScale(scale) e.SetConstraints(width, 1) e.end() if parent != nil { parent.AddChild(e) } return e }
c171361
for _, child := range parent.Children() { if !child.Visible() { continue } check := ChildAt(child, x, y) if check != nil { ctrl = check break } } return ctrl }
c171362
ctrl.ProcessEvent(Event{Type: EventActivate, X: 0}) } DeactivateControls(ctrl) } }
c171363
ctrl.ProcessEvent(Event{Type: EventActivate, X: 1}) ctrl.SetActive(true) } } return res }
c171364
ctrl break } res = FindChild(ctrl, control) if res != nil { break } } return res }
c171365
&& ev.Key == term.MouseLeft { return true } return false }
c171366
linear := getLinearControlList(parent, fn) if len(linear) == 0 { return nil } return linear[0] }
c171367
return FindFirstControl(parent, fnActive) }
c171368
range getLinearControlList(parent, nil) { if curr.Active() { return curr } } return nil }
c171369
} } else { child = ActiveControl(parent) } if child != nil && child != parent { ev.Target = child res := child.ProcessEvent(ev) if cparent := ClippedParent(child); cparent != nil && cparent != child { cparent.ProcessEvent(ev) } return res } return false }
c171370
c.Pos() px, py := c.Paddings() x = x + px y = y + py w = w - 2*px h = h - 2*py return x, y, w, h }
c171371
= ctrl break } ctrl = ctrl.Parent() } return clipped }
c171372
ww, hh := c.Size() return xx >= x && ww <= x+w && yy <= y+h && yy+hh <= y+h && yy >= y && yy+h >= y }
c171373
{ return CreateConfirmationDialog(title, message, []string{button}, 0) }
c171374
} else if c.state == 2 { c.SetState(0) } else { if c.allow3state { c.SetState(2) } else { c.SetState(0) } } return true } return false }
c171375
< 0 { val = 0 } if val > 1 && !c.allow3state { val = 1 } if val > 2 { val = 2 } c.state = val if c.onChange != nil { go c.onChange(val) } }
c171376
c.mtx.RUnlock() return c.state }
c171377
c.state = 0 } c.allow3state = enable }
c171378
c.minH) { return } if width != KeepValue { c.width = width } c.height = 1 }
c171379
return } f.x = x f.y = y f.ResizeChildren() f.PlaceChildren() }
c171380
toShow++ break } } else if l.columns[toShow].Width == width { break } else { width -= l.columns[toShow].Width if width < 0 { break } toShow-- if toShow == 0 { break } } } l.topCol = toShow }
c171381
if diff >= 0 && diff < hgt { return } if diff < 0 { l.topRow = l.selectedRow } else { top := l.selectedRow - hgt + 1 if length-top > hgt { l.topRow = top } else { l.topRow = length - hgt } } }
c171382
len(l.columns)) copy(c, l.columns) return c }
c171383
id < len(l.columns) { l.columns[id] = col } }
c171384
func(term.Key) bool) { l.onKeyPress = fn }
c171385
l.onDrawCell = fn l.mtx.Unlock() }
c171386
} if l.selectedRow != oldSelection { l.EnsureRowVisible() l.emitSelectionChange() } }
c171387
} if l.selectedCol != oldSelection { l.EnsureColVisible() l.emitSelectionChange() } }
c171388
if c.onChange != nil { go c.onChange(val) } }
c171389
defer c.mtx.Unlock() c.onChange = fn }
c171390
copy(l.lines, text) l.applyLimit() l.calculateVirtualSize() if l.autoscroll { l.end() } }
c171391
{ l.wordWrap = wrap l.calculateVirtualSize() l.recalculateTopLine() l.Draw() } }
c171392
strings.TrimSpace(line) l.lines = append(l.lines, line) } l.applyLimit() l.calculateVirtualSize() if l.autoscroll { l.end() } return true }
c171393
l.calculateVirtualSize() if l.autoscroll { l.end() } }
c171394
b.mtx.RLock() defer b.mtx.RUnlock() return b.value }
c171395
b.value = min } if b.value > b.max { b.value = max } }
c171396
b.value++ if b.value > b.max { b.value = b.max } return b.value }
c171397
term.Attribute) { return b.emptyFg, b.emptyBg }
c171398
b.emptyFg, b.emptyBg = fg, bg }
c171399
defer b.mtx.Unlock() b.autosize = auto }