bool cursorFollowsView:1;
// bool lineNumbers:1;
+ bool autoSize:1;
};
/* TODO:
property bool syntaxHighlighting { property_category "Appearance" set { style.syntax = value; } get { return style.syntax; } };
property bool noSelect { property_category "Behavior" set { style.noSelect = value; } get { return style.noSelect; } };
property bool allCaps { property_category "Behavior" set { style.allCaps = value; } get { return style.allCaps; } };
+ property bool autoSize { property_category "Behavior" set { style.autoSize = value; } get { return style.autoSize; } };
property bool wrap { set { style.wrap = value; Update(null); } get { return style.wrap; } };
//property bool lineNumbers { set { style.lineNumbers = value; } get { return style.lineNumbers; } };
property int numLines { get { return this ? lineCount : 0; } };
}
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))
return true;
}
+ 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;
+ 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 };
+ }
+ }
+ }
+
bool OnResizing(int *w, int *h)
{
if(!*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;
after.line = this.line, after.y = this.y, after.x = this.x;
NotifyCharsAdded(master, this, &before, &after, this.pasteOperation);
+ if(style.autoSize) AutoSize();
}
}
else