mirror of https://github.com/buggins/dlangui.git
commit
a801d9cad6
|
@ -286,7 +286,7 @@ class EditOperation {
|
|||
_action = action;
|
||||
_range = range;
|
||||
_content.length = text.length;
|
||||
for(int i = 0; i < text.length; i++)
|
||||
foreach(i; 0 .. text.length)
|
||||
_content[i] = text[i].dup;
|
||||
//_content = text;
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ class EditOperation {
|
|||
// }
|
||||
//}
|
||||
void modified(bool all = true) {
|
||||
for (int i = 0; i < _oldEditMarks.length; i++) {
|
||||
foreach(i; 0 .. _oldEditMarks.length) {
|
||||
if (all || _oldEditMarks[i] == EditStateMark.saved)
|
||||
_oldEditMarks[i] = EditStateMark.changed;
|
||||
}
|
||||
|
@ -402,10 +402,10 @@ class UndoBuffer {
|
|||
/// current state is saved
|
||||
void saved() {
|
||||
_savedState = _undoList.peekBack;
|
||||
for (int i = 0; i < _undoList.length; i++) {
|
||||
foreach(i; 0 .. _undoList.length) {
|
||||
_undoList[i].modified();
|
||||
}
|
||||
for (int i = 0; i < _redoList.length; i++) {
|
||||
foreach(i; 0 .. _redoList.length) {
|
||||
_redoList[i].modified();
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ class UndoBuffer {
|
|||
bool savedInRedo() {
|
||||
if (!_savedState)
|
||||
return false;
|
||||
for (int i = 0; i < _redoList.length; i++) {
|
||||
foreach(i; 0 .. _redoList.length) {
|
||||
if (_savedState is _redoList[i])
|
||||
return true;
|
||||
}
|
||||
|
@ -677,7 +677,7 @@ class EditableContent {
|
|||
/// call listener to say that content is saved
|
||||
void notifyContentSaved() {
|
||||
// mark all changed lines as saved
|
||||
for (int i = 0; i < _editMarks.length; i++) {
|
||||
foreach(i; 0 .. _editMarks.length) {
|
||||
if (_editMarks[i] == EditStateMark.changed)
|
||||
_editMarks[i] = EditStateMark.saved;
|
||||
}
|
||||
|
@ -711,18 +711,18 @@ class EditableContent {
|
|||
}
|
||||
|
||||
protected void markChangedLines(int startLine, int endLine) {
|
||||
for (int i = startLine; i < endLine; i++) {
|
||||
foreach(i; startLine .. endLine) {
|
||||
_editMarks[i] = EditStateMark.changed;
|
||||
}
|
||||
}
|
||||
|
||||
/// set props arrays size equal to text line sizes, bit fill with unknown token
|
||||
protected void clearTokenProps(int startLine, int endLine) {
|
||||
for (int i = startLine; i < endLine; i++) {
|
||||
foreach(i; startLine .. endLine) {
|
||||
if (hasSyntaxHighlight) {
|
||||
int len = cast(int)_lines[i].length;
|
||||
_tokenProps[i].length = len;
|
||||
for (int j = 0; j < len; j++)
|
||||
foreach(j; 0 .. len)
|
||||
_tokenProps[i][j] = TOKEN_UNKNOWN;
|
||||
} else {
|
||||
_tokenProps[i] = null; // no token props
|
||||
|
@ -732,7 +732,7 @@ class EditableContent {
|
|||
|
||||
void clearEditMarks() {
|
||||
_editMarks.length = _lines.length;
|
||||
for (int i = 0; i < _editMarks.length; i++)
|
||||
foreach(i; 0 .. _editMarks.length)
|
||||
_editMarks[i] = EditStateMark.unchanged;
|
||||
}
|
||||
|
||||
|
@ -869,7 +869,7 @@ class EditableContent {
|
|||
int x = 0;
|
||||
while (x + tabSize <= pos) {
|
||||
if (useSpacesForTabs) {
|
||||
for (int i = 0; i < tabSize; i++)
|
||||
foreach(i; 0 .. tabSize)
|
||||
buf ~= ' ';
|
||||
} else {
|
||||
buf ~= '\t';
|
||||
|
@ -1068,7 +1068,7 @@ class EditableContent {
|
|||
_tokenProps[i] = _tokenProps[i - count];
|
||||
_editMarks[i] = _editMarks[i - count];
|
||||
}
|
||||
for (int i = start; i < start + count; i++) {
|
||||
foreach(i; start .. start + count) {
|
||||
_lines[i] = ""d;
|
||||
_tokenProps[i] = null;
|
||||
_editMarks[i] = EditStateMark.changed;
|
||||
|
@ -1091,7 +1091,7 @@ class EditableContent {
|
|||
// remove extra lines
|
||||
removeLines(before.start.line + 1, linesBefore - linesAfter);
|
||||
}
|
||||
for (int i = after.start.line; i <= after.end.line; i++) {
|
||||
foreach(int i; after.start.line .. after.end.line + 1) {
|
||||
if (marks) {
|
||||
//if (i - after.start.line < marks.length)
|
||||
_editMarks[i] = marks[i - after.start.line];
|
||||
|
|
|
@ -204,7 +204,7 @@ class Action {
|
|||
_state = a._state;
|
||||
_defaultState = a._defaultState;
|
||||
_accelerators.length = a._accelerators.length;
|
||||
for(int i = 0; i < _accelerators.length; i++)
|
||||
foreach(i; 0 .. _accelerators.length)
|
||||
_accelerators[i] = a._accelerators[i];
|
||||
_stringParam = a._stringParam;
|
||||
_longParam = a._longParam;
|
||||
|
@ -1424,7 +1424,7 @@ void registerActionEnum(T)() if (is(T == enum)) {
|
|||
immutable string[] memberNames = enumMemberNames!T;
|
||||
//pragma(msg, enumMemberValues!T);
|
||||
//pragma(msg, enumMemberNames!T);
|
||||
for (int i = 0; i < memberValues.length; i++) {
|
||||
foreach(i; 0 .. memberValues.length) {
|
||||
actionIdToNameMap[memberValues[i]] = memberNames[i];
|
||||
actionNameToIdMap[memberNames[i]] = memberValues[i];
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ struct RootEntry {
|
|||
version (Windows) {
|
||||
import win32.windows;
|
||||
uint mask = GetLogicalDrives();
|
||||
for (int i = 0; i < 26; i++) {
|
||||
foreach(int i; 0 .. 26) {
|
||||
if (mask & (1 << i)) {
|
||||
char letter = cast(char)('A' + i);
|
||||
string path = "" ~ letter ~ ":\\";
|
||||
|
@ -257,8 +257,8 @@ bool isPathDelimiter(char ch) {
|
|||
/** Returns current executable path only, including last path delimiter - removes executable name from result of std.file.thisExePath() */
|
||||
@property string exePath() {
|
||||
string path = thisExePath();
|
||||
int lastSlash = 0;
|
||||
for (int i = 0; i < path.length; i++)
|
||||
ulong lastSlash = 0;
|
||||
foreach(i; 0 .. path.length)
|
||||
if (path[i] == PATH_DELIMITER)
|
||||
lastSlash = i;
|
||||
return path[0 .. lastSlash + 1];
|
||||
|
@ -346,8 +346,8 @@ char[] appendPath(char[] buf, string[] pathItems ...) {
|
|||
/** Split path into elements, e.g. /home/user/dir1 -> ["home", "user", "dir1"], "c:\dir1\dir2" -> ["c:", "dir1", "dir2"] */
|
||||
string[] splitPath(string path) {
|
||||
string[] res;
|
||||
int start = 0;
|
||||
for (int i = 0; i <= path.length; i++) {
|
||||
ulong start = 0;
|
||||
foreach(i; 0 .. path.length + 1) {
|
||||
char ch = i < path.length ? path[i] : 0;
|
||||
if (ch == '\\' || ch == '/' || ch == 0) {
|
||||
if (start < i)
|
||||
|
|
|
@ -242,13 +242,13 @@ struct UIStringCollection {
|
|||
void remove(int index) {
|
||||
if (index < 0 || index >= _length)
|
||||
return;
|
||||
for (size_t i = index; i < _length - 1; i++)
|
||||
foreach(i; index .. _length - 1)
|
||||
_items[i] = _items[i + 1];
|
||||
_length--;
|
||||
}
|
||||
/** Return index of first item with specified text or -1 if not found. */
|
||||
int indexOf(dstring str) const {
|
||||
for (int i = 0; i < _length; i++) {
|
||||
foreach(i; 0 .. _length) {
|
||||
if (_items[i].value.equal(str))
|
||||
return i;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ struct UIStringCollection {
|
|||
}
|
||||
/** Return index of first item with specified string resource id or -1 if not found. */
|
||||
int indexOf(string strId) const {
|
||||
for (int i = 0; i < _length; i++) {
|
||||
foreach(i; 0 .. _length) {
|
||||
if (_items[i].id.equal(strId))
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -144,17 +144,17 @@ class OutputLineStream {
|
|||
case UTF8:
|
||||
default:
|
||||
char[4] d;
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
foreach(i; 0 .. s.length) {
|
||||
int bytes = cast(int)encode(d, s[i]);
|
||||
for (int j = 0; j < bytes; j++)
|
||||
foreach(j; 0 .. bytes)
|
||||
_buf[_len++] = d[j];
|
||||
}
|
||||
break;
|
||||
case UTF16BE:
|
||||
wchar[2] d;
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
foreach(i; 0 .. s.length) {
|
||||
int n = cast(int)encode(d, s[i]);
|
||||
for (int j = 0; j < n; j++) {
|
||||
foreach(j; 0 .. n) {
|
||||
_buf[_len++] = cast(char)(d[j] >> 8);
|
||||
_buf[_len++] = cast(char)(d[j] & 0xFF);
|
||||
}
|
||||
|
@ -162,16 +162,16 @@ class OutputLineStream {
|
|||
break;
|
||||
case UTF16LE:
|
||||
wchar[2] d;
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
foreach(i; 0 .. s.length) {
|
||||
int n = cast(int)encode(d, s[i]);
|
||||
for (int j = 0; j < n; j++) {
|
||||
foreach(j; 0 .. n) {
|
||||
_buf[_len++] = cast(char)(d[j] & 0xFF);
|
||||
_buf[_len++] = cast(char)(d[j] >> 8);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UTF32LE:
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
foreach(i; 0 .. s.length) {
|
||||
dchar ch = s[i];
|
||||
_buf[_len++] = cast(char)((ch >> 0) & 0xFF);
|
||||
_buf[_len++] = cast(char)((ch >> 8) & 0xFF);
|
||||
|
@ -180,7 +180,7 @@ class OutputLineStream {
|
|||
}
|
||||
break;
|
||||
case UTF32BE:
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
foreach(i; 0 .. s.length) {
|
||||
dchar ch = s[i];
|
||||
_buf[_len++] = cast(char)((ch >> 24) & 0xFF);
|
||||
_buf[_len++] = cast(char)((ch >> 16) & 0xFF);
|
||||
|
@ -315,7 +315,7 @@ class LineStream {
|
|||
if (_streamEof || bytesLeft > QUARTER_BYTE_BUFFER_SIZE)
|
||||
return bytesLeft;
|
||||
if (_pos > 0) {
|
||||
for (uint i = 0; i < bytesLeft; i++)
|
||||
foreach(i; 0 .. bytesLeft)
|
||||
_buf[i] = _buf[i + _pos];
|
||||
_len = bytesLeft;
|
||||
_pos = 0;
|
||||
|
@ -347,7 +347,7 @@ class LineStream {
|
|||
if (_textPos > _textBuf.length / 2) {
|
||||
uint charCount = _textLen - _textPos;
|
||||
dchar * p = _textBuf.ptr;
|
||||
for (uint i = 0; i < charCount; i++)
|
||||
foreach(i; 0 .. charCount)
|
||||
p[i] = p[i + _textPos];
|
||||
_textLen = charCount;
|
||||
_textPos = 0;
|
||||
|
@ -479,7 +479,7 @@ class LineStream {
|
|||
public static LineStream create(string code, string filename = "") {
|
||||
uint len = cast(uint)code.length;
|
||||
ubyte[] data = new ubyte[len + 3];
|
||||
for (uint i = 0; i < len; i++)
|
||||
foreach(i; 0 .. len)
|
||||
data[i + 3] = code[i];
|
||||
// BOM for UTF8
|
||||
data[0] = 0xEF;
|
||||
|
|
|
@ -250,7 +250,7 @@ final class Setting {
|
|||
if (index >= list.length) {
|
||||
int oldlen = cast(int)list.length;
|
||||
list.length = index + 1;
|
||||
for (int i = oldlen; i < index; i++)
|
||||
foreach(i; oldlen .. index)
|
||||
list[i] = new Setting(); // insert NULL items in holes
|
||||
}
|
||||
list[index] = value;
|
||||
|
@ -268,7 +268,7 @@ final class Setting {
|
|||
Setting res = get(index);
|
||||
if (!res)
|
||||
return null;
|
||||
for (int i = index; i < list.length - 1; i++)
|
||||
foreach(i; index .. list.length - 1)
|
||||
list[i] = list[i + 1];
|
||||
list[$ - 1] = null;
|
||||
list.length--;
|
||||
|
@ -280,7 +280,7 @@ final class Setting {
|
|||
/// deep copy
|
||||
void copyFrom(ref SettingArray v) {
|
||||
list.length = v.list.length;
|
||||
for(int i = 0; i < v.list.length; i++) {
|
||||
foreach(i; 0 .. v.list.length) {
|
||||
list[i] = v.list[i].clone();
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ final class Setting {
|
|||
Setting res = get(index);
|
||||
if (!res)
|
||||
return null;
|
||||
for (int i = index; i < list.length - 1; i++)
|
||||
foreach(i; index .. list.length - 1)
|
||||
list[i] = list[i + 1];
|
||||
list[$ - 1] = null;
|
||||
list.length--;
|
||||
|
@ -361,7 +361,7 @@ final class Setting {
|
|||
/// deep copy
|
||||
void copyFrom(SettingMap * v) {
|
||||
list.length = v.list.length;
|
||||
for(int i = 0; i < v.list.length; i++) {
|
||||
foreach(i; 0 .. v.list.length) {
|
||||
list[i] = v.list[i].clone();
|
||||
}
|
||||
destroy(map);
|
||||
|
@ -541,7 +541,7 @@ final class Setting {
|
|||
case ARRAY:
|
||||
case OBJECT:
|
||||
string[] res;
|
||||
for(int i = 0; i < length; i++)
|
||||
foreach(i; 0 .. length)
|
||||
res ~= this[i].str;
|
||||
return res;
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ final class Setting {
|
|||
case ARRAY:
|
||||
case OBJECT:
|
||||
int[] res;
|
||||
for(int i = 0; i < length; i++)
|
||||
foreach(i; 0 .. length)
|
||||
res ~= cast(int)this[i].integer;
|
||||
return res;
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ final class Setting {
|
|||
case ARRAY:
|
||||
case OBJECT:
|
||||
Setting[] res;
|
||||
for(int i = 0; i < length; i++)
|
||||
foreach(i; 0 .. length)
|
||||
res ~= this[i];
|
||||
return res;
|
||||
}
|
||||
|
@ -1412,7 +1412,7 @@ final class Setting {
|
|||
|
||||
void appendTabs(int level) {
|
||||
reserve(level * 4 + 1024);
|
||||
for(int i = 0; i < level; i++) {
|
||||
foreach(i; 0 .. level) {
|
||||
buffer[pos++] = ' ';
|
||||
buffer[pos++] = ' ';
|
||||
buffer[pos++] = ' ';
|
||||
|
@ -1506,7 +1506,7 @@ final class Setting {
|
|||
buf.append('[');
|
||||
if (pretty && _store.array.length > 0)
|
||||
buf.appendEOL();
|
||||
for (int i = 0; i < _store.array.length; i++) {
|
||||
foreach(i; 0 .. _store.array.length) {
|
||||
if (pretty)
|
||||
buf.appendTabs(level + 1);
|
||||
_store.array.get(i).toJSON(buf, level + 1, pretty);
|
||||
|
@ -1590,7 +1590,7 @@ final class Setting {
|
|||
int line = 1;
|
||||
int col = 1;
|
||||
int lineStart = 0;
|
||||
for (int i = 0; i < pos; i++) {
|
||||
foreach(int i; 0 .. pos) {
|
||||
char ch = json[i];
|
||||
if (ch == '\r') {
|
||||
if (i < json.length - 1 && json[i + 1] == '\n')
|
||||
|
@ -1656,7 +1656,7 @@ final class Setting {
|
|||
if (pos >= json.length - 3)
|
||||
error("unexpected end of file while parsing unicode character entity inside string");
|
||||
dchar ch = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
foreach(i; 0 .. 4) {
|
||||
int d = parseHexDigit(nextChar);
|
||||
if (d < 0)
|
||||
error("error while parsing unicode character entity inside string");
|
||||
|
@ -1741,7 +1741,7 @@ final class Setting {
|
|||
// returns true if parsed ok
|
||||
if (pos + ident.length > json.length)
|
||||
return false;
|
||||
for (int i = 0; i < ident.length; i++) {
|
||||
foreach(i; 0 .. ident.length) {
|
||||
if (ident[i] != json[pos + i])
|
||||
return false;
|
||||
}
|
||||
|
@ -1921,7 +1921,7 @@ long parseLong(inout string v, long defValue = 0) {
|
|||
int sign = 1;
|
||||
long value = 0;
|
||||
int digits = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
foreach(i; 0 .. len) {
|
||||
char ch = v[i];
|
||||
if (ch == '-') {
|
||||
if (i != 0)
|
||||
|
@ -1943,7 +1943,7 @@ ulong parseULong(inout string v, ulong defValue = 0) {
|
|||
return defValue;
|
||||
ulong value = 0;
|
||||
int digits = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
foreach(i; 0 .. len) {
|
||||
char ch = v[i];
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
digits++;
|
||||
|
|
Loading…
Reference in New Issue