Skip to content
This repository was archived by the owner on Mar 4, 2018. It is now read-only.

Commit c1afd3f

Browse files
committed
Fix member list crash
1 parent cd993db commit c1afd3f

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

Forms/errorListing.cs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private void onSelectError(string File, int Line, int Col)
4949
IBMi.AddOutput(files[0] + " == " + files[1]);
5050
if (files[0] == files[1])
5151
{
52-
SwitchToFile(OpenFile, Line, Col);
52+
NppFunctions.SwitchToFile(OpenFile, Line, Col);
5353
return;
5454
}
5555
}
@@ -63,7 +63,7 @@ private void onSelectError(string File, int Line, int Col)
6363
IBMi.AddOutput(files[0] + " == " + files[1]);
6464
if (files[0] == files[1])
6565
{
66-
SwitchToFile(OpenFile, Line, Col);
66+
NppFunctions.SwitchToFile(OpenFile, Line, Col);
6767
return;
6868
}
6969
}
@@ -77,7 +77,7 @@ private void onSelectError(string File, int Line, int Col)
7777
IBMi.AddOutput(files[0] + " == " + files[1]);
7878
if (files[0] == files[1])
7979
{
80-
SwitchToFile(OpenFile, Line, Col);
80+
NppFunctions.SwitchToFile(OpenFile, Line, Col);
8181
return;
8282
}
8383
}
@@ -96,24 +96,7 @@ private static string GetQSYSMemberName(string Input)
9696
}
9797
return Input;
9898
}
99-
100-
private static void SwitchToFile(string name, int line, int col)
101-
{
102-
int pos = 0;
103-
IntPtr curScintilla = PluginBase.nppData._nppHandle;
104-
Win32.SendMessage(curScintilla, NppMsg.NPPM_SWITCHTOFILE, 0, name);
105-
106-
curScintilla = PluginBase.GetCurrentScintilla();
107-
Win32.SendMessage(curScintilla, SciMsg.SCI_ENSUREVISIBLE, line, 0);
108-
if (line >= 0)
109-
{
110-
pos = (int)Win32.SendMessage(curScintilla, SciMsg.SCI_POSITIONFROMLINE, line, 0);
111-
pos += col;
112-
Win32.SendMessage(curScintilla, SciMsg.SCI_GOTOPOS, pos, 0);
113-
Win32.SendMessage(curScintilla, SciMsg.SCI_GRABFOCUS, 0, 0);
114-
}
115-
}
116-
99+
117100
public void publishErrors()
118101
{
119102
Invoke((MethodInvoker)delegate

Forms/selectMember.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,16 @@ public void UpdateListing(string Lib, string Obj)
5555
}
5656

5757
listView1.Items.AddRange(curItems.ToArray());
58+
59+
toolStripLabel2.Text = members.Length.ToString() + " member" + (members.Length == 1 ? "" : "s");
5860
}
5961
else
6062
{
6163
listView1.Items.Add(new ListViewItem("No members found!", 1));
6264
if (Main.CommandWindow != null) Main.CommandWindow.loadNewCommands();
63-
}
6465

65-
toolStripLabel2.Text = members.Length.ToString() + " member" + (members.Length == 1 ? "" : "s");
66+
toolStripLabel2.Text = "0 members";
67+
}
6668
});
6769
gothread.Start();
6870
}

LanguageTools/NppFunctions.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,23 @@ public static void DisplayErrors(string Lib, string Obj)
6565
Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_DMMSHOW, 0, Main.ErrorWindow.Handle);
6666
}
6767
}
68+
69+
public static void SwitchToFile(string name, int line, int col)
70+
{
71+
int pos = 0;
72+
IntPtr curScintilla = PluginBase.nppData._nppHandle;
73+
Win32.SendMessage(curScintilla, NppMsg.NPPM_SWITCHTOFILE, 0, name);
74+
75+
curScintilla = PluginBase.GetCurrentScintilla();
76+
Win32.SendMessage(curScintilla, SciMsg.SCI_ENSUREVISIBLE, line, 0);
77+
if (line >= 0)
78+
{
79+
pos = (int)Win32.SendMessage(curScintilla, SciMsg.SCI_POSITIONFROMLINE, line, 0);
80+
pos += col;
81+
Win32.SendMessage(curScintilla, SciMsg.SCI_GOTOPOS, pos, 0);
82+
Win32.SendMessage(curScintilla, SciMsg.SCI_GRABFOCUS, 0, 0);
83+
}
84+
}
6885

6986
public static void HandleTrigger(SCNotification Notification)
7087
{

0 commit comments

Comments
 (0)