{
if(this)
{
+ undoBuffer.dontRecord++;
Deselect();
DelCh(this.lines.first, 0, 0, this.lines.last, this.lineCount-1, ((EditLine)(this.lines.last)).count, true);
if(value)
//SetViewToCursor(true);
UpdateDirty();
Home();
+ undoBuffer.dontRecord--;
}
}
int caretX, caretY;
UndoBuffer undoBuffer { data = this };
int savedAction;
- Color selectionColor, selectionText;
+ ColorAlpha selectionColor, selectionText;
SyntaxColorScheme colorScheme { };
menu = Menu { };
if(!wasEscaped)
escaped = true;
}
- else if(!inQuotes && !inString && !inMultiLineComment && !inSingleLineComment &&
- ( ( isdigit(word[0]) /*&& (!c || word[-1] == ' ' || word[-1] == '\t')*/ ) || (word[0] == '.' && isdigit(word[1]))))
+ else if(!inQuotes && !inString && !inMultiLineComment && !inSingleLineComment && (isdigit(word[0]) || (word[0] == '.' && isdigit(word[1]))))
{
- newTextColor = colorScheme.numberColor;
+ char * dot = strchr(word, '.');
+ char * s = null;
+ if(dot)
+ strtod((dot == word + wordLen) ? (dot+1) : word, &s);
+ else
+ strtol(word, &s, 0);
+ if(s && s != word)
+ {
+ if((dot && *s == 'f' && !isalnum(s[1]) && s[1] != '_') || (!isalpha(*s) && *s != '_'))
+ {
+ int newWordLen = s + ((*s == 'f') ? 1 : 0) - word;
+ newTextColor = colorScheme.numberColor;
+ c += newWordLen - wordLen;
+ wordLen = newWordLen;
+ }
+ else if(dot && dot > word && (isalpha(dot[1]) || dot[1] == '_'))
+ newTextColor = colorScheme.numberColor;
+ }
}
else
{
if(x > selX)
{
if(x > line.count)
- width = Max(line.length + (x - line.count) * space.w, maxLength);
+ width = Max(line.length + (x - line.count) * space.w, maxLength + XOFFSET);
}
else
{
if(selX > selLine.count)
- width = Max(selLine.length + (selX - selLine.count) * space.w, maxLength);
+ width = Max(selLine.length + (selX - selLine.count) * space.w, maxLength + XOFFSET);
}
}
{
key.code = (SmartKey)key.code;
}
+ else if(!ch && key.alt)
+ key.code = 0;
switch(key.code) //(ch || key.alt || key.ctrl) ? key.code : (Key)(SmartKey)key.code)
{
case home:
{
if(style.stuckCaret) break;
+ if(!style.multiLine && key.ctrl) break;
if(!(style.freeCaret))
this.selX = Min(this.selX, this.selLine.count);
for(c=0; line.buffer[c]; c++)
if(line.buffer[c] != ' ' && line.buffer[c] != '\t')
break;
- if(c != 0 || this.x)
+ if(shift && (c != 0 || this.x))
DirtyLine(this.y);
if(this.x != c)
this.x = c;
}
else
{
- /*if(this.x != 0)
- DirtyLine(this.y);*/
+ if(shift && this.x != 0)
+ DirtyLine(this.y);
this.x = 0;
}
ComputeColumn();
case end:
{
if(style.stuckCaret) break;
- if(!(style.freeCaret))
+ if(!style.multiLine && key.ctrl) break;
+ if(!style.freeCaret)
this.selX = Min(this.selX, this.selLine.count);
if(!shift) SelDirty();
else if(this.x != this.line.count)
{
this.x = this.line.count;
- //DirtyLine(this.y);
+ if(shift)
+ DirtyLine(this.y);
ComputeColumn();
}
if(!shift) Deselect();
}
break;
case pageDown:
- if(key.ctrl)
+ if(style.multiLine)
{
- if(!(style.hScroll) || hasHorzScroll) break;
- if(this.viewX < this.maxLength)
+ if(key.ctrl)
+ {
+ if(!(style.hScroll) || hasHorzScroll) break;
+ if(this.viewX < this.maxLength)
+ {
+ //this.viewX+=this.space.w*this.tabSize;
+ //DirtyAll();
+ SetScrollPosition((this.viewX + this.space.w*this.tabSize), this.viewY * this.space.h);
+ }
+ }
+ else
{
- //this.viewX+=this.space.w*this.tabSize;
- //DirtyAll();
- SetScrollPosition((this.viewX + this.space.w*this.tabSize), this.viewY * this.space.h);
+ PageDown();
+ DirtyAll();
+ if(!shift) Deselect();
+ SetCursorToViewX();
+ SetCursorToViewY();
}
+ return false;
}
- else
- {
- PageDown();
- DirtyAll();
- if(!shift) Deselect();
- SetCursorToViewX();
- SetCursorToViewY();
- }
- return false;
- // break;
+ break;
case pageUp:
- if(key.ctrl)
+ if(style.multiLine)
{
- if(!(style.hScroll) || hasHorzScroll) break;
- if(this.viewX > 0)
+ if(key.ctrl)
{
- //this.viewX-=this.space.w*this.tabSize;
- //this.viewX = Max(this.viewX,0);
- //DirtyAll();
- SetScrollPosition((this.viewX-this.space.w*this.tabSize), this.viewY * this.space.h);
- // SetCursorToView();
+ if(!(style.hScroll) || hasHorzScroll) break;
+ if(this.viewX > 0)
+ {
+ //this.viewX-=this.space.w*this.tabSize;
+ //this.viewX = Max(this.viewX,0);
+ //DirtyAll();
+ SetScrollPosition((this.viewX-this.space.w*this.tabSize), this.viewY * this.space.h);
+ // SetCursorToView();
+ }
}
+ else
+ {
+ PageUp();
+ DirtyAll();
+ if(!shift) Deselect();
+ SetCursorToViewX();
+ SetCursorToViewY();
+ }
+ return false;
}
- else
- {
- PageUp();
- DirtyAll();
- if(!shift) Deselect();
- SetCursorToViewX();
- SetCursorToViewY();
- }
- // break;
- return false;
+ break;
case insert:
if(key.ctrl)
{
delete newline;
}
return false;
- } else if(!key.ctrl && !key.alt && ch != 128 && ch >= 32)
+ }
+ else if(!key.ctrl && !key.alt && ch != 128 && ch >= 32)
{
PutCh(ch);
return false;
this.line = line;
this.x = 0;
this.col = 0;
-
- ComputeLength(this.line);
+ line.count = length;
#ifdef _DEBUG
if(length > 4000 || length < 0)
printf("Warning");
#endif
- line.count = length;
+ ComputeLength(this.line);
+
DirtyEnd(this.y);
this.y++;
this.lineCount++;
if(style.allCaps)
ch = (ch < 128) ? toupper(ch) : ch; // TODO: UNICODE TO UPPER
- if(this.x < this.line.count && this.overwrite)
+ if(this.overwrite && selX == x && selY == y && this.x < this.line.count)
{
char buffer[5];
char * newString;
{
if(this)
{
+ undoBuffer.dontRecord++;
Deselect();
DelCh(this.lines.first, 0, 0, this.lines.last, this.lineCount-1, ((EditLine)(this.lines.last)).count, true);
if(format)
}
UpdateDirty();
Home();
+ undoBuffer.dontRecord--;
}
}