Пример #1
0
        public windowTerminalGTK(clsHost host)
            : base(String.Format("{0} - {1}:{2}",host.Name,host.RemoteHost,host.RemoteSSHPort))
        {
            SSH = new clsSSHTerminal(host);
            Host = host;

            ScrolledWindow scrolledWindow = new ScrolledWindow();
            textview1 = new TextView();

            this.SetSizeRequest(800,600);

            scrolledWindow.Add(textview1);
            textview1.ModifyFont(FontDescription.FromString(host.TerminalFont));

            this.Add(scrolledWindow);

            this.CanFocus = true;

            ShowAll ();

            SSH.TerminalData += (string text) =>
            {
                Gtk.Application.Invoke (delegate {
                    TextIter mIter = textview1.Buffer.EndIter;
                    textview1.Buffer.Insert(ref mIter, text);
                    textview1.ScrollToIter(textview1.Buffer.EndIter, 0, false, 0, 0);
                });
            };
        }
Пример #2
0
    public void HilightWord()
    {
        Gtk.TextIter prevEndCharIter = new Gtk.TextIter();
        //Gtk.TextIter nextCharIter = new Gtk.TextIter ();

        if (!(endHilightIter.Equal(Gtk.TextIter.Zero)))
        {
            textBuffer.RemoveTag("hilight", startHilightIter, endHilightIter);
        }

        startHilightIter = startWordIter;
        endHilightIter   = endWordIter;
        prevEndCharIter  = endWordIter;
        prevEndCharIter.BackwardChar();
        while (Regex.IsMatch(startHilightIter.Char, @"[\s-]", RegexOptions.None))
        {
            startHilightIter.ForwardChar();
        }

        while (Regex.IsMatch(prevEndCharIter.Char, @"\s", RegexOptions.None) &&
               Regex.IsMatch(endHilightIter.Char, @"\S", RegexOptions.None))
        {
            endHilightIter.BackwardChar();
            prevEndCharIter.BackwardChar();
        }

        textBuffer.ApplyTag(tag, startHilightIter, endHilightIter);
        textView.ScrollToIter(endWordIter, 0, false, 0, 0);


        if (!running)
        {
            statusBar.Push(0, "Stopped at position " + startWordIter.Offset);
        }
    }