/// <summary> /// Handle style needed event. /// </summary> /// <param name="s"></param> /// <param name="e"></param> private void HandleStyleNeeded(object s, StyleNeededEventArgs e) { try { FxLexer.Style(this, GetEndStyled(), TextLength); } catch (Exception ex) { System.Diagnostics.Debug.Print(ex.StackTrace); } }
/// <summary> /// Raises the <see cref="StyleNeeded" /> event. /// </summary> /// <param name="e">A <see cref="StyleNeededEventArgs" /> that contains the event data.</param> protected virtual void OnStyleNeeded(StyleNeededEventArgs e) { var handler = Events[styleNeededEventKey] as EventHandler<StyleNeededEventArgs>; if (handler != null) handler(this, e); }
private void OnScintillaStyleNeeded(object sender, StyleNeededEventArgs eventArgs) { int startPos = this.mScintilla.GetEndStyled(); int endPos = eventArgs.Position; this.mMainForm.HspLexer.Style(this.mScintilla, startPos, endPos); }
private void scintilla_StyleNeeded(object sender, StyleNeededEventArgs e) { // Style the _text if (_iniLexer) SCide.IniLexer.StyleNeeded((Scintilla)sender, e.Range); }
void scintilla_StyleNeeded(object sender, StyleNeededEventArgs e) { var startPos = scintilla1.GetEndStyled(); var endPos = e.Position; rdlLexer.StyleText(scintilla1, startPos, endPos); }
private void scintilla_StyleNeeded(object sender, StyleNeededEventArgs e) { try { // Style the _text if (_iniLexer) CodeEditor.IniLexer.StyleNeeded((Scintilla)sender, e.Range); } catch (Exception ex) { Log.Error(ex); } }
internal void FireStyleNeeded(NativeScintillaEventArgs ea) { if(Events[_styleNeededEventKeyNative] != null) ((EventHandler<NativeScintillaEventArgs>)Events[_styleNeededEventKeyNative])(this, ea); // TODO: When this event fires it fires A LOT over and over again if // you don't actually style the document. Additionally I'm making 2 // more calls to Scintilla to get the Start position of the style // range. I need to come up with a good way to supress this logic // unless the client app is actually interested in it. // Now that we've fired the Native event we do the same for the // SourceEdit's StyleNeeded event. This code should look VERY familliar // to anyone who's read the Scintilla Documentation int startPos = _ns.GetEndStyled(); int lineNumber = _ns.LineFromPosition(startPos); startPos = _ns.PositionFromLine(lineNumber); StyleNeededEventArgs snea = new StyleNeededEventArgs(new Range(startPos, ea.SCNotification.position, this)); OnStyleNeeded(snea); }
/// <summary> /// Deterimines leging range and applies ContainerLexer if defined /// </summary> /// <param name="e"></param> void ApplyContainerLexer(StyleNeededEventArgs e = null) { if (_ContainerLexer != null) { int start, end; if (e != null) { start = Lines[LineFromPosition(GetEndStyled())].Position; end = e.Position; if (ContainerLexerMode == ContainerLexerModes.Visible) { var visibleStart = Lines[FirstVisibleLine].Position; var visibleEnd = Lines[FirstVisibleLine + LinesOnScreen - 1].EndPosition; if (start < visibleStart) start = visibleStart; if (end > visibleEnd) end = visibleEnd; } } else { start = Lines[FirstVisibleLine].Position; end = Lines[FirstVisibleLine + LinesOnScreen - 1].EndPosition; } _ContainerLexer.ApplyStyles(start, end); } }
/// <summary> /// Invokes ContainerLexer in FullAuto mode /// </summary> /// <param name="e"></param> protected override void OnStyleNeeded(StyleNeededEventArgs e) { if (Lexer == Lexer.Container && ContainerLexerMode == ContainerLexerModes.FullAuto) ApplyContainerLexer(e); base.OnStyleNeeded(e); }
void NavPointListView_StyleNeeded(object sender, StyleNeededEventArgs e) { e.Range.SetStyle("orz"); }
private void Scintilla1_StyleNeeded(object sender, StyleNeededEventArgs e) { var startPos = scintilla1.GetEndStyled(); var endPos = e.Position; var length = 0; var state = LUA_STATES.STATE_UNKNOWN; while (startPos < endPos) { var c = (char)scintilla1.GetCharAt(startPos); REPROCESS: switch (state) { case LUA_STATES.STATE_UNKNOWN: if (c == '"') { scintilla1.SetStyling(1, (int)LUA_STYLES.STYLE_STRING); state = LUA_STATES.STATE_STRING; } else if (Char.IsDigit(c)) { state = LUA_STATES.STATE_NUMBER; goto REPROCESS; } else if (Char.IsLetter(c)) { state = LUA_STATES.STATE_IDENTIFIER; goto REPROCESS; } else if (c == '-') { if (startPos + 1 <= endPos) { if (scintilla1.GetCharAt(startPos + 1) == '-') { state = LUA_STATES.STATE_COMMENT; } } } else { scintilla1.SetStyling(1, (int)LUA_STYLES.STYLE_DEFAULT); } break; case LUA_STATES.STATE_STRING: if (c == '"') { length++; scintilla1.SetStyling(length, (int)LUA_STYLES.STYLE_STRING); length = 0; state = LUA_STATES.STATE_UNKNOWN; } else { length++; } break; case LUA_STATES.STATE_NUMBER: if (Char.IsDigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || c == 'x') { length++; } else { scintilla1.SetStyling(length, (int)LUA_STYLES.STYLE_NUMBER); length = 0; state = LUA_STATES.STATE_UNKNOWN; goto REPROCESS; } break; case LUA_STATES.STATE_COMMENT: if (c == '\n') { length++; scintilla1.SetStyling(length, (int)LUA_STYLES.STYLE_COMMENT); length = 0; state = LUA_STATES.STATE_UNKNOWN; } else { length++; } break; case LUA_STATES.STATE_IDENTIFIER: if (Char.IsLetterOrDigit(c)) { length++; } else { var style = (int)LUA_STYLES.STYLE_IDENTIFIER; var identifier = scintilla1.GetTextRange(startPos - length, length); if (LUA_KEYWORDS.Contains(identifier)) style = (int)LUA_STYLES.STYLE_KEYWORD; scintilla1.SetStyling(length, style); length = 0; state = LUA_STATES.STATE_UNKNOWN; goto REPROCESS; } break; } startPos++; } }