From 6cb509d90cde8fe3e451d5b580a94b2a747d6b7e Mon Sep 17 00:00:00 2001 From: codeimp Date: Fri, 20 Feb 2009 10:42:05 +0000 Subject: [PATCH] - Indentation guides in script editor now use the same color as line numbers - Fixed bug in script editor that unindents a line when autocomplete is used with Enter key. --- Source/Controls/ScriptEditorControl.cs | 16 ++++++++++++---- Source/Resources/Lexers.cfg | 5 +++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Source/Controls/ScriptEditorControl.cs b/Source/Controls/ScriptEditorControl.cs index 0099eed7..f7b49bd4 100644 --- a/Source/Controls/ScriptEditorControl.cs +++ b/Source/Controls/ScriptEditorControl.cs @@ -103,6 +103,7 @@ namespace CodeImp.DoomBuilder.Controls scriptedit.AutoCMaximumHeight = 8; scriptedit.AutoCSeparator = ' '; scriptedit.AutoCTypeSeparator = '?'; + scriptedit.AutoCSetFillUps("\r\n();[]"); // I should put this in the script configs scriptedit.CaretWidth = 2; scriptedit.EndAtLastLine = 1; scriptedit.EndOfLineMode = ScriptEndOfLine.CRLF; @@ -114,13 +115,13 @@ namespace CodeImp.DoomBuilder.Controls scriptedit.IsHScrollBar = true; scriptedit.IsIndentationGuides = true; scriptedit.IsMouseDownCaptures = true; - scriptedit.IsTabIndents = true; + scriptedit.IsTabIndents = false; scriptedit.IsUndoCollection = true; scriptedit.IsUseTabs = true; scriptedit.IsViewEOL = false; scriptedit.IsVScrollBar = true; scriptedit.SetFoldFlags((int)ScriptFoldFlag.Box); - scriptedit.TabWidth = 4; + scriptedit.TabWidth = 4; // This should be in the preferences dialog // Symbol margin scriptedit.SetMarginTypeN(0, (int)ScriptMarginType.Symbol); @@ -229,7 +230,11 @@ namespace CodeImp.DoomBuilder.Controls scriptedit.CaretPeriod = SystemInformation.CaretBlinkTime; scriptedit.CaretFore = General.Colors.ScriptBackground.Inverse().ToColorRef(); scriptedit.StyleBits = 7; + + // These don't work? scriptedit.TabWidth = 4; + scriptedit.IsUseTabs = true; + scriptedit.Indent = 0; // This applies the default style to all styles scriptedit.StyleClearAll(); @@ -649,8 +654,11 @@ namespace CodeImp.DoomBuilder.Controls // Apply identation of the previous line to this line int ident = scriptedit.GetLineIndentation(curline - 1); int tabs = ident / scriptedit.TabWidth; - scriptedit.SetLineIndentation(curline, ident); - scriptedit.SetSel(scriptedit.SelectionStart + tabs, scriptedit.SelectionStart + tabs); + if(scriptedit.GetLineIndentation(curline) == 0) + { + scriptedit.SetLineIndentation(curline, ident); + scriptedit.SetSel(scriptedit.SelectionStart + tabs, scriptedit.SelectionStart + tabs); + } } } diff --git a/Source/Resources/Lexers.cfg b/Source/Resources/Lexers.cfg index 461ca061..a9523310 100644 --- a/Source/Resources/Lexers.cfg +++ b/Source/Resources/Lexers.cfg @@ -14,6 +14,7 @@ lexer1 // None { 0 = 0; // plain text 33 = 5; // line numbers + 37 = 5; // ident guides keywordsindex = -1; constantsindex = -1; @@ -31,6 +32,7 @@ lexer3 // CPP-style, case-sensitive 6 = 4; // literal 7 = 4; // literal 16 = 2; // constants + 37 = 5; // ident guides keywordsindex = 0; constantsindex = 1; @@ -46,6 +48,7 @@ lexer6 // Perl-style 6 = 4; // literal 7 = 4; // literal 33 = 5; // line numbers + 37 = 5; // ident guides keywordsindex = 0; constantsindex = -1; @@ -63,6 +66,7 @@ lexer18 // Pascal-style 6 = 4; // literal 7 = 4; // literal 16 = 2; // constants + 37 = 5; // ident guides keywordsindex = 0; constantsindex = 1; @@ -80,6 +84,7 @@ lexer35 // CPP-style, case-insensitive 6 = 4; // literal 7 = 4; // literal 16 = 2; // constants + 37 = 5; // ident guides keywordsindex = 0; constantsindex = 1;