Пример #1
0
        //これを送ってくるアプリケーションは viで下方スクロール
        protected void ProcessDeleteLines(string param)
        {
            int d = ParseInt(param, 1);

            /*
             * TerminalDocument doc = GetDocument();
             * _manipulator.Clear(GetConnection().TerminalWidth);
             * GLine target = doc.CurrentLine;
             * for(int i=0; i<d; i++) {
             *  target.Clear();
             *  target = target.NextLine;
             * }
             */

            TerminalDocument doc = GetDocument();
            int   caret_col      = _manipulator.CaretColumn;
            int   offset         = doc.CurrentLineNumber - doc.TopLineNumber;
            GLine nl             = _manipulator.Export();

            doc.ReplaceCurrentLine(nl);
            if (doc.ScrollingBottom == -1)
            {
                doc.SetScrollingRegion(0, doc.TerminalHeight - 1);
            }

            for (int i = 0; i < d; i++)
            {
                doc.ScrollDown(doc.CurrentLineNumber, doc.ScrollingBottom);
                doc.CurrentLineNumber = doc.TopLineNumber + offset;
            }
            _manipulator.Load(doc.CurrentLine, caret_col);
        }
Пример #2
0
        //これを送ってくるアプリケーションは viで上方スクロール
        protected void ProcessInsertLines(string param)
        {
            int d = ParseInt(param, 1);

            /*
             * TerminalDocument doc = GetDocument();
             * for(int i=0; i<d; i++)
             *      doc.InsertAfter(doc.CurrentLine, new GLine(GetConnection().TerminalWidth));
             */
            TerminalDocument doc = GetDocument();
            int   caret_pos      = _manipulator.CaretColumn;
            int   offset         = doc.CurrentLineNumber - doc.TopLineNumber;
            GLine nl             = _manipulator.Export();

            doc.ReplaceCurrentLine(nl);
            if (doc.ScrollingBottom == -1)
            {
                doc.SetScrollingRegion(0, GetConnection().TerminalHeight - 1);
            }

            for (int i = 0; i < d; i++)
            {
                doc.ScrollUp(doc.CurrentLineNumber, doc.ScrollingBottom);
                doc.CurrentLineNumber = doc.TopLineNumber + offset;
            }
            _manipulator.Load(doc.CurrentLine, caret_pos);
        }
Пример #3
0
        private void ProcessScrollUp(string param)
        {
            int d = ParseInt(param, 1);

            TerminalDocument doc = GetDocument();
            int   caret_col      = _manipulator.CaretColumn;
            int   offset         = doc.CurrentLineNumber - doc.TopLineNumber;
            GLine nl             = _manipulator.Export();

            doc.ReplaceCurrentLine(nl);
            if (doc.ScrollingBottom == -1)
            {
                doc.SetScrollingRegion(0, GetDocument().TerminalHeight - 1);
            }
            for (int i = 0; i < d; i++)
            {
                doc.ScrollDown(doc.ScrollingTop, doc.ScrollingBottom); // TerminalDocument's "Scroll-Down" means XTerm's "Scroll-Up"
                doc.CurrentLineNumber = doc.TopLineNumber + offset;    // find correct GLine
            }
            _manipulator.Load(doc.CurrentLine, caret_col);
        }
Пример #4
0
        //これを送ってくるアプリケーションは viで上方スクロール
        protected void ProcessInsertLines(string param)
        {
            int d = ParseInt(param, 1);

            TerminalDocument doc = GetDocument();
            int caret_pos        = _manipulator.CaretColumn;
            int offset           = doc.CurrentLineNumber - doc.TopLineNumber;

            doc.UpdateCurrentLine(_manipulator);
            if (doc.ScrollingBottom == -1)
            {
                doc.SetScrollingRegion(0, GetDocument().TerminalHeight - 1);
            }

            for (int i = 0; i < d; i++)
            {
                doc.ScrollUp(doc.CurrentLineNumber, doc.ScrollingBottom);
                doc.CurrentLineNumber = doc.TopLineNumber + offset;
            }
            _manipulator.Load(doc.CurrentLine, caret_pos);
        }