mirror of
https://github.com/yaakov-h/Notepad.Extensions.Logging.git
synced 2024-11-21 18:54:48 +00:00
Merge pull request #6 from 4lexKislitsyn/dev/notepad2
Added support of notepad2.
This commit is contained in:
commit
74b9d0bd1c
3 changed files with 25 additions and 1 deletions
|
@ -98,6 +98,7 @@ namespace Notepad.Extensions.Logging
|
|||
case WindowKind.Notepad:
|
||||
SendMessage(info.Handle, EM_REPLACESEL, (IntPtr)1, message);
|
||||
break;
|
||||
case WindowKind.Notepad2:
|
||||
case WindowKind.NotepadPlusPlus:
|
||||
WriteToNotepadPlusPlus(info.Handle, message);
|
||||
break;
|
||||
|
|
|
@ -44,6 +44,12 @@ namespace Notepad.Extensions.Logging
|
|||
sb.Remove(0, 1);
|
||||
}
|
||||
|
||||
if (sb.Length > 0 && sb[0] == ' ')
|
||||
{
|
||||
// Notepad2 added space after asterisk
|
||||
sb.Remove(0, 1);
|
||||
}
|
||||
|
||||
if (IsKnownNotepadWindow(sb.ToString()))
|
||||
{
|
||||
return false;
|
||||
|
@ -60,13 +66,28 @@ namespace Notepad.Extensions.Logging
|
|||
{
|
||||
if (WindowName.Equals(titleText, StringComparison.Ordinal))
|
||||
{
|
||||
WindowKind = titleText.EndsWith(" - Notepad++", StringComparison.Ordinal) ? WindowKind.NotepadPlusPlus : WindowKind.Notepad;
|
||||
if (titleText.EndsWith(" - Notepad++", StringComparison.Ordinal))
|
||||
{
|
||||
WindowKind = WindowKind.NotepadPlusPlus;
|
||||
}
|
||||
else if (titleText.EndsWith(" - Notepad2", StringComparison.Ordinal))
|
||||
{
|
||||
WindowKind = WindowKind.Notepad2;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowKind = WindowKind.Notepad;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (titleText.Equals("Untitled - Notepad", StringComparison.Ordinal))
|
||||
{
|
||||
WindowKind = WindowKind.Notepad;
|
||||
}
|
||||
else if (titleText.Equals("Untitled - Notepad2", StringComparison.Ordinal))
|
||||
{
|
||||
WindowKind = WindowKind.Notepad2;
|
||||
}
|
||||
else if (notepadPlusPlusRegex.IsMatch(titleText))
|
||||
{
|
||||
WindowKind = WindowKind.NotepadPlusPlus;
|
||||
|
@ -83,6 +104,7 @@ namespace Notepad.Extensions.Logging
|
|||
{
|
||||
case WindowKind.Notepad:
|
||||
return NativeMethods.FindWindowEx(Handle, IntPtr.Zero, "EDIT", null);
|
||||
case WindowKind.Notepad2:
|
||||
case WindowKind.NotepadPlusPlus:
|
||||
return NativeMethods.FindWindowEx(Handle, IntPtr.Zero, "Scintilla", null);
|
||||
default:
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
Invalid,
|
||||
Notepad,
|
||||
NotepadPlusPlus,
|
||||
Notepad2,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue