Skip to content

Commit d30906f

Browse files
committed
random tweaks to mousehook and codepanerefactorrenamecommand
1 parent 6791992 commit d30906f

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

RetailCoder.VBE/App.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
using Rubberduck.UI.Command.MenuItems;
1818
using Infralution.Localization.Wpf;
1919
using Rubberduck.Common.Dispatch;
20-
using Rubberduck.Common.Hotkeys;
21-
using Rubberduck.VBEditor.VBEInterfaces.RubberduckCodePane;
2220

2321
namespace Rubberduck
2422
{

RetailCoder.VBE/Common/MouseHook.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public void Attach()
7171
_hookId = User32.SetWindowsHookEx(WindowsHook.MOUSE_LL, _callback, handle, 0);
7272
if (_hookId == IntPtr.Zero)
7373
{
74+
IsAttached = false;
7475
throw new Win32Exception();
7576
}
7677

@@ -86,7 +87,7 @@ public void Detach()
8687
}
8788

8889
IsAttached = false;
89-
if (!User32.UnhookWindowsHookEx(_hookId))
90+
if (_hookId != IntPtr.Zero && !User32.UnhookWindowsHookEx(_hookId))
9091
{
9192
_hookId = IntPtr.Zero;
9293
throw new Win32Exception();

RetailCoder.VBE/UI/Command/Refactorings/CodePaneRefactorRenameCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ public override void Execute(object parameter)
4747
}
4848
else
4949
{
50-
var selection = Vbe.ActiveCodePane.GetSelection();
51-
target = _state.AllUserDeclarations.FindTarget(selection);
50+
target = _state.FindSelectedDeclaration(Vbe.ActiveCodePane);
5251
}
5352

5453
if (target == null)

0 commit comments

Comments
 (0)