예제 #1
0
static WString sReadLn(const wchar *p)
{
	WStringBuffer wbuf;
	while(*p && *p <= ' ')
		p++;
	while(*p && !(*p == '/' && (p[1] == '/' || p[1] == '*'))) {
		if(*p <= ' ') {
			while(*++p && *p <= ' ')
				;
			if(*p && !(*p == '/' && (p[1] == '/' || p[1] == '*')))
				wbuf.Cat(' ');
		}
		else
			wbuf.Cat(*p++);
	}
	return wbuf;
}
예제 #2
0
void Console::Append(const String& s) {
	if(s.IsEmpty()) return;
	if(console) {
		String t = Filter(s, sCharFilterNoCr);
		if(*t.Last() == '\n')
			t.Trim(t.GetCount() - 1);
		Puts(t);
		return;
	}
	int l, h;
	GetSelection(l, h);
	if(GetCursor() == GetLength()) l = -1;
	EditPos p = GetEditPos();
	SetEditable();
	MoveTextEnd();
	WString t = Filter(s, sAppf).ToWString();
	int mg = sb.GetReducedViewSize().cx / GetFont().GetAveWidth();
	if(wrap_text && mg > 4) {
		int x = GetColumnLine(GetCursor()).x;
		WStringBuffer tt;
		const wchar *q = t;
		while(*q) {
			if(x > mg - 1) {
				tt.Cat('\n');
				tt.Cat("    ");
				x = 4;
			}
			x++;
			if(*q == '\n')
				x = 0;
			tt.Cat(*q++);
		}
		Paste(tt);
	}
	else
		Paste(t);
	SetReadOnly();
	if(l >= 0) {
		SetEditPos(p);
		SetSelection(l, h);
	}
}