Skip to content

Commit

Permalink
changes to allow container lexer to be selected
Browse files Browse the repository at this point in the history
  • Loading branch information
Pabs84 committed Jan 26, 2024
1 parent fdc2c6f commit c868359
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Shared/Scintilla.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ private static string LocateNativeDllDirectory()
/// <returns><c>true</c> if the lexer was successfully set, <c>false</c> otherwise.</returns>
private bool SetLexerByName(string lexerName)
{
// this special case is reserved to select the container to do the styling, in which case the container is sent a StyleNeeded notification each time text needs styling for display.
if (lexerName == String.Empty)
{
DirectMessage(NativeMethods.SCI_SETILEXER, IntPtr.Zero, IntPtr.Zero);
return true;
}

var ptr = Lexilla.CreateLexer(lexerName);

if (ptr == IntPtr.Zero)
Expand Down Expand Up @@ -4919,11 +4926,6 @@ public Lexer Lexer
if (NativeMethods.NameConstantMap.ContainsKey(lexer))
{
lexerName = NativeMethods.NameConstantMap.First(f => f.Key == lexer).Value;

if (string.IsNullOrEmpty(lexerName))
{
throw new InvalidOperationException(@"No lexer name was found with the specified value.");
}
}
else
{
Expand Down

0 comments on commit c868359

Please sign in to comment.