Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Scintilla] Bump SciLexer to 4.4.6. fixes #1960 #3186

Open
wants to merge 20 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion External/Plugins/ASCompletion/Completion/ASGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using PluginCore.Managers;
using PluginCore.Utilities;
using ScintillaNet;
using ScintillaNet.Lexers;

namespace ASCompletion.Completion
{
Expand Down Expand Up @@ -72,7 +73,7 @@ public bool ContextualGenerator(ScintillaControl sci, int position, List<IComple
// for example: new NewClass$(EntryPoint)/*comment*/();
&& sci.PositionIsOnComment(--position)) return false;
var style = sci.BaseStyleAt(position);
if (style == 19 || style == 24) // on keyword
if (style == 19 || style == (int) CPP.WORD4) // on keyword
return false;
contextMatch = null;
contextToken = sci.GetWordFromPosition(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,7 @@ void Highlight(int startIndex, int length)
Sci.SetIndicFore(Indicator, 0x00FF00);
Sci.CurrentIndicator = Indicator;
Sci.IndicatorFillRange(startIndex, length);
var es = Sci.EndStyled;
var mask = (1 << Sci.StyleBits) - 1;
Sci.StartStyling(es, mask);
Sci.StartStyling(Sci.EndStyled, 0xff);
}
}
}
11 changes: 3 additions & 8 deletions External/Plugins/CodeRefactor/Commands/InlineRename.cs
Original file line number Diff line number Diff line change
Expand Up @@ -908,13 +908,12 @@ static bool IsValidFirstChar(int value)
/// <param name="length">The length of the highlight.</param>
void Highlight(int startIndex, int length)
{
int es = sci.EndStyled;
int mask = (1 << sci.StyleBits) - 1;
var es = sci.EndStyled;
sci.SetIndicStyle(Indicator, (int) IndicatorStyle.Container);
sci.SetIndicFore(Indicator, 0x00FF00);
sci.CurrentIndicator = Indicator;
sci.IndicatorFillRange(startIndex, length);
sci.StartStyling(es, mask);
sci.StartStyling(es, 0xff);
}

/// <summary>
Expand All @@ -925,11 +924,7 @@ void AddHistory(string value)
{
// Delete redo history
int excessCount = history.Count - ++historyIndex;
if (excessCount > 0)
{
history.RemoveRange(historyIndex, excessCount);
}

if (excessCount > 0) history.RemoveRange(historyIndex, excessCount);
history.Add(value);

// Trim beginning of history
Expand Down
88 changes: 43 additions & 45 deletions External/Plugins/FlashDebugger/Helpers/ScintillaHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,77 +152,75 @@ public static void ToggleMarker(ScintillaControl sci, int marker, int line)
public static void AddHighlight(ScintillaControl sci, int line, int indicator, int value)
{
if (sci is null) return;
int start = sci.PositionFromLine(line);
int length = sci.LineLength(line);
var start = sci.PositionFromLine(line);
var length = sci.LineLength(line);
if (start < 0 || length < 1) return;
int es = sci.EndStyled;
int mask = (1 << sci.StyleBits) - 1;
Language lang = PluginBase.MainForm.SciConfig.GetLanguage(sci.ConfigurationLanguage);
if (indicator == indicatorDebugCurrentLine)
var es = sci.EndStyled;
var lang = PluginBase.MainForm.SciConfig.GetLanguage(sci.ConfigurationLanguage);
switch (indicator)
{
sci.SetIndicFore(indicator, lang.editorstyle.DebugLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
}
else if (indicator == indicatorDebugEnabledBreakpoint)
{
sci.SetIndicFore(indicator, lang.editorstyle.ErrorLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
}
else if (indicator == indicatorDebugDisabledBreakpoint)
{
sci.SetIndicFore(indicator, lang.editorstyle.DisabledLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
case indicatorDebugCurrentLine:
sci.SetIndicFore(indicator, lang.editorstyle.DebugLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
break;
case indicatorDebugEnabledBreakpoint:
sci.SetIndicFore(indicator, lang.editorstyle.ErrorLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
break;
case indicatorDebugDisabledBreakpoint:
sci.SetIndicFore(indicator, lang.editorstyle.DisabledLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
break;
}
sci.SetIndicStyle(indicator, 7);
sci.CurrentIndicator = indicator;
sci.IndicatorValue = value;
sci.IndicatorFillRange(start, length);
sci.StartStyling(es, mask);
sci.StartStyling(es, 0xff);
}

public static void RemoveHighlight(ScintillaControl sci, int line, int indicator)
{
if (sci is null) return;
int start = sci.PositionFromLine(line);
int length = sci.LineLength(line);
var start = sci.PositionFromLine(line);
var length = sci.LineLength(line);
if (start < 0 || length < 1) return;
int es = sci.EndStyled;
int mask = (1 << sci.StyleBits) - 1;
Language lang = PluginBase.MainForm.SciConfig.GetLanguage(sci.ConfigurationLanguage);
if (indicator == indicatorDebugCurrentLine)
{
sci.SetIndicFore(indicator, lang.editorstyle.DebugLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
}
else if (indicator == indicatorDebugEnabledBreakpoint)
{
sci.SetIndicFore(indicator, lang.editorstyle.ErrorLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
}
else if (indicator == indicatorDebugDisabledBreakpoint)
var es = sci.EndStyled;
var lang = PluginBase.MainForm.SciConfig.GetLanguage(sci.ConfigurationLanguage);
switch (indicator)
{
sci.SetIndicFore(indicator, lang.editorstyle.DisabledLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
case indicatorDebugCurrentLine:
sci.SetIndicFore(indicator, lang.editorstyle.DebugLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
break;
case indicatorDebugEnabledBreakpoint:
sci.SetIndicFore(indicator, lang.editorstyle.ErrorLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
break;
case indicatorDebugDisabledBreakpoint:
sci.SetIndicFore(indicator, lang.editorstyle.DisabledLineBack);
sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
break;
}
sci.SetIndicStyle(indicator, 7);
sci.CurrentIndicator = indicator;
sci.IndicatorClearRange(start, length);
sci.StartStyling(es, mask);
sci.StartStyling(es, 0xff);
}

public static void RemoveAllHighlights(ScintillaControl sci)
{
if (sci is null) return;
int es = sci.EndStyled;
var es = sci.EndStyled;
int[] indics = { indicatorDebugCurrentLine, indicatorDebugDisabledBreakpoint, indicatorDebugEnabledBreakpoint };
foreach (int indicator in indics)
foreach (var indicator in indics)
{
sci.CurrentIndicator = indicator;
for (int position = 0; position < sci.Length;)
for (var position = 0; position < sci.Length;)
{
int start = sci.IndicatorStart(indicator, position);
int end = sci.IndicatorEnd(indicator, start);
int length = end - start;
var start = sci.IndicatorStart(indicator, position);
var end = sci.IndicatorEnd(indicator, start);
var length = end - start;
if (length > 0)
{
sci.IndicatorClearRange(start, length);
Expand All @@ -231,7 +229,7 @@ public static void RemoveAllHighlights(ScintillaControl sci)
else break;
}
}
sci.StartStyling(es, (1 << sci.StyleBits) - 1);
sci.StartStyling(es, 0xff);
}

#endregion
Expand Down
Binary file modified FlashDevelop/Bin/Debug/SciLexer.dll
Binary file not shown.
Binary file modified FlashDevelop/Bin/Debug/SciLexer64.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion FlashDevelop/Managers/ScintillaManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ public static void ApplySciSettings(ScintillaControl sci, bool hardUpdate)
sci.TabWidth = settings.TabWidth;
sci.ViewWS = Convert.ToInt32(settings.ViewWhitespace);
sci.WrapMode = Convert.ToInt32(settings.WrapText);
sci.TabDrawMode = (int) settings.TabDrawMode;
sci.SetProperty("fold", Convert.ToInt32(settings.UseFolding).ToString());
sci.SetProperty("fold.comment", Convert.ToInt32(settings.FoldComment).ToString());
sci.SetProperty("fold.compact", Convert.ToInt32(settings.FoldCompact).ToString());
Expand Down Expand Up @@ -375,7 +376,6 @@ public static ScintillaControl CreateControl(string file, string text, int codep
sci.SelectionStart = 0;
sci.SmartIndentType = SmartIndent.CPP;
sci.Status = 0;
sci.StyleBits = 7;
sci.TabIndex = 0;
sci.TargetEnd = 0;
sci.TargetStart = 0;
Expand Down
6 changes: 6 additions & 0 deletions FlashDevelop/Settings/Accessors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using PluginCore;
using PluginCore.Localization;
using ScintillaNet.Enums;
using TabDrawMode = ScintillaNet.Enums.TabDrawMode;

namespace FlashDevelop.Settings
{
Expand Down Expand Up @@ -390,6 +391,11 @@ public int ClipboardHistorySize
}
}

[DefaultValue(TabDrawMode.LongArrow)]
[DisplayName("Tab draw mode")]
[LocalizedCategory("FlashDevelop.Category.Editor")]
public TabDrawMode TabDrawMode { get; set; } = TabDrawMode.LongArrow;

#endregion

#region Locale
Expand Down
3 changes: 2 additions & 1 deletion PluginCore/PluginCore/Interfaces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using ScintillaNet.Configuration;
using ScintillaNet.Enums;
using WeifenLuo.WinFormsUI.Docking;
using TabDrawMode = ScintillaNet.Enums.TabDrawMode;

namespace PluginCore
{
Expand Down Expand Up @@ -576,7 +577,7 @@ public interface ISettings
bool EndAtLastLine { get; set; }
string InsertionTriggers { get; set; }
int ClipboardHistorySize { get; set; }

TabDrawMode TabDrawMode { get; set; }
#endregion
}

Expand Down
12 changes: 10 additions & 2 deletions PluginCore/ScintillaNet/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public enum MarginType
Back = 2,
Fore = 3,
Text = 4,
Rtext = 5
Rtext = 5,
Color = 6,
}

public enum WhiteSpace
Expand All @@ -106,6 +107,7 @@ public enum StylesCommon
ControlChar = 36,
IndentGuide = 37,
Calltip = 38,
FoldDisplayText = 39,
LastPredefined = 39,
Max = 255
}
Expand Down Expand Up @@ -505,4 +507,10 @@ public enum HighlightMatchingWordsMode
SelectedWord,
None
}
}

public enum TabDrawMode
{
LongArrow = 0,
StrikeOut = 1,
}
}
6 changes: 3 additions & 3 deletions PluginCore/ScintillaNet/Lexers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public enum CPP
HASHQUOTEDSTRING = 22,
PREPROCESSORCOMMENT = 23,
PREPROCESSORCOMMENTDOC = 24,
WORD3 = 24,
WORD4 = 25,
WORD5 = 26,
WORD3 = 100,
WORD4 = 101,
WORD5 = 102,
GDEFAULT = 32,
LINENUMBER = 33,
BRACELIGHT = 34,
Expand Down
Loading