public static string GetSelectedText(this ScintillaGateway document)
        {
            int start = document.GetSelectionStart();
            int end   = document.GetSelectionEnd();

            return(document.GetTextBetween(start, end));
        }
        public static int CaretToTextPosition(this ScintillaGateway document, int position)
        {
            string text = document.GetTextBetween(0, position);

            return(Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(text)).Length);
        }