Fix for PascalABC.NET for Linux
This commit is contained in:
parent
da05b63470
commit
1e1e9f009c
|
|
@ -88,6 +88,34 @@ namespace VisualPascalABC
|
|||
}
|
||||
}
|
||||
|
||||
void showChangedFileMessage()
|
||||
{
|
||||
string mes = null;
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
mes = Form1StringResources.Get("FILE_NOT_EXIST_MESSAGE");
|
||||
if (MessageBox.Show(fileName + "\n\n" + mes, Form1StringResources.Get("CHANGED_FILE"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.SetFileAsChanged(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.CloseFile(fileName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mes = Form1StringResources.Get("FILE_CHANGED_MESSAGE");
|
||||
if (MessageBox.Show(fileName + "\n\n" + mes, Form1StringResources.Get("CHANGED_FILE"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.ReloadFile(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.SetFileAsChanged(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void MainForm_Activated(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
|
|
@ -96,30 +124,8 @@ namespace VisualPascalABC
|
|||
{
|
||||
wasChangedExternally = false;
|
||||
|
||||
string mes = null;
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
mes = Form1StringResources.Get("FILE_NOT_EXIST_MESSAGE");
|
||||
if (MessageBox.Show(fileName + "\n\n" + mes, Form1StringResources.Get("CHANGED_FILE"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.SetFileAsChanged(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.CloseFile(fileName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mes = Form1StringResources.Get("FILE_CHANGED_MESSAGE");
|
||||
if (MessageBox.Show(fileName + "\n\n" + mes, Form1StringResources.Get("CHANGED_FILE"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.ReloadFile(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.SetFileAsChanged(fileName);
|
||||
}
|
||||
WorkbenchServiceFactory.Workbench.MainForm.BeginInvoke((Action)showChangedFileMessage);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ namespace VisualPascalABC
|
|||
return findSuccess;
|
||||
}
|
||||
if (cbSearchUp.Checked)
|
||||
Match = Regex.Match(Form1.CurrentSyntaxEditor.TextEditor.Document.TextContent, 0, startOffset);
|
||||
Match = Regex.Match(Form1.CurrentSyntaxEditor.TextEditor.Document.TextContent, 0, Math.Max(startOffset, 0));
|
||||
else
|
||||
Match = Regex.Match(Form1.CurrentSyntaxEditor.TextEditor.Document.TextContent, startOffset);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue