{
this.maxLine = line;
this.maxLength = line.length;
+
+ if(style.autoSize) AutoSize();
}
}
this.maxLine = line;
}
}
+
+ if(style.autoSize) AutoSize();
}
void SelDirty()
}
ComputeLength(l1);
FindMaxLine();
- if(style.autoSize) AutoSize();
if(style.syntax && (hadComment || HasCommentOrEscape(this.line)))
{
DirtyAll();
int backDontRecord = undoBuffer.dontRecord;
undoBuffer.dontRecord = 0;
NotifyCharsAdded(master, this, &before, &after, this.pasteOperation);
- if(style.autoSize) AutoSize();
undoBuffer.dontRecord = backDontRecord;
}
if(style.syntax && (hadComment || hasComment || line != this.line))
void AutoSize()
{
- //if(created)
- {
- if(multiLine)
- {
- // todo: resize width based on largest on-screen-line extent...
- int sh = 0;
- display.FontExtent(font, " ", 1, null, &sh);
- if(sh)
- {
- int nh = 0;
- nh = lineCount * sh + 2;
- size.h = nh < minClientSize.h ? minClientSize.h : nh;
- }
- }
- else
- {
- int tw = 0;
- int sh = 0;
- int nw = 0;
- int nh = 0;
- MinMaxValue dw = 0;
- MinMaxValue dh = 0;
- int len = line ? strlen(line.text) : 0;
- GetDecorationsSize(&dw, &dh);
- display.FontExtent(font, " ", 1, null, &sh);
- if(len) display.FontExtent(font, line.text, len, &tw, null);
- nw = dw+tw+12;
- if(nw < minClientSize.w) nw = minClientSize.w;
- nh = dh+sh+4;
- if(nh < minClientSize.h) nh = minClientSize.h;
- size = { nw, nh };
- }
- }
+ int aw = maxLength + 12, ah = Max(lineCount, 1) * space.h + 2;
+ int nw = minClientSize.w, nh = minClientSize.h, xw = maxClientSize.w, xh = maxClientSize.h;
+ clientSize = { nw && aw < nw ? nw : xw && aw > xw ? xw : aw, nh && ah < nh ? nh : xh && ah > xh ? xh : ah };
}
bool OnResizing(int *w, int *h)
if(!line.AdjustBuffer(line.count-lastC))
break;
line.count-=lastC;
- if(style.autoSize) AutoSize();
DirtyLine(y);
}
break;
NotifyCharsAdded(master, this, &before, &after, this.pasteOperation);
- if(style.autoSize) AutoSize();
{
AddCharAction action { ch = '\t', x = 0, y = y };
Record(action);
int c;
BufferLocation before = { line, y, 0 }, after = { line, y, this.tabSize };
NotifyCharsAdded(master, this, &before, &after, this.pasteOperation);
- if(style.autoSize) AutoSize();
if(!line.AdjustBuffer(line.count+this.tabSize))
break;
if(line == lastLine) break;
}
}
+ ComputeLength(maxLine);
}
else
{
else
return false;
}
- if(!(style.vScroll))
+ if(!(style.autoSize && (!maxClientSize.h || maxClientSize.h > clientSize.h + this.space.h)) && !(style.vScroll))
{
// Make sure it fits, but we need a default line is this.font is too big for window
if(this.space.h * (this.lineCount+1) > clientSize.h && this.line)
after.line = this.line, after.y = this.y, after.x = this.x;
NotifyCharsAdded(master, this, &before, &after, this.pasteOperation);
- if(style.autoSize) AutoSize();
}
}
else