diff --git a/programs/develop/cedit/CEDIT b/programs/develop/cedit/CEDIT
index 0ef59a7338..4b25bce6c4 100644
Binary files a/programs/develop/cedit/CEDIT and b/programs/develop/cedit/CEDIT differ
diff --git a/programs/develop/cedit/CEDIT.INI b/programs/develop/cedit/CEDIT.INI
index 0115b8df3d..760a863335 100644
--- a/programs/develop/cedit/CEDIT.INI
+++ b/programs/develop/cedit/CEDIT.INI
@@ -1,6 +1,12 @@
 [settings]
 tab=4
 blink=70
+line_numbers=1
+auto_indents=1
+auto_brackets=0
+trim_space=1
+font=1
+theme=0
 build=
 run=
 debug=
@@ -77,7 +83,7 @@ KW3 =
 
 [lang_C]
 KW1 = auto,break,case,char,const,continue,default,do,double,else,enum,extern,float,for,goto,if,int,long,register,return,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile,while,dword,byte,bool,NULL
-KW2 = define,error,include,elif,if,line,else,ifdef,pragma,endif,ifndef,undef
+KW2 = #define,#error,#include,#elif,#if,#line,#else,#ifdef,#pragma,#endif,#ifndef,#undef
 KW3 =
 
 [lang_Lua]
diff --git a/programs/develop/cedit/SRC/CEdit.ob07 b/programs/develop/cedit/SRC/CEdit.ob07
index 65f4e2e52e..855afc93d8 100644
--- a/programs/develop/cedit/SRC/CEdit.ob07
+++ b/programs/develop/cedit/SRC/CEdit.ob07
@@ -28,7 +28,7 @@ IMPORT
     RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
 
 CONST
-    HEADER = "CEdit (25-jan-2022)";
+    HEADER = "CEdit (26-jan-2022)";
 
     ShellFilter = "";
     EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
@@ -76,15 +76,6 @@ CONST
     EditBox_Width = 180;
     EDITBOX_MAXCHARS = 500;
 
-    menuFileX = Menu.MainMenuX;
-    menuEditX = menuFileX + 4*fontWidth + 9;
-    menuSearchX = menuEditX + 4*fontWidth + 9;
-    menuEncodingX = menuSearchX + 6*fontWidth + 9;
-    menuViewX = menuEncodingX + 8*fontWidth + 9;
-    menuLanguageX = menuViewX + 4*fontWidth + 9;
-    menuProgramX = menuLanguageX + 8*fontWidth + 9;
-    menuToolsX = menuProgramX + 7*fontWidth + 9;
-
     menuCut = 1;
     menuCopy = 2;
     menuPaste = 3;
@@ -107,10 +98,9 @@ CONST
     menuClose = 16;
     menuExit = 17;
 
-    menuNumbers = 20;
-    menuFontSmall = 21;
-    menuFontMedium = 22;
-    menuFontBig = 23;
+    menuFontSmall = 20;
+    menuFontMedium = menuFontSmall + 1;
+    menuFontLarge = menuFontMedium + 1;
     menuColors = 1000;
     menuMaxColors = menuColors + Ini.MAX_SECTIONS - 1;
 
@@ -147,6 +137,11 @@ CONST
     menuGoto = 83;
     menuBookmark = 130;
 
+    menuLineNumbers  = 90;
+    menuAutoIndents  = 91;
+    menuAutoBrackets = 92;
+    menuTrimSpace    = 93;
+
     menuMoveUp = 101;
     menuMoveDown = 102;
     menuDuplicate = 103;
@@ -202,7 +197,7 @@ VAR
     replaced: INTEGER;
 
     context, menuFile, menuEdit, menuSearch, menuEncoding,
-    menuView, menuLanguage, menuProgram, menuTools,
+    menuView, menuLanguage, menuProgram, menuTools, menuOptions,
     subCurLine, subIndent, subCase, subBookmark, subEOL: Menu.tMenu;
 
     mainMenu: Menu.tMain;
@@ -439,10 +434,10 @@ BEGIN
     K.SetWinSize(winWidth, winHeight);
     K.WinSize(winWidth, winHeight);
     K.ClientSize(cliWidth, cliHeight);
-    IF font # G.font2 THEN
+    IF font # G.fonts[2] THEN
     	SB.SetFont(font)
     ELSE
-    	SB.SetFont(G.font1)
+    	SB.SetFont(G.fonts[1])
     END;
     BOTTOM := SB.height() + scrollWidth - 1;
     G.destroy(canvas);
@@ -929,6 +924,7 @@ BEGIN
     Menu.close(menuLanguage);
     Menu.close(menuProgram);
     Menu.close(menuTools);
+    Menu.close(menuOptions);
     Menu.close(context)
 END CloseMenu;
 
@@ -1023,8 +1019,7 @@ BEGIN
         WHILE (i < textsCount) & ~texts[i].modified DO
             INC(i)
         END;
-        Menu.setEnabled(menu, menuSaveAll, i < textsCount);
-        INC(x, menuFileX)
+        Menu.setEnabled(menu, menuSaveAll, i < textsCount)
     ELSIF (menu = menuEdit) OR (menu = context) THEN
         Menu.setEnabled(menu, menuUndo, ~ChangeLog.isFirstGuard(text.edition));
         Menu.setEnabled(menu, menuRedo, ~ChangeLog.isLastGuard(text.edition));
@@ -1032,32 +1027,29 @@ BEGIN
         Menu.setEnabled(menu, menuCopy, selected);
         Menu.setEnabled(menu, menuDelete, selected);
         Menu.setEnabled(menu, menuPaste, CB.available());
-        IF menu = menuEdit THEN
-            INC(x, menuEditX)
-        ELSE
+        IF menu = context THEN
             IF y + menu.height >= canvas.height THEN
                 DEC(y, menu.height)
             END;
             IF x + menu.width >= canvas.width THEN
                 DEC(x, menu.width)
             END;
-            CanvasToScreen(x, y)
+            CanvasToScreen(x, y);
+            menu.x := x;
+            x := 0
         END
     ELSIF menu = menuEncoding THEN
         Menu.option(menu, menuUTF8BOM, T.getEnc(text) = E.UTF8BOM);
         Menu.option(menu, menuUTF8,    T.getEnc(text) = E.UTF8);
         Menu.option(menu, menuCP866,   T.getEnc(text) = E.CP866);
-        Menu.option(menu, menuWin1251, T.getEnc(text) = E.W1251);
-        INC(x, menuEncodingX)
+        Menu.option(menu, menuWin1251, T.getEnc(text) = E.W1251)
     ELSIF menu = menuView THEN
-        Menu.check(menu, menuNumbers,    text.numbers);
-        Menu.option(menu, menuFontSmall,  font = G.font0);
-        Menu.option(menu, menuFontMedium, font = G.font1);
-        Menu.option(menu, menuFontBig,    font = G.font2);
+        Menu.option(menu, menuFontSmall,  font = G.fonts[0]);
+        Menu.option(menu, menuFontMedium, font = G.fonts[1]);
+        Menu.option(menu, menuFontLarge,  font = G.fonts[2]);
         FOR i := 0 TO Ini.sections.count - 1 DO
             Menu.option(menu, menuColors + i, Ini.curSectionNum = i)
-        END;
-        INC(x, menuViewX)
+        END
     ELSIF menu = menuLanguage THEN
         Menu.option(menu, menuText,   text.lang = Languages.langText);
         Menu.option(menu, menuC,      text.lang = Languages.langC);
@@ -1067,16 +1059,15 @@ BEGIN
         Menu.option(menu, menuLua,    text.lang = Languages.langLua);
         Menu.option(menu, menuOberon, text.lang = Languages.langOberon);
         Menu.option(menu, menuPascal, text.lang = Languages.langPascal);
-        INC(x, menuLanguageX)
     ELSIF menu = menuProgram THEN
         Menu.setEnabled(menu, menuBuild, buildScript # "");
         Menu.setEnabled(menu, menuDebug, debugScript # "");
-        Menu.setEnabled(menu, menuRun, runScript # "");
-        INC(x, menuProgramX)
-    ELSIF menu = menuTools THEN
-        INC(x, menuToolsX)
-    ELSIF menu = menuSearch THEN
-        INC(x, menuSearchX)
+        Menu.setEnabled(menu, menuRun,   runScript # "")
+    ELSIF menu = menuOptions THEN
+    	Menu.check(menu, menuLineNumbers,  T.lineNumbers);
+    	Menu.check(menu, menuAutoIndents,  T.autoIndents);
+    	Menu.check(menu, menuAutoBrackets, T.autoBrackets);
+    	Menu.check(menu, menuTrimSpace,    T.trimSpace)
     END;
 
     enabled := search & (searchText # "");
@@ -1098,7 +1089,7 @@ BEGIN
         IF Menu.opened(menu) THEN
             Menu.close(menu)
         END;
-        Menu.open(menu, x, y);
+        Menu.open(menu, menu.x + x, y);
         menuActive := TRUE
     END
 END ShowMenu;
@@ -1175,16 +1166,9 @@ BEGIN
     	T.gotoLabel(text, TRUE)
     |menuPrevBookmark:
     	T.gotoLabel(text, FALSE)
-    |menuNumbers:
-        T.toggleNumbers(text)
-    |menuFontSmall:
-    	font := G.font0;
-    	resize
-    |menuFontMedium:
-    	font := G.font1;
-    	resize
-    |menuFontBig:
-    	font := G.font2;
+    |menuFontSmall..menuFontLarge:
+    	font := G.fonts[Menu.MenuItem - menuFontSmall];
+    	Ini.setInt("settings", "font", Menu.MenuItem - menuFontSmall);
     	resize
     |menuText:
         T.setLang(text, Languages.langText)
@@ -1236,8 +1220,21 @@ BEGIN
         K.Run("/sys/develop/board", "")
     |menuSysFunc:
         K.Run("/sys/docpack", "f")
+    |menuLineNumbers:
+        T.toggleNumbers;
+        Ini.setInt("settings", "line_numbers", ORD(T.lineNumbers))
+    |menuAutoIndents:
+        T.toggleIndents;
+        Ini.setInt("settings", "auto_indents", ORD(T.autoIndents))
+    |menuAutoBrackets:
+        T.toggleBrackets;
+        Ini.setInt("settings", "auto_brackets", ORD(T.autoBrackets))
+    |menuTrimSpace:
+        T.toggleTrimSpace;
+        Ini.setInt("settings", "trim_space", ORD(T.trimSpace))
     |menuColors..menuMaxColors:
-        Ini.selectSection(Menu.MenuItem - menuColors)
+        Ini.selectSection(Menu.MenuItem - menuColors);
+        Ini.setInt("settings", "theme", Menu.MenuItem - menuColors)
     |menuMoveUp:
     	T.MoveLines(text, FALSE)
     |menuMoveDown:
@@ -1372,11 +1369,9 @@ VAR
     idx: INTEGER;
 BEGIN
     menu := List.create(NIL);
-    Menu.AddMenuItem(menu, menuNumbers,  "line numbers");
-    Menu.delimiter(menu);
     Menu.AddMenuItem(menu, menuFontSmall,  "small");
     Menu.AddMenuItem(menu, menuFontMedium, "medium");
-    Menu.AddMenuItem(menu, menuFontBig,    "big");
+    Menu.AddMenuItem(menu, menuFontLarge,  "large");
     Menu.delimiter(menu);
 
     colors := Ini.sections.first(Ini.tSection);
@@ -1439,6 +1434,19 @@ BEGIN
 END CreateMenuTools;
 
 
+PROCEDURE CreateMenuOptions (): Menu.tMenu;
+VAR
+    menu: List.tList;
+BEGIN
+    menu := List.create(NIL);
+    Menu.AddMenuItem(menu, menuLineNumbers,  "line numbers");
+    Menu.AddMenuItem(menu, menuAutoIndents,  "automatic indents");
+    Menu.AddMenuItem(menu, menuAutoBrackets, "automatic brackets");
+    Menu.AddMenuItem(menu, menuTrimSpace,    "trim trailing space");
+    RETURN Menu.create(menu)
+END CreateMenuOptions;
+
+
 PROCEDURE CreateMenuCurLine(): Menu.tMenu;
 VAR
     menu: List.tList;
@@ -1940,7 +1948,6 @@ VAR
     firstClickX, firstClickY, time, blink, i: INTEGER;
     key, scr: INTEGER;
 BEGIN
-	font := G.font1;
 	header := "";
     K.GetSystemColors;
     switch := FALSE;
@@ -1949,6 +1956,10 @@ BEGIN
     curText := 0;
     Args.GetArg(0, AppPath);
     Ini.load(AppPath);
+    Ini.getSettings;
+    runScript := Ini.runScript;
+    buildScript := Ini.buildScript;
+    debugScript := Ini.debugScript;
     leftButton := FALSE;
     resized := FALSE;
     K.ScreenSize(winWidth, winHeight);
@@ -1967,8 +1978,10 @@ BEGIN
     canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 11 + RIGHT_PADDING), winHeight - (TOP + BOTTOM + 5) - SkinHeight);
     tabs := Tabs.create();
     Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, canvas.width, Tabs.tabHeight);
+    font := G.fonts[Ini.font];
     G.SetFont(canvas, font);
-    T.init(resetTimer);
+    T.init(resetTimer, Ini.lineNumbers, Ini.autoIndents, Ini.autoBrackets, Ini.trimSpace);
+    Ini.selectSection(Ini.theme);
     T.setCanvas(canvas);
 
     Menu.init(resetTimer);
@@ -1991,6 +2004,7 @@ BEGIN
     menuLanguage := CreateMenuLanguage();
     menuProgram := CreateMenuProgram();
     menuTools := CreateMenuTools();
+    menuOptions := CreateMenuOptions();
 
     mainMenu := Menu.CreateMain(mainMenuBtn);
     Menu.AddMainItem(mainMenu, "file", menuFile);
@@ -2001,6 +2015,7 @@ BEGIN
     Menu.AddMainItem(mainMenu, "language", menuLanguage);
     Menu.AddMainItem(mainMenu, "program", menuProgram);
     Menu.AddMainItem(mainMenu, "tools", menuTools);
+    Menu.AddMainItem(mainMenu, "options", menuOptions);
     Shortcuts;
 
     Toolbar.create(toolbar, LEFT_PADDING + 5, toolbarTop);
@@ -2019,8 +2034,6 @@ BEGIN
     Toolbar.add(toolbar, btnBuild,  54, "");
     Toolbar.add(toolbar, btnRun,    53, "");
 
-    Ini.getSettings(buildScript, runScript, debugScript);
-
     filePath := "/sys";
     IF Args.argc = 1 THEN
         text := T.New();
diff --git a/programs/develop/cedit/SRC/CheckBox.ob07 b/programs/develop/cedit/SRC/CheckBox.ob07
index 84f884cd6a..1e8bff9741 100644
--- a/programs/develop/cedit/SRC/CheckBox.ob07
+++ b/programs/develop/cedit/SRC/CheckBox.ob07
@@ -82,7 +82,7 @@ BEGIN
 	res.mouse := FALSE;
 	COPY(text, res.text);
 	res.canvas := G.CreateCanvas(fontHeight + padding + LENGTH(res.text)*fontWidth, fontHeight + 1);
-	G.SetFont(res.canvas, G.font1);
+	G.SetFont(res.canvas, G.fonts[1]);
 	chkbox := res
 END create;
 
diff --git a/programs/develop/cedit/SRC/Graph.ob07 b/programs/develop/cedit/SRC/Graph.ob07
index 1e71740c63..915022a294 100644
--- a/programs/develop/cedit/SRC/Graph.ob07
+++ b/programs/develop/cedit/SRC/Graph.ob07
@@ -53,7 +53,7 @@ TYPE
 
 VAR
 
-	font0*, font1*, font2*: tFont;
+	fonts*: ARRAY 3 OF tFont;
 
 
 PROCEDURE getRGB* (color: INTEGER; VAR r, g, b: BYTE);
@@ -302,7 +302,7 @@ BEGIN
 					IF c = Lines.NUL THEN
                 		c := 0X
 					END;
-					IF font = font0 THEN
+					IF font = fonts[0] THEN
 						ch := E.UNI[ORD(c), E.CP866];
 						IF ch = E.UNDEF THEN
 							c := "?"
@@ -354,7 +354,7 @@ END destroy;
 
 
 BEGIN
-    font0 := CreateFont(0, "", {});
-    font1 := CreateFont(1, "", {});
-    font2 := CreateFont(2, "", {});
+    fonts[0] := CreateFont(0, "", {});
+    fonts[1] := CreateFont(1, "", {});
+    fonts[2] := CreateFont(2, "", {});
 END Graph.
\ No newline at end of file
diff --git a/programs/develop/cedit/SRC/Ini.ob07 b/programs/develop/cedit/SRC/Ini.ob07
index 625add137d..0458f801f8 100644
--- a/programs/develop/cedit/SRC/Ini.ob07
+++ b/programs/develop/cedit/SRC/Ini.ob07
@@ -51,13 +51,17 @@ VAR
 
     curSection*: tASCIISectionName;
     curSectionNum*: INTEGER;
-    blink*: INTEGER;
+
+    blink*, font*, theme*: INTEGER;
+    buildScript*, runScript*, debugScript*: RW.tFileName;
+    lineNumbers*, autoIndents*, autoBrackets*, trimSpace*: BOOLEAN;
 
 
-PROCEDURE [stdcall, "libini.obj", "ini_get_color"]     get_color (f_name: RW.tFileName; sec_name: tASCIISectionName; key_name: tString; def_val: INTEGER): INTEGER; END;
-PROCEDURE [stdcall, "libini.obj", "ini_get_int"]       get_int (f_name: RW.tFileName; sec_name: tASCIISectionName; key_name: tString; def_val: INTEGER): INTEGER; END;
-PROCEDURE [stdcall, "libini.obj", "ini_get_str"]       get_str (f_name, sec_name, key_name, buffer, buf_len, def_val: INTEGER): INTEGER; END;
-PROCEDURE [stdcall, "libini.obj", "ini_enum_sections"] enum_sections (f_name: RW.tFileName; callback: INTEGER); END;
+PROCEDURE [stdcall,  "libini.obj", "ini_get_color"]     get_color (f_name: RW.tFileName; sec_name: tASCIISectionName; key_name: tString; def_val: INTEGER): INTEGER; END;
+PROCEDURE [stdcall,  "libini.obj", "ini_get_int"]       get_int (f_name: RW.tFileName; sec_name: tASCIISectionName; key_name: tString; def_val: INTEGER): INTEGER; END;
+PROCEDURE [stdcall,  "libini.obj", "ini_get_str"]       get_str (f_name, sec_name, key_name, buffer, buf_len, def_val: INTEGER): INTEGER; END;
+PROCEDURE [stdcall,  "libini.obj", "ini_enum_sections"] enum_sections (f_name: RW.tFileName; callback: INTEGER); END;
+PROCEDURE [stdcall-, "libini.obj", "ini_set_int"]       set_int (f_name, sec_name, key_name, val: INTEGER): INTEGER; END;
 
 PROCEDURE getColor (key: tString; def: INTEGER): INTEGER;
     RETURN get_color(IniFileName, curSection, key, def)
@@ -72,6 +76,12 @@ BEGIN
 END getStr;
 
 
+PROCEDURE setInt* (secName, keyName: ARRAY OF CHAR; val: INTEGER);
+BEGIN
+    set_int(SYSTEM.ADR(IniFileName[0]), SYSTEM.ADR(secName[0]), SYSTEM.ADR(keyName[0]), val)
+END setInt;
+
+
 PROCEDURE [stdcall] section_callback (fileName, sectionName: RW.tFileName): INTEGER;
 VAR
     section: tSection;
@@ -148,13 +158,25 @@ BEGIN
 END selectSection;
 
 
-PROCEDURE getSettings* (VAR build, run, debug: RW.tFileName);
+PROCEDURE getSettings*;
 BEGIN
 	Lines.setTabs(get_int(IniFileName, "settings", "tab", 4));
 	blink := get_int(IniFileName, "settings", "blink", 70);
-    getStr("settings", "build", build);
-    getStr("settings", "run",   run);
-    getStr("settings", "debug", debug)
+	lineNumbers  := get_int(IniFileName, "settings", "line_numbers",  1) # 0;
+	autoIndents  := get_int(IniFileName, "settings", "auto_indents",  1) # 0;
+	autoBrackets := get_int(IniFileName, "settings", "auto_brackets", 0) # 0;
+	trimSpace    := get_int(IniFileName, "settings", "trim_space",    1) # 0;
+	font := get_int(IniFileName, "settings", "font", 1);
+	IF ~((0 <= font) & (font <= 2)) THEN
+		font := 1
+	END;
+	theme := get_int(IniFileName, "settings", "theme", 0);
+	IF ~((0 <= theme) & (theme <= sections.count - 1)) THEN
+		theme := 0
+	END;
+    getStr("settings", "build", buildScript);
+    getStr("settings", "run",   runScript);
+    getStr("settings", "debug", debugScript);
 END getSettings;
 
 
@@ -167,12 +189,12 @@ BEGIN
     Utils.append8(IniFileName, fileName);
 
     IF ~File.Exists(IniFileName) THEN
-    	IniFileName := "/sys/settings/cedit.ini"
+    	IniFileName := "/sys/settings/" + fileName
     END;
 
     enum_sections(IniFileName, SYSTEM.ADR(section_callback));
     Languages.init(getStr);
-    selectSection(0);
+    selectSection(theme);
 END load;
 
 
diff --git a/programs/develop/cedit/SRC/Languages.ob07 b/programs/develop/cedit/SRC/Languages.ob07
index 523474de2d..456ee9892e 100644
--- a/programs/develop/cedit/SRC/Languages.ob07
+++ b/programs/develop/cedit/SRC/Languages.ob07
@@ -404,7 +404,7 @@ BEGIN
 END comments;
 
 
-PROCEDURE EnterKW (s: ARRAY OF CHAR; VAR KW: tKeyWords; CPrep: BOOLEAN);
+PROCEDURE EnterKW (s: ARRAY OF CHAR; VAR KW: tKeyWords);
 CONST
     SPACE = 20X; CR = 0DX; LF = 0AX; TAB = 9X; COMMA = ",";
 VAR
@@ -418,8 +418,7 @@ BEGIN
     k := KW.cnt;
     i := 0;
     REPEAT
-        KW.words[k, 0] := "#";
-        j := ORD(CPrep);
+        j := 0;
         WHILE (s[i] # 0X) & ~delim(s[i]) DO
             KW.words[k, j] := WCHR(ORD(s[i]));
             INC(i);
@@ -455,7 +454,7 @@ BEGIN
         KW[i].cnt := 0;
         key[2] := CHR(ORD("1") + i);
         getStr(lang, key, s);
-        EnterKW(s, KW[i], (lang = "lang_C") & (i = 1))
+        EnterKW(s, KW[i])
     END
 END loadKW;
 
diff --git a/programs/develop/cedit/SRC/Menu.ob07 b/programs/develop/cedit/SRC/Menu.ob07
index 1ce3c3a911..e6fb57db7f 100644
--- a/programs/develop/cedit/SRC/Menu.ob07
+++ b/programs/develop/cedit/SRC/Menu.ob07
@@ -23,7 +23,7 @@ IMPORT
     SYSTEM, G := Graph, List, K := KolibriOS;
 
 CONST
-    fontHeight = 22;
+    itemHeight = 22;
     fontWidth = 8;
 
     MainMenuHeight* = K.fontHeight + 7;
@@ -61,7 +61,7 @@ TYPE
         active*, keyboard: BOOLEAN;
         parent*, child: tMenu;
         mainID: INTEGER;
-        winX, winY, width*, height*: INTEGER;
+        x*, winX, winY, width*, height*: INTEGER;
         selItem, cliItem: INTEGER;
 
         font: G.tFont;
@@ -118,7 +118,8 @@ BEGIN
 		item.x := prev.x + LENGTH(prev.text)*fontWidth + 9
 	ELSE
 		item.x := MainMenuX
-	END
+	END;
+	menu.x := item.x
 END AddMainItem;
 
 
@@ -265,9 +266,9 @@ BEGIN
                 TextColor := disSelForeColor
             END
         END;
-        Y := y + (fontHeight - 16) DIV 2;
+        Y := y + (itemHeight - 16) DIV 2;
         G.SetColor(canvas, BkColor);
-        G.FillRect(canvas, 1, y, m.width - 1, y + fontHeight - 4);
+        G.FillRect(canvas, 1, y, m.width - 1, y + itemHeight - 4);
         G.SetTextColor(canvas, TextColor);
         G.SetBkColor(canvas, BkColor);
         G.TextOut2(canvas, LEFT, Y - 2, item.text, LENGTH(item.text));
@@ -279,7 +280,7 @@ BEGIN
             G.DLine(canvas, 7, 12, Y + 8,  1);
             G.DLine(canvas, 7, 12, Y + 9,  1)
         ELSIF item.check = 2 THEN
-            Y1 := y + fontHeight DIV 2 - 2;
+            Y1 := y + itemHeight DIV 2 - 2;
             G.FillRect(canvas, 7, Y1 - 2,  9, Y1 + 2);
             G.FillRect(canvas, 6, Y1 - 1, 10, Y1 + 1)
         END;
@@ -289,7 +290,7 @@ BEGIN
         	G.Triangle(canvas, X, Y + 2, X, Y + 10, G.triRight)
         END;
 
-        INC(y, fontHeight);
+        INC(y, itemHeight);
         IF item.delim THEN
             G.SetColor(canvas, foreColor);
             G.HLine(canvas, y - 2, 1, m.width - 1)
@@ -392,7 +393,7 @@ BEGIN
     	IF ~opened(item(tItem).child) THEN
     		closeChild(m);
     		item(tItem).child.keyboard := keyboard;
-    		_open(item(tItem).child, m.winX + m.width - 2, m.winY + m.selItem*fontHeight);
+    		_open(item(tItem).child, m.winX + m.width - 2, m.winY + m.selItem*itemHeight);
     		m.child := item(tItem).child;
     	END
     ELSE
@@ -486,9 +487,9 @@ BEGIN
         	K.mouse(msState, x, y);
             IF (0 <= x) & (x < m.width) & (0 <= y) & (y < m.height) THEN
             	m.active := TRUE;
-                m.selItem := (y - TOP) DIV fontHeight;
+                m.selItem := (y - TOP) DIV itemHeight;
                 IF 8 IN msState THEN
-                    m.cliItem := (y - TOP) DIV fontHeight
+                    m.cliItem := (y - TOP) DIV itemHeight
                 END;
                 IF 16 IN msState THEN
                     IF m.cliItem = m.selItem THEN
@@ -640,10 +641,10 @@ BEGIN
         item := item.next(tItem)
     END;
     m.width  := maxLength*fontWidth + LEFT + RIGHT;
-    m.height := items.count*fontHeight - 2;
-    m.font := G.font1;
+    m.height := items.count*itemHeight - 2;
+    m.font := G.fonts[1];
     m.canvas := G.CreateCanvas(m.width + 1, m.height + 1);
-    G.SetFont(m.canvas, m.font);
+    G.SetFont(m.canvas, m.font)
     RETURN m
 END create;
 
diff --git a/programs/develop/cedit/SRC/RW.ob07 b/programs/develop/cedit/SRC/RW.ob07
index 4bff3c8efe..472dc6d09f 100644
--- a/programs/develop/cedit/SRC/RW.ob07
+++ b/programs/develop/cedit/SRC/RW.ob07
@@ -291,10 +291,10 @@ BEGIN
 	cnt := text.cnt;
 	WHILE (text.cnt > 0) & (res = -1) DO
 		c := text.getChar(text);
-		IF CHR(c) = LF THEN
+		IF c = ORD(LF) THEN
 			res := E.EOL_LF
-		ELSIF CHR(c) = CR THEN
-			IF CHR(text.getChar(text)) = LF THEN
+		ELSIF c = ORD(CR) THEN
+			IF text.getChar(text) = ORD(LF) THEN
 				res := E.EOL_CRLF
 			ELSE
 				res := E.EOL_CR
diff --git a/programs/develop/cedit/SRC/StatusBar.ob07 b/programs/develop/cedit/SRC/StatusBar.ob07
index b2f52478db..ad1cbd69e6 100644
--- a/programs/develop/cedit/SRC/StatusBar.ob07
+++ b/programs/develop/cedit/SRC/StatusBar.ob07
@@ -122,5 +122,5 @@ END SetFont;
 
 BEGIN
 	SB.canvas := NIL;
-	font := G.font1
+	font := G.fonts[1]
 END StatusBar.
\ No newline at end of file
diff --git a/programs/develop/cedit/SRC/Text.ob07 b/programs/develop/cedit/SRC/Text.ob07
index 7eed922539..7982aadd38 100644
--- a/programs/develop/cedit/SRC/Text.ob07
+++ b/programs/develop/cedit/SRC/Text.ob07
@@ -66,10 +66,10 @@ TYPE
         scroll: tPoint;
         CurX: INTEGER;
         smallChange: INTEGER;
-        modified*, smallMove: BOOLEAN;
-        edition*: tGuard;
-        comments, numbers*, guard,
+        modified*, smallMove,
+        comments, guard,
         search, cs, whole: BOOLEAN;
+        edition*: tGuard;
         curLine: tLine;
         lang*: INTEGER;
         enc, eol: INTEGER;
@@ -91,7 +91,7 @@ VAR
     pdelete: PROCEDURE (text: tText);
     ShowCursor: PROCEDURE;
 
-    colors*: RECORD
+    colors: RECORD
                 text, back, seltext, selback, modified, saved, curline, numtext, numback: INTEGER;
                 comment, string, escape, num, delim, key1, key2, key3: INTEGER
              END;
@@ -100,6 +100,7 @@ VAR
     padding: RECORD left, top: INTEGER END;
     size, textsize: tPoint;
     charWidth, charHeight: INTEGER;
+    autoIndents*, lineNumbers*, autoBrackets*, trimSpace*: BOOLEAN;
 
 
 PROCEDURE setLang* (text: tText; lang: INTEGER);
@@ -151,12 +152,30 @@ BEGIN
 END getTextRect;
 
 
-PROCEDURE toggleNumbers* (text: tText);
+PROCEDURE toggleNumbers*;
 BEGIN
-    text.numbers := ~text.numbers
+    lineNumbers := ~lineNumbers
 END toggleNumbers;
 
 
+PROCEDURE toggleIndents*;
+BEGIN
+    autoIndents := ~autoIndents
+END toggleIndents;
+
+
+PROCEDURE toggleBrackets*;
+BEGIN
+    autoBrackets := ~autoBrackets
+END toggleBrackets;
+
+
+PROCEDURE toggleTrimSpace*;
+BEGIN
+    trimSpace := ~trimSpace
+END toggleTrimSpace;
+
+
 PROCEDURE showCursor*;
 BEGIN
 	drawCursor := TRUE
@@ -1146,7 +1165,11 @@ BEGIN
         IF text.cursor.X > 0 THEN
         	INC(text.smallChange);
             i := text.cursor.X;
-            n := leadingSpaces(curLine);
+            IF autoIndents THEN
+	            n := leadingSpaces(curLine)
+            ELSE
+    	        n := 0
+            END;
             modify(text);
             IF n < i THEN
                 move(text, -1);
@@ -1205,7 +1228,7 @@ BEGIN
     SetPos(text, 0, text.cursor.Y + 1);
     line := text.curLine.prev(tLine);
     n := -1;
-    WHILE (line # NIL) & (n = -1) DO
+    WHILE (line # NIL) & (n = -1) & autoIndents DO
         IF (*line.length*)Lines.trimLength(line) # 0 THEN
             n := leadingSpaces(line);
             line2 := line
@@ -1335,6 +1358,20 @@ BEGIN
         delSelect(text);
         curLine := text.curLine;
         Lines.insert(curLine, text.cursor.X, WCHR(code));
+        IF autoBrackets THEN
+        	IF code = ORD("(") THEN
+        		code := ORD(")")
+        	ELSIF code = ORD("[") THEN
+        		code := ORD("]")
+        	ELSIF code = ORD("{") THEN
+        		code := ORD("}")
+        	ELSE
+        		code := -1
+        	END;
+        	IF code # -1 THEN
+        		Lines.insert(curLine, text.cursor.X + 1, WCHR(code))
+        	END
+        END;
         Lines.modify(curLine);
         modify(text);
         SetPos(text, text.cursor.X + 1, text.cursor.Y)
@@ -1373,6 +1410,7 @@ VAR
     line: tLine;
     file: RW.tOutput;
     res: BOOLEAN;
+    Len: INTEGER;
 BEGIN
     ChangeLog.setGuard(text.edition);
     file := RW.create(tempFile, text.enc, text.eol);
@@ -1380,7 +1418,12 @@ BEGIN
         ChangeLog.delSaved;
         line := text.first(tLine);
         WHILE line # NIL DO
-            RW.putString(file, line, Lines.trimLength(line));
+        	IF trimSpace THEN
+        		Len := Lines.trimLength(line)
+        	ELSE
+        		Len := line.length
+        	END;
+            RW.putString(file, line, Len);
             NextLine(line);
             IF line # NIL THEN
                 RW.newLine(file)
@@ -2262,7 +2305,7 @@ BEGIN
     	G.clear(canvas)
     END;
     wNum := charWidth;
-    IF text.numbers THEN
+    IF lineNumbers THEN
         numWidth := U.lg10(text.count) + 2;
         xNum := numWidth*wNum - wNum DIV 2;
         setPadding(numWidth*wNum + pad_left, padding.top);
@@ -2322,7 +2365,7 @@ BEGIN
     y := padding.top + inter DIV 2;
     n := MIN(text.scroll.Y + textsize.Y, text.count);
     FOR i := text.scroll.Y + 1 TO n DO
-        IF text.numbers THEN
+        IF lineNumbers THEN
             IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN
                 U.int2str(i, s);
                 G.TextOut2(canvas, (numWidth - U.lg10(i) - 1)*wNum - wNum DIV 2, y, s, LENGTH(s))
@@ -2346,7 +2389,7 @@ BEGIN
     		firstLine := text.curLine;
     		lastLine := firstLine
     	ELSE
-    	    lastLine := getLine2(text, text.scroll.Y + textsize.Y - 1)
+    	    lastLine := getLine2(text, MIN(text.scroll.Y + textsize.Y, text.count) - 1)
         END;
         p := text.foundList.first(Search.tPos);
         WHILE p # NIL DO
@@ -2426,7 +2469,6 @@ BEGIN
     text.search := TRUE;
     text.cs := FALSE;
     text.whole := FALSE;
-    text.numbers := TRUE;
     text.guard := TRUE;
     text.edition := NIL;
     text.foundList := List.create(NIL);
@@ -2674,11 +2716,15 @@ BEGIN
 END New;
 
 
-PROCEDURE init* (pShowCursor: tProcedure);
+PROCEDURE init* (pShowCursor: tProcedure; _lineNumbers, _autoIndents, _autoBrackets, _trimSpace: BOOLEAN);
 BEGIN
     ShowCursor := pShowCursor;
     pdelete := delete;
     drawCursor := TRUE;
+    lineNumbers := _lineNumbers;
+    autoIndents := _autoIndents;
+    autoBrackets := _autoBrackets;
+    trimSpace := _trimSpace;
     padding.left := pad_left;
     padding.top := pad_top;
 END init;