public char Read()
{
var c = this.ReadCore();
if (c == '\t') {
if (! this.InCompleting) {
mGenerator = this.InitCompletement(this.GetCurrentText(false));
}
mCompletement = mGenerator();
c = string.IsNullOrEmpty(mCompletement) ? '\0': mCompletement.Last();
this.OnBufferUpdated();
}
else {
if (this.InCompleting) {
mBuf = new StringBuilder(mCompletement);
mGenerator = null;
mCompletement = null;
}
if (c == '\n') {
this.History.Add(this.Current);
this.ClearBuffer();
}
else if (c == '\b') {
if (mBuf.Length > 0) {
mBuf.Remove(mBuf.Length-1, 1);
}
}
else if (c != '\0') {
mBuf.Append(c);
}
}
return c;
}