private void scintilla_UpdateUI(object sender, EventArgs e)
{
UpdateToolbarButtonsIfNecessary();
if (cmbFunctions.Items.Count > 0)
{
SelectFunctionInListForCurrentPosition();
}
if (scintilla.FirstVisibleLine != 0)
{
//This 'hack' is used in order to save the position of the scrollbar
//when the docking has changed, in order to recreate the document
//with the previous scrollbar position.
//When the docking state changes, the first visible line in scintilla
//changes to 0, before we have a chance of saving it, and use it
//to recreate the scrollbar position.
//The only scenario in which this will not work is if the scrollbar position
//really was 0, but then the user could simply press Ctrl+Home and fix this easily.
_firstVisibleLine = scintilla.FirstVisibleLine;
}
}