Fixed bug when the status panel did not work

This commit is contained in:
Alexander 2019-10-21 15:20:40 +03:00
parent 2af83d4b1d
commit 9de470dfa7
2 changed files with 16 additions and 10 deletions

View file

@ -957,6 +957,7 @@ public void InitializeComponent()
this.statusPanel.Name = "statusPanel";
this.statusPanel.Size = new System.Drawing.Size(484, 22);
this.statusPanel.TabIndex = 18;
this.statusPanel.VisibleChanged += new System.EventHandler(this.StatusPanel_VisibleChanged);
//
// statusPanelLabel
//

View file

@ -430,28 +430,25 @@ private async void StatusPanelMessage(string type)
private void StatusPanelTextInfo()
{
int currentColumn = 0;
int currentLine = 0;
int linesCount = 0;
if (statusPanel.Visible)
{
currentColumn = 1 + richTextBox.SelectionStart - richTextBox.GetFirstCharIndexOfCurrentLine();
int currentColumn = 1 + richTextBox.SelectionStart - richTextBox.GetFirstCharIndexOfCurrentLine();
RichTextBox rtb = new RichTextBox
{
WordWrap = false,
Text = richTextBox.Text
};
currentLine = 1 + rtb.GetLineFromCharIndex(richTextBox.SelectionStart);
linesCount = richTextBox.Lines.Count();
int currentLine = 1 + rtb.GetLineFromCharIndex(richTextBox.SelectionStart);
int linesCount = richTextBox.Lines.Count();
if (linesCount == 0)
{
linesCount = 1;
}
statusPanelLengthLabel.Text = "Length: " + richTextBox.TextLength;
statusPaneLinesLabel.Text = "Lines: " + linesCount;
statusPaneLnLabel.Text = "Ln: " + currentLine;
statusPaneColLabel.Text = "Col: " + currentColumn;
}
statusPanelLengthLabel.Text = "Length: " + richTextBox.TextLength;
statusPaneLinesLabel.Text = "Lines: " + linesCount;
statusPaneLnLabel.Text = "Ln: " + currentLine;
statusPaneColLabel.Text = "Col: " + currentColumn;
}
private void LockFile()
@ -659,6 +656,13 @@ public void ToolbarIcons(bool oldIcons)
#region Event Handlers
private void StatusPanel_VisibleChanged(object sender, EventArgs e)
{
if (statusPanel.Visible)
{
StatusPanelTextInfo();
}
}
private void LineNumbers_VisibleChanged(object sender, EventArgs e)
{
if (lineNumbers.Visible)
@ -1769,6 +1773,7 @@ private void VariablesMainMenu_Click(object sender, EventArgs e)
Debug.WriteLine("EditorMenuStrip: " + contextMenu.Enabled);
#endif
}
#endregion