mirror of
https://github.com/yaakov-h/Notepad.Extensions.Logging.git
synced 2024-11-22 03:04: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:
|
case WindowKind.Notepad:
|
||||||
SendMessage(info.Handle, EM_REPLACESEL, (IntPtr)1, message);
|
SendMessage(info.Handle, EM_REPLACESEL, (IntPtr)1, message);
|
||||||
break;
|
break;
|
||||||
|
case WindowKind.Notepad2:
|
||||||
case WindowKind.NotepadPlusPlus:
|
case WindowKind.NotepadPlusPlus:
|
||||||
WriteToNotepadPlusPlus(info.Handle, message);
|
WriteToNotepadPlusPlus(info.Handle, message);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -44,6 +44,12 @@ namespace Notepad.Extensions.Logging
|
||||||
sb.Remove(0, 1);
|
sb.Remove(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sb.Length > 0 && sb[0] == ' ')
|
||||||
|
{
|
||||||
|
// Notepad2 added space after asterisk
|
||||||
|
sb.Remove(0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (IsKnownNotepadWindow(sb.ToString()))
|
if (IsKnownNotepadWindow(sb.ToString()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -60,13 +66,28 @@ namespace Notepad.Extensions.Logging
|
||||||
{
|
{
|
||||||
if (WindowName.Equals(titleText, StringComparison.Ordinal))
|
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))
|
else if (titleText.Equals("Untitled - Notepad", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
WindowKind = WindowKind.Notepad;
|
WindowKind = WindowKind.Notepad;
|
||||||
}
|
}
|
||||||
|
else if (titleText.Equals("Untitled - Notepad2", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
WindowKind = WindowKind.Notepad2;
|
||||||
|
}
|
||||||
else if (notepadPlusPlusRegex.IsMatch(titleText))
|
else if (notepadPlusPlusRegex.IsMatch(titleText))
|
||||||
{
|
{
|
||||||
WindowKind = WindowKind.NotepadPlusPlus;
|
WindowKind = WindowKind.NotepadPlusPlus;
|
||||||
|
@ -83,6 +104,7 @@ namespace Notepad.Extensions.Logging
|
||||||
{
|
{
|
||||||
case WindowKind.Notepad:
|
case WindowKind.Notepad:
|
||||||
return NativeMethods.FindWindowEx(Handle, IntPtr.Zero, "EDIT", null);
|
return NativeMethods.FindWindowEx(Handle, IntPtr.Zero, "EDIT", null);
|
||||||
|
case WindowKind.Notepad2:
|
||||||
case WindowKind.NotepadPlusPlus:
|
case WindowKind.NotepadPlusPlus:
|
||||||
return NativeMethods.FindWindowEx(Handle, IntPtr.Zero, "Scintilla", null);
|
return NativeMethods.FindWindowEx(Handle, IntPtr.Zero, "Scintilla", null);
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -5,5 +5,6 @@
|
||||||
Invalid,
|
Invalid,
|
||||||
Notepad,
|
Notepad,
|
||||||
NotepadPlusPlus,
|
NotepadPlusPlus,
|
||||||
|
Notepad2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue