mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide, CodeEditor, CtrlLib: TheIDE Console (and CodeEditor and LineEdit) optimized for smoother building experience
This commit is contained in:
parent
f89fb5cc58
commit
033a2e74e1
5 changed files with 50 additions and 32 deletions
|
|
@ -252,6 +252,7 @@ void CodeEditor::PostInsert(int pos, const WString& text) {
|
|||
if(text.GetCount() > 200 || GetRefreshInfo(pos) != refresh_info || text.Find('\n') >= 0)
|
||||
Refresh();
|
||||
else
|
||||
if(!console_mode)
|
||||
CheckSyntaxRefresh(pos, text);
|
||||
}
|
||||
WhenUpdate();
|
||||
|
|
@ -341,7 +342,7 @@ void CodeEditor::CheckBrackets()
|
|||
CancelBracketHighlight(highlight_bracket_pos0);
|
||||
CancelBracketHighlight(highlight_bracket_pos);
|
||||
if(!IsSelection()) {
|
||||
if(GetSyntax(GetCursorLine())->CheckBrackets(*this, highlight_bracket_pos0, highlight_bracket_pos)) {
|
||||
if(!console_mode && GetSyntax(GetCursorLine())->CheckBrackets(*this, highlight_bracket_pos0, highlight_bracket_pos)) {
|
||||
RefreshLine(GetLine(highlight_bracket_pos0));
|
||||
RefreshLine(GetLine(highlight_bracket_pos));
|
||||
bracket_start = GetTimeClick();
|
||||
|
|
|
|||
|
|
@ -264,6 +264,8 @@ protected:
|
|||
bool withfindreplace;
|
||||
bool wordwrap;
|
||||
bool blk0_header;
|
||||
|
||||
bool console_mode = false;
|
||||
|
||||
int ff_start_pos;
|
||||
|
||||
|
|
@ -550,6 +552,7 @@ public:
|
|||
int GetActiveAnnotationLine() const { return bar.GetActiveAnnotationLine(); }
|
||||
Size GetBarSize() const { return bar.GetSize(); }
|
||||
void HideBar() { bar.Hide(); }
|
||||
void ConsoleMode() { console_mode = true; }
|
||||
void AnimateBar(const Vector<Color>& a) { bar.SetAnimate(a); }
|
||||
void BarColor(Color c) { bar.Background(c); }
|
||||
void BarText(const String& text, Color c) { bar.Text(text, c); }
|
||||
|
|
|
|||
|
|
@ -615,6 +615,11 @@ String TextCtrl::GetEncodedLine(int i, byte charset) const
|
|||
|
||||
int TextCtrl::GetLinePos64(int64& pos) const {
|
||||
GuiLock __;
|
||||
if(pos == total) { // Appending at the end - accelerate
|
||||
int l = GetLineCount() - 1;
|
||||
pos = GetLineLength(l);
|
||||
return l;
|
||||
}
|
||||
if(pos < cpos && cpos - pos < pos && !view) {
|
||||
int i = cline;
|
||||
int64 ps = cpos;
|
||||
|
|
@ -858,10 +863,10 @@ void TextCtrl::Remove0(int pos, int size) {
|
|||
GuiLock __;
|
||||
int rmpos = pos, rmsize = size;
|
||||
PreRemove(rmpos, rmsize);
|
||||
total -= size;
|
||||
if(pos < cpos)
|
||||
cpos = cline = 0;
|
||||
int i = GetLinePos32(pos);
|
||||
total -= size; // GetLinePos32 is using total, so this mush be after it!
|
||||
DirtyFrom(i);
|
||||
WString ln = GetWLine(i);
|
||||
int sz = min(LimitSize(ln.GetLength() - pos), size);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ Console::Console() {
|
|||
input.Hide();
|
||||
serial = 0;
|
||||
HideBar();
|
||||
ConsoleMode();
|
||||
}
|
||||
|
||||
void Console::LeftDouble(Point p, dword) {
|
||||
|
|
@ -78,38 +79,43 @@ void Console::Append(const String& s) {
|
|||
Puts(t);
|
||||
return;
|
||||
}
|
||||
int l, h;
|
||||
GetSelection32(l, h);
|
||||
if(GetCursor32() == GetLength32()) l = -1;
|
||||
EditPos p = GetEditPos();
|
||||
SetEditable();
|
||||
MoveTextEnd();
|
||||
WString t = Filter(s, sAppf).ToWString();
|
||||
int mg = max(40, sb.GetReducedViewSize().cx / GetFontSize().cx);
|
||||
if(wrap_text && mg > 4) {
|
||||
int x = GetColumnLine(GetCursor32()).x;
|
||||
WStringBuffer tt;
|
||||
const wchar *q = t;
|
||||
while(*q) {
|
||||
if(x > mg - 1) {
|
||||
tt.Cat('\n');
|
||||
tt.Cat(" ");
|
||||
x = 4;
|
||||
|
||||
text_buffer << s;
|
||||
flush.KillPost([=] {
|
||||
int l, h;
|
||||
GetSelection32(l, h);
|
||||
if(GetCursor32() == GetLength32()) l = -1;
|
||||
EditPos p = GetEditPos();
|
||||
SetEditable();
|
||||
MoveTextEnd();
|
||||
WString t = Filter(text_buffer, sAppf).ToWString();
|
||||
int mg = max(40, sb.GetReducedViewSize().cx / GetFontSize().cx);
|
||||
if(wrap_text && mg > 4) {
|
||||
int x = GetColumnLine(GetCursor32()).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++);
|
||||
}
|
||||
x++;
|
||||
if(*q == '\n')
|
||||
x = 0;
|
||||
tt.Cat(*q++);
|
||||
Paste(tt);
|
||||
}
|
||||
Paste(tt);
|
||||
}
|
||||
else
|
||||
Paste(t);
|
||||
SetReadOnly();
|
||||
if(l >= 0) {
|
||||
SetEditPos(p);
|
||||
SetSelection(l, h);
|
||||
}
|
||||
else
|
||||
Paste(t);
|
||||
SetReadOnly();
|
||||
if(l >= 0) {
|
||||
SetEditPos(p);
|
||||
SetSelection(l, h);
|
||||
}
|
||||
text_buffer.Clear();
|
||||
});
|
||||
}
|
||||
|
||||
bool Console::Key(dword key, int count) {
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@ protected:
|
|||
FrameBottom<EditString> input;
|
||||
String line;
|
||||
int serial;
|
||||
|
||||
String text_buffer;
|
||||
TimeCallback flush;
|
||||
|
||||
void CheckEndGroup();
|
||||
void FlushConsole();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue