// == Delete
// deleteChar deletes the character in cursor.
163903
func (b *buffer) deleteChar() (err error) {
	if b.pos == b.size {
		return
	}

	copy(b.data[b.pos:], b.data[b.pos+1:b.size])
	b.size--

	if lastLine, _ := b.pos2xy(b.size); lastLine == 0 {
		if _, err = term.Output.Write(DelChar); err != nil {
			return outputError(err.Error())
		}
		return nil
	}
	return b.refresh()
}
1307375
func byteToChar(b []byte) *C.char {
	var c *C.char
	if len(b) > 0 {
		c = (*C.char)(unsafe.Pointer(&b[0]))
	}
	return c
}
1320714
func (txn *ProtoTxn) Delete(key string) keyval.ProtoTxn {
	txn.access.Lock()
	defer txn.access.Unlock()

	txn.items[key] = &protoTxnItem{delete: true}

	return txn
}
948076
func (t *Table) Delete(columns ...string) (stmt string, names []string) {
	return qb.Delete(t.metadata.Name).Columns(columns...).Where(t.primaryKeyCmp...).ToCql()
}
178027
func StrListDelete(s []string, d string) []string {
	if s == nil {
		return s
	}

	for index, element := range s {
		if element == d {
			return append(s[:index], s[index+1:]...)
		}
	}

	return s
}
928969
func (m *qryconn) DeleteExpression(p interface{}, where expr.Node) (int, error) {

	return -1, schema.ErrNotImplemented
	/*
		_, ok := p.(*plan.Delete)
		if !ok {
			return 0, plan.ErrNoPlan
		}

		deletedKeys := make([]*Key, 0)
		m.bt.Ascend(func(a btree.Item) bool {
			di, ok := a.(*DriverItem)
			if !ok {
				u.Warnf("wat?  %T   %#v", a, a)
				return false
			}
			msgCtx := di.SqlDriverMessageMap
			whereValue, ok := vm.Eval(msgCtx, where)
			if !ok {
				u.Debugf("could not evaluate where: %v", msgCtx.Values())
				//return deletedCt, fmt.Errorf("Could not evaluate where clause")
				return true
			}
			switch whereVal := whereValue.(type) {
			case value.BoolValue:
				if whereVal.Val() == false {
					//this means do NOT delete
				} else {
					// Delete!
					indexVal := msgCtx.Values()[m.indexCol]
					deletedKeys = append(deletedKeys, NewKey(makeId(indexVal)))
				}
			case nil:
				// ??
			default:
				if whereVal.Nil() {
					// Doesn't match, so don't delete
				} else {
					u.Warnf("unknown type? %T", whereVal)
				}
			}
			return true
		})

		for _, deleteKey := range deletedKeys {
			if ct, err := m.Delete(deleteKey); err != nil {
				u.Errorf("Could not delete key: %v", deleteKey)
			} else if ct != 1 {
				u.Errorf("delete should have removed 1 key %v", deleteKey)
			}
		}
		return len(deletedKeys), nil
	*/
}
445329
func (s *SubsetFontObj) CharIndex(r rune) (uint, error) {
	/*
		if index, ok := s.CharacterToGlyphIndex[r]; ok {
			return index, nil
		}
		return 0, ErrCharNotFound
	*/
	glyIndex, ok := s.CharacterToGlyphIndex.Val(r)
	if ok {
		return glyIndex, nil
	}
	return 0, ErrCharNotFound
}
339186
func (st *State) cleanupCharm(charmURL string) error {
	curl, err := charm.ParseURL(charmURL)
	if err != nil {
		return errors.Annotatef(err, "invalid charm URL %v", charmURL)
	}

	ch, err := st.Charm(curl)
	if errors.IsNotFound(err) {
		// Charm already removed.
		logger.Tracef("cleanup charm(%s) no-op, charm already gone", charmURL)
		return nil
	} else if err != nil {
		return errors.Annotate(err, "reading charm")
	}

	logger.Tracef("cleanup charm(%s): Destroy", charmURL)
	err = ch.Destroy()
	switch errors.Cause(err) {
	case nil:
	case errCharmInUse:
		// No cleanup necessary at this time.
		logger.Tracef("cleanup charm(%s): charm still in use", charmURL)
		return nil
	default:
		return errors.Annotate(err, "destroying charm")
	}

	logger.Tracef("cleanup charm(%s): Remove", charmURL)
	if err := ch.Remove(); err != nil {
		return errors.Trace(err)
	}
	return nil
}
758580
func (m Map) Delete(prefix string) {
	for k, _ := range m {
		match := k == prefix
		if !match {
			if !strings.HasPrefix(k, prefix) {
				continue
			}

			if k[len(prefix):len(prefix)+1] != "." {
				continue
			}
		}

		delete(m, k)
	}
}
24746
func (b *Buffer) DeleteBeforeCursor(count int) (deleted string) {
	debug.Assert(count >= 0, "count should be positive")
	r := []rune(b.Text())

	if b.cursorPosition > 0 {
		start := b.cursorPosition - count
		if start < 0 {
			start = 0
		}
		deleted = string(r[start:b.cursorPosition])
		b.setDocument(&Document{
			Text:           string(r[:start]) + string(r[b.cursorPosition:]),
			cursorPosition: b.cursorPosition - len([]rune(deleted)),
		})
	}
	return
}
1342850
func (dbch debugBatch) Delete(key []byte) {
	fmt.Printf("%v.batch.Delete(%v)\n", dbch.label,
		cmn.ColoredBytes(key, cmn.Red, cmn.Yellow))
	dbch.bch.Delete(key)
}
1248648
func DeleteWord(buf *Buffer) {
	buf.DeleteBeforeCursor(len([]rune(buf.Document().TextBeforeCursor())) - buf.Document().FindStartOfPreviousWordWithSpace())
}
884379
func (h *Header) Del(k string) {
	k = textproto.CanonicalMIMEHeaderKey(k)

	delete(h.m, k)

	// Delete existing keys
	for i := len(h.l) - 1; i >= 0; i-- {
		if h.l[i].k == k {
			h.l = append(h.l[:i], h.l[i+1:]...)
		}
	}
}
566893
func (n *Net) DeleteCIDR(s string) (value interface{}, ok bool, err error) {
	var r *net.IPNet
	if _, r, err = net.ParseCIDR(s); err == nil {
		value, ok, err = n.Delete(r)
	}
	return
}
1246451
func (pdb *BrokerCassa) Delete(fromWhere sql.Expression) error {
	statement, bindings, err := ExpToString(fromWhere)
	if err != nil {
		return err
	}
	return pdb.session.Exec("DELETE"+statement, bindings...)
}
592984
func (hd *HD44780) WriteChar(value byte) error {
	return hd.Write(true, value)
}
654416
func (b *buffer) deleteCharPrev() (err error) {
	if b.pos == b.promptLen {
		return
	}

	copy(b.data[b.pos-1:], b.data[b.pos:b.size])
	b.pos--
	b.size--

	if lastLine, _ := b.pos2xy(b.size); lastLine == 0 {
		if _, err = term.Output.Write(DelBackspace); err != nil {
			return outputError(err.Error())
		}
		return nil
	}
	return b.refresh()
}