id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c6500 | at the end of the byte buffer, if present.
if len(label) > 0 && label[len(label)-1] == '\x00' {
label = label[:len(label)-1]
}
return string(label), nil
} | |
c6501 | if os.IsNotExist(err) {
return nil
}
if label == "" && os.IsPermission(err) && !GetEnabled() {
return nil
}
return err
} | |
c6502 | c["user"], c["role"], c["type"], c["level"])
}
return fmt.Sprintf("%s:%s:%s", c["user"], c["role"], c["type"])
} | |
c6503 | = make(map[string]bool)
state.Unlock()
} | |
c6504 | if err != nil {
return -1
}
enforce, err = strconv.Atoi(string(enforceS))
if err != nil {
return -1
}
return enforce
} | |
c6505 | for _, prefix := range badPrefixes {
if strings.HasPrefix(fpath, prefix) {
return fmt.Errorf("relabeling content in %s is not allowed", prefix)
}
}
return nil
} | |
c6506 |
e := SetFileLabel(p, label)
if os.IsNotExist(e) {
return nil
}
return e
}
if recurse {
return filepath.Walk(fpath, callback)
}
return SetFileLabel(fpath, label)
} | |
c6507 |
}
dup := []string{"user:" + con["user"],
"role:" + con["role"],
"type:" + con["type"],
}
if con["level"] != "" {
dup = append(dup, "level:"+con["level"])
}
return dup, nil
} | |
c6508 | := range d.NestedType {
addToPathMap(info, descriptor, newPath(path, 3, index))
}
for index, descriptor := range d.EnumType {
addToPathMap(info, descriptor, newPath(path, 4, index))
}
case *descriptor.EnumDescriptorProto:
for index, descriptor := range d.Value {
addToPathMap(info, descriptor, newPath... | |
c6509 | {
pkg = "timestamp"
} else {
pkg = getPackageTypeName(*f.TypeName)
}
}
return goType(pkg, f)
} | |
c6510 |
return "[]string"
}
return "string"
case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {
return fmt.Sprintf("[]*%s%s", pkg, shortType(*f.TypeName))
}
return fmt.Sprintf("*%s%s", pkg, shortType(*f.TypeName))
case descriptor.FieldDescriptorP... | |
c6511 |
fmtd = xstrings.FirstRuneToLower(fmtd)
return formatID(s, fmtd)
} | |
c6512 | := xstrings.ToCamelCase(s)
return formatID(s, fmtd)
} | |
c6513 | some_id -> SomeID
return formatted[:len(formatted)-2] + "ID"
case strings.HasSuffix(base, "_ids"):
// some_ids -> SomeIDs
return formatted[:len(formatted)-3] + "IDs"
}
return formatted
} | |
c6514 | w.sizePolicyX = h
w.sizePolicyY = v
} | |
c6515 | painter.DrawRune(i, 0, '=')
}
for i := curr + start; i < end; i++ {
painter.DrawRune(i, 0, '-')
}
painter.DrawRune(curr, 0, '>')
} | |
c6516 | p.Style("normal"),
mask: image.Rectangle{
Min: image.ZP,
Max: s.Size(),
},
}
} | |
c6517 |
p.transforms = append(p.transforms, image.Point{x, y})
} | |
c6518 | > 0 {
p.transforms = p.transforms[:len(p.transforms)-1]
}
} | |
c6519 |
w.Resize(p.surface.Size())
p.Begin()
w.Draw(p)
p.End()
} | |
c6520 | p.mapLocalToWorld(image.Point{x, y})
p.surface.SetCursor(wp.X, wp.Y)
} | |
c6521 | wp.Y) && (wp.Y < p.mask.Max.Y) {
p.surface.SetCell(wp.X, wp.Y, r, p.style)
}
} | |
c6522 |
p.DrawRune(x, y, r)
x += runeWidth(r)
}
} | |
c6523 | < x2; x++ {
p.DrawRune(x, y, '─')
}
} | |
c6524 | y2; y++ {
p.DrawRune(x, y, '│')
}
} | |
c6525 |
case i == w-1 && j == h-1:
p.DrawRune(m, n, '┘')
case i == 0 || i == w-1:
p.DrawRune(m, n, '│')
case j == 0 || j == h-1:
p.DrawRune(m, n, '─')
}
}
}
} | |
c6526 | j < h; j++ {
for i := 0; i < w; i++ {
p.DrawRune(i+x, j+y, ' ')
}
}
} | |
c6527 | := prev.mergeIn(p.theme.Style(n))
p.SetStyle(new)
fn(p)
p.SetStyle(prev)
} | |
c6528 | p.mask.Intersect(image.Rectangle{
Min: p.mapLocalToWorld(r.Min),
Max: p.mapLocalToWorld(r.Max),
})
fn(p)
} | |
c6529 |
remaining -= utf8.RuneCountInString(l) + 1
} else {
x = remaining
break
}
}
return image.Pt(stringWidth(string(r.buf[:x])), y)
} | |
c6530 | == len(r.buf) {
return
}
r.idx++
} | |
c6531 | == '\n' {
r.idx = i
return
}
}
r.idx = 0
} | |
c6532 |
r.idx = i
return
}
}
r.idx = len(r.buf)
} | |
c6533 | = append(r.buf[:r.idx], r.buf[r.idx+1:]...)
} | |
c6534 | append(r.buf[:r.idx], r.buf[r.idx+1:]...)
} | |
c6535 | r.buf = append(r.buf[:r.idx], r.buf[r.idx+newlineIdx+1:]...)
}
} | |
c6536 | {
spaceLeft -= wordLen
}
// fmt.Printf("42: writing %q with %d spaces remaining out of %d\n", word.String(), spaceLeft, width)
word.WriteTo(&buf)
wordLen = 0
}
word.WriteRune(curr)
wordLen += runewidth.RuneWidth(curr)
prev = curr
}
// Close out the final word.
if wordLen > spaceLeft {
bu... | |
c6537 | += dx
s.topLeft.Y += dy
} | |
c6538 | s.Widget.SizeHint().Y - s.Size().Y
} | |
c6539 |
p.WithMask(image.Rectangle{Min: off, Max: s.Size().Add(off)}, func(p *Painter) {
s.Widget.Draw(p)
})
} | |
c6540 |
s.WidgetBase.Resize(size)
if s.autoscroll {
s.ScrollToBottom()
}
} | |
c6541 | i < len(c.widgets)-1 {
return c.widgets[i+1]
}
return c.widgets[0]
}
return nil
} | |
c6542 | return nil
}
return c.widgets[0]
} | |
c6543 | l.cacheSizeHint = nil
}
l.WidgetBase.Resize(size)
} | |
c6544 | }
p.WithStyle(style, func(p *Painter) {
for i, line := range lines {
p.DrawText(0, i, line)
}
})
} | |
c6545 |
max = w
}
}
sizeHint := image.Point{max, len(lines)}
l.cacheSizeHint = &sizeHint
return sizeHint
} | |
c6546 | l.cacheSizeHint = nil
l.text = text
} | |
c6547 | append(b.children, w)
} | |
c6548 |
b.children = append([]Widget{w}, b.children...)
} | |
c6549 | append(b.children, nil)
copy(b.children[i+1:], b.children[i:])
b.children[i] = w
} | |
c6550 |
b.children = append(b.children[:i], b.children[i+1:]...)
} | |
c6551 | b.children {
if w.IsFocused() {
return true
}
}
return false
} | |
c6552 | case Horizontal:
p.Translate(off.X, 0)
case Vertical:
p.Translate(0, off.Y)
}
p.WithMask(image.Rectangle{
Min: image.ZP,
Max: child.Size(),
}, func(p *Painter) {
child.Draw(p)
})
p.Restore()
off = off.Add(child.Size())
}
})
} | |
c6553 | if size.X > minSize.X {
minSize.X = size.X
}
}
}
if b.border {
minSize = minSize.Add(image.Point{2, 2})
}
return minSize
} | |
c6554 | size.X > sizeHint.X {
sizeHint.X = size.X
}
}
}
if b.border {
sizeHint = sizeHint.Add(image.Point{2, 2})
}
return sizeHint
} | |
c6555 | = b.size.Sub(image.Point{2, 2})
}
b.layoutChildren(inner)
} | |
c6556 | = string(ev.Rune)
} else {
s = "Unknown"
}
}
if len(m) != 0 {
if ev.Modifiers&ModCtrl != 0 && strings.HasPrefix(s, "Ctrl-") {
s = s[5:]
}
return fmt.Sprintf("%s+%s", strings.Join(m, "+"), s)
}
return s
} | |
c6557 | columnStretch: make(map[int]int),
rowStretch: make(map[int]int),
}
} | |
c6558 | {
x := g.colWidths[i] + coloff + border
p.DrawRune(x, y, '┼')
coloff = x
}
rowoff = y
}
}
// Draw cell content.
for i := 0; i < g.cols; i++ {
for j := 0; j < g.rows; j++ {
pos := image.Point{i, j}
wp := g.mapCellToLocal(pos)
if w, ok := g.cells[pos]; ok {
p.Translate(wp.X, wp.Y)... | |
c6559 | < g.rows; j++ {
height += g.minRowHeight(j)
}
if g.hasBorder {
width += g.cols + 1
height += g.rows + 1
}
return image.Point{width, height}
} | |
c6560 | = h
}
}
width := maxWidth * g.cols
height := maxHeight * g.rows
if g.hasBorder {
width += g.cols + 1
height += g.rows + 1
}
return image.Point{width, height}
} | |
c6561 | + 1)
inner.Y = g.size.Y - (g.rows + 1)
}
g.layoutChildren(inner)
} | |
c6562 | {
g.cells[pos] = w
} | |
c6563 | pos := image.Point{i, g.rows - 1}
g.SetCell(pos, cell)
}
} | |
c6564 | = make(map[image.Point]Widget)
} | |
c6565 | g.rowStretch[row] = stretch
} | |
c6566 |
ui.screen.Fini()
ui.quit <- struct{}{}
} | |
c6567 | runeCount := 0
var i int
for i = range s {
if runeCount >= c-n {
break
}
runeCount++
}
return s[:i]
} | |
c6568 |
p.DrawText(b.Size().X-stringWidth(b.permText), 0, b.permText)
})
} | |
c6569 | *tui.Painter) {
s.Box.Draw(p)
})
} | |
c6570 | for _, line := range lines {
if w := stringWidth(line); w > max {
max = w
}
}
return image.Point{max, e.text.heightForWidth(max)}
} | |
c6571 | padding: image.Point{x, y},
}
} | |
c6572 | p.padding.Y)
defer painter.Restore()
p.widget.Draw(painter)
} | |
c6573 | {
return p.widget.Size().Add(p.padding.Mul(2))
} | |
c6574 | p.widget.Resize(size.Sub(p.padding.Mul(2)))
} | |
c6575 | *Painter) {
lines := strings.Split(b.text, "\n")
for i, line := range lines {
p.FillRect(0, i, b.Size().X, 1)
p.DrawText(0, i, line)
}
})
} | |
c6576 | stringWidth(line); w > size.X {
size.X = w
}
}
size.Y = len(lines)
return size
} | |
c6577 | == KeyEnter && b.onActivated != nil {
b.onActivated(b)
}
} | |
c6578 | != DecorationInherit {
result.Bold = delta.Bold
}
if delta.Underline != DecorationInherit {
result.Underline = delta.Underline
}
return result
} | |
c6579 | string, i Style) {
p.styles[n] = i
} | |
c6580 | ok := p.styles[name]
return ok
} | |
c6581 |
Grid: NewGrid(cols, rows),
}
} | |
c6582 | = -1
} else if t.selected > index {
t.selected--
}
} | |
c6583 | }
p.WithStyle(style, func(p *Painter) {
p.FillRect(0, i, l.Size().X, 1)
p.DrawText(0, i, item)
})
}
} | |
c6584 | {
if w := stringWidth(item); w > width {
width = w
}
}
return image.Point{width, len(l.items)}
} | |
c6585 |
l.moveDown()
case KeyEnter:
if l.onItemActivated != nil {
l.onItemActivated(l)
}
}
switch ev.Rune {
case 'k':
l.moveUp()
case 'j':
l.moveDown()
}
} | |
c6586 | append(l.items, items...)
} | |
c6587 | = 0
l.selected = -1
if l.onSelectionChanged != nil {
l.onSelectionChanged(l)
}
} | |
c6588 |
copy(l.items[i:], l.items[i+1:])
// Shrink items by one.
l.items[len(l.items)-1] = ""
l.items = l.items[:len(l.items)-1]
if l.onSelectionChanged != nil {
l.onSelectionChanged(l)
}
} | |
c6589 | if \z (for some byte z) is not a known escape sequence
// then it appears as literal text in the string.
buf.WriteString(quoted[:2])
quoted = quoted[2:]
case '\n':
// Ignore the escape and the line break.
quoted = quoted[2:]
case 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', '\'', '"':
// One-char e... | |
c6590 | s[i] == b {
return i
}
}
return -1
} | |
c6591 | files are supposed to be Latin-1, so escape all control and high bytes.
// I'd prefer to use \x here, but Blaze does not implement
// \x in quoted strings (b/7272572).
buf.WriteByte('\\')
buf.WriteByte(hex[c>>6]) // actually octal but reusing hex digits 0-7.
buf.WriteByte(hex[(c>>3)&7])
buf.WriteByte... | |
c6592 | cr.ref = new(Comments)
}
} | |
c6593 | Int:
return float64(x.Float()), true
}
return 0, false
} | |
c6594 | if v := fn.globals[i]; v != nil {
m[id.Name] = v
}
}
return m
} | |
c6595 | (Value, error)) *Builtin {
return &Builtin{name: name, fn: fn}
} | |
c6596 | frozen list", verb)
}
if structural && l.itercount > 0 {
return fmt.Errorf("cannot %s list during iteration", verb)
}
return nil
} | |
c6597 | path for an important special case
}
return EqualDepth(x, y, maxdepth)
} | |
c6598 | CompareDepth(syntax.EQL, x, y, depth)
} | |
c6599 | return CompareDepth(op, x, y, maxdepth)
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.