fixed html
This commit is contained in:
parent
28a7898071
commit
94b152ec45
@ -113,6 +113,7 @@ namespace cashew
|
|||||||
{
|
{
|
||||||
pythonRun.Text = pythonScript != null && runningStates.Contains(pythonScript.ThreadState) ? "Stop" : "Run";
|
pythonRun.Text = pythonScript != null && runningStates.Contains(pythonScript.ThreadState) ? "Stop" : "Run";
|
||||||
cseditrun.Text = csScript != null && runningStates.Contains(csScript.ThreadState) ? "Stop" : "Run";
|
cseditrun.Text = csScript != null && runningStates.Contains(csScript.ThreadState) ? "Stop" : "Run";
|
||||||
|
htmlOptionsTile.Enabled = htmlText.ActiveTextAreaControl.TextArea.SelectionManager.HasSomethingSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion General
|
#endregion General
|
||||||
@ -295,8 +296,9 @@ namespace cashew
|
|||||||
|
|
||||||
#region HTML
|
#region HTML
|
||||||
|
|
||||||
private int sels = 0;
|
private Point sels = Point.Empty;
|
||||||
private int sele = 0;
|
private Point sele = Point.Empty;
|
||||||
|
private bool htmlHasSelection = false;
|
||||||
private bool UpdateHTML = true;
|
private bool UpdateHTML = true;
|
||||||
|
|
||||||
private void htmldisplay_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
|
private void htmldisplay_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
|
||||||
@ -328,22 +330,26 @@ namespace cashew
|
|||||||
|
|
||||||
private void htmlOptionsTile_MouseEnter(object sender, EventArgs e)
|
private void htmlOptionsTile_MouseEnter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (htmlText.ActiveTextAreaControl.TextArea.SelectionManager.HasSomethingSelected)
|
htmlHasSelection = htmlText.ActiveTextAreaControl.TextArea.SelectionManager.HasSomethingSelected;
|
||||||
|
if (htmlHasSelection)
|
||||||
{
|
{
|
||||||
ISelection sel = htmlText.ActiveTextAreaControl.SelectionManager.SelectionCollection[0];
|
ISelection sel = htmlText.ActiveTextAreaControl.SelectionManager.SelectionCollection[0];
|
||||||
List<string> tmp = htmlText.Text.Split(new string[] { "\r\n" }, StringSplitOptions.None).ToList();
|
sels.Y = sel.StartPosition.Line;
|
||||||
//Not working: sele not working
|
sels.X = sel.StartPosition.Column;
|
||||||
tmp.RemoveRange(sel.EndPosition.Line - 1, tmp.Count - sel.EndPosition.Line); //Determines line
|
sele.Y = sel.EndPosition.Line;
|
||||||
sels = string.Join("\r\n", tmp.ToArray()).ToCharArray().Length + sel.StartPosition.Column; //Line + Column
|
sele.X = sel.EndPosition.Column;
|
||||||
sele = sels + sel.Length;
|
|
||||||
}
|
}
|
||||||
else { sels = 0; sele = htmlText.Text.Length; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToHTMLBox(string inFront, string atEnd)
|
private void addToHTMLBox(string inFront, string atEnd)
|
||||||
{
|
{
|
||||||
htmlText.Text = htmlText.Text.Insert(sele, atEnd);
|
if (htmlHasSelection)
|
||||||
htmlText.Text = htmlText.Text.Insert(sels, inFront);
|
{
|
||||||
|
List<string> temp = htmlText.Text.Split(new string[] { "\r\n" }, StringSplitOptions.None).ToList();
|
||||||
|
temp[sele.Y] = temp[sele.Y].Insert(sele.X, atEnd);
|
||||||
|
temp[sels.Y] = temp[sels.Y].Insert(sels.X, inFront);
|
||||||
|
htmlText.Text = string.Join("\r\n", temp.ToArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void htmlSave_Click(object sender, EventArgs e)
|
private void htmlSave_Click(object sender, EventArgs e)
|
||||||
|
Reference in New Issue
Block a user