Skip to content

Commit

Permalink
qol improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
n1d3v committed Jun 22, 2024
1 parent 289d26f commit 17bea64
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 17 deletions.
11 changes: 6 additions & 5 deletions Naticord/Forms/DM.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion Naticord/Forms/DM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,19 @@ private void ShowErrorMessage(string message, Exception ex)

public void ScrollToBottom()
{
chatBox.Document.Window.ScrollTo(0, chatBox.Document.Body.ScrollRectangle.Height);
try
{
if (chatBox.Document != null && chatBox.Document.Body != null)
{
chatBox.Document.OpenNew(true);
chatBox.Document.Write(htmlStart + htmlMiddle + htmlEnd);
chatBox.Document.Window.ScrollTo(0, chatBox.Document.Body.ScrollRectangle.Bottom);
}
}
catch (Exception ex)
{
// who tf cares bro it works
}
}

private void messageBox_KeyDown(object sender, KeyEventArgs e)
Expand Down
7 changes: 4 additions & 3 deletions Naticord/Forms/Group.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Naticord/Forms/Group.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ public void ScrollToBottom()
}
}


private void messageBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter && !e.Shift)
Expand Down
9 changes: 5 additions & 4 deletions Naticord/Forms/Server.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions Naticord/Forms/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,22 @@ private void channelList_DoubleClick(object sender, EventArgs ex)
}
}

private void ScrollToBottom()
public void ScrollToBottom()
{
Application.DoEvents();
chatBox.Navigate("javascript:window.scroll(0,document.body.scrollHeight);");
try
{
Application.DoEvents();
if (chatBox.Document != null && chatBox.Document.Body != null)
{
chatBox.Document.OpenNew(true);
chatBox.Document.Write(htmlStart + htmlMiddle + htmlEnd);
chatBox.Document.Window.ScrollTo(0, chatBox.Document.Body.ScrollRectangle.Bottom);
}
}
catch (Exception ex)
{
// who tf cares bro it works
}
}

protected override void OnShown(EventArgs e)
Expand Down

0 comments on commit 17bea64

Please sign in to comment.