Exemplo n.º 1
0
        internal void ScrollDown(int from, int to)
        {
            GLine top    = FindLineOrEdge(from);
            GLine bottom = FindLineOrEdge(to);
            int   top_id = top.ID;
            GLine newtop = top.NextLine;

            if (from == to)
            {
                _currentLine = top;
                _currentLine.Clear();
            }
            else
            {
                Remove(top); //_topLineの調整は必要ならここで行われる
                _currentLine = new GLine(_width);
                InsertAfter(bottom, _currentLine);

                //id maintainance
                GLine c   = newtop;
                GLine end = _currentLine.NextLine;
                while (c != end)
                {
                    c.ID = top_id++;
                    c    = c.NextLine;
                }
            }

            _invalidatedRegion.InvalidatedAll = true;
        }
Exemplo n.º 2
0
        public CommandResult ClearScreen()
        {
            ConnectionTag    tag = GEnv.Connections.FindTag(_connection);
            TerminalDocument doc = tag.Document;

            lock (doc) {
                GLine l      = doc.TopLine;
                int   top_id = l.ID;
                int   limit  = l.ID + _connection.TerminalHeight;
                while (l != null && l.ID < limit)
                {
                    l.Clear();
                    l = l.NextLine;
                }
                doc.CurrentLineNumber = top_id;
                doc.CaretColumn       = 0;
                doc.InvalidateAll();
                if (tag.Pane != null)
                {
                    GEnv.TextSelection.Clear();
                    tag.Pane.Invalidate();
                }
            }
            return(CommandResult.Success);
        }
Exemplo n.º 3
0
        private static CommandResult CmdClearScreen(ICommandTarget target)
        {
            TerminalDocument doc = TerminalCommandTarget.AsTerminalDocument(target);

            if (doc == null)
            {
                return(CommandResult.Ignored);
            }

            TerminalControl tc = TerminalCommandTarget.AsTerminalControl(target);

            lock (doc) {
                GLine l      = doc.TopLine;
                int   top_id = l.ID;
                int   limit  = l.ID + doc.TerminalHeight;
                while (l != null && l.ID < limit)
                {
                    l.Clear();
                    l = l.NextLine;
                }
                doc.CurrentLineNumber = top_id;
                doc.CaretColumn       = 0;
                doc.InvalidatedRegion.InvalidatedAll = true;
                if (tc != null)
                {
                    tc.ITextSelection.Clear();
                    tc.Invalidate();
                }
            }
            return(CommandResult.Succeeded);
        }
        internal void ScrollUp(int from, int to)
        {
            GLine removePoint = FindLineOrEdge(from);
            GLine insertPoint = FindLineOrEdge(to);

            if (removePoint == null || insertPoint == null)
            {
                return;                                                    //エラーハンドリングはFindLineの中で。ここではクラッシュ回避だけを行う
            }
            int   bottom_id  = insertPoint.ID;
            int   topline_id = _topLine.ID;
            GLine nextbottom = insertPoint.NextLine;

            // 2015-03-11 KM bugfix
            //   if(from==to) で比較していたのを if(removePoint==insertPoint) に変更。
            //   from==to だと FindLineOrEdge でずれて removePoint==insertPoint になった時に
            //   駄目な状態になる。
            if (removePoint == insertPoint)
            {
                _currentLine = insertPoint;
                _currentLine.Clear();
            }
            else
            {
                Remove(insertPoint);
                _currentLine = new GLine(_width);

                InsertBefore(removePoint, _currentLine);
                GLine c = _currentLine;
                do
                {
                    c.ID = from++;
                    c    = c.NextLine;
                } while(c != nextbottom);
                Debug.Assert(nextbottom == null || nextbottom.ID == from);
            }

            /*
             * //id maintainance
             * GLine c = newbottom;
             * GLine end = _currentLine.PrevLine;
             * while(c != end) {
             *      c.ID = bottom_id--;
             *      c = c.PrevLine;
             * }
             */

            //!!次の2行はxtermをやっている間に発見して修正。 VT100では何かの必要があってこうなったはずなので後で調べること
            //if(_scrollingTop<=_topLine.ID && _topLine.ID<=_scrollingBottom)
            //	_topLine = _currentLine;
            while (topline_id < _topLine.ID)
            {
                _topLine = _topLine.PrevLine;
            }


            _invalidatedRegion.InvalidatedAll = true;
        }
Exemplo n.º 5
0
        internal void ScrollUp(int from, int to)
        {
            GLine top    = FindLineOrEdge(from);
            GLine bottom = FindLineOrEdge(to);

            if (top == null || bottom == null)
            {
                return; //エラーハンドリングはFindLineの中で。ここではクラッシュ回避だけを行う
            }
            int   bottom_id  = bottom.ID;
            int   topline_id = _topLine.ID;
            GLine nextbottom = bottom.NextLine;

            if (from == to)
            {
                _currentLine = top;
                _currentLine.Clear();
            }
            else
            {
                Remove(bottom);
                _currentLine = new GLine(_width);

                InsertBefore(top, _currentLine);
                GLine c = _currentLine;
                do
                {
                    c.ID = from++;
                    c    = c.NextLine;
                } while (c != nextbottom);
                Debug.Assert(nextbottom == null || nextbottom.ID == from);
            }

            /*
             * //id maintainance
             * GLine c = newbottom;
             * GLine end = _currentLine.PrevLine;
             * while(c != end) {
             *  c.ID = bottom_id--;
             *  c = c.PrevLine;
             * }
             */

            //!!次の2行はxtermをやっている間に発見して修正。 VT100では何かの必要があってこうなったはずなので後で調べること
            //if(_scrollingTop<=_topLine.ID && _topLine.ID<=_scrollingBottom)
            //	_topLine = _currentLine;
            while (topline_id < _topLine.ID)
            {
                _topLine = _topLine.PrevLine;
            }


            _invalidatedRegion.InvalidatedAll = true;
        }
        internal void ScrollDown(int from, int to)
        {
            GLine removePoint = FindLineOrEdge(from);
            GLine insertPoint = FindLineOrEdge(to);
            int   top_id      = removePoint.ID;
            GLine newtop      = removePoint.NextLine;

            // 2015-03-11 KM bugfix
            //   if(from==to) で比較していたのを if(removePoint==insertPoint) に変更。
            //   from==to だと FindLineOrEdge でずれて removePoint==insertPoint になった時に
            //   駄目な状態になる。
            if (removePoint == insertPoint)
            {
                _currentLine = removePoint;
                _currentLine.Clear();
            }
            else
            {
                bool removed = Remove(removePoint);               //_topLineの調整は必要ならここで行われる
                _currentLine = new GLine(_width);
                InsertAfter(insertPoint, _currentLine);

                //id maintainance
                if (removed)
                {
                    GLine c   = newtop;
                    GLine end = _currentLine.NextLine;
                    while (c != end)
                    {
                        c.ID = top_id++;
                        c    = c.NextLine;
                    }
                }
                else
                {
                    GLine line  = _currentLine;
                    GLine lineM = _lastLine;
                    for (;;)
                    {
                        line.ID = line.PrevLine.ID + 1;
                        if (line == lineM)
                        {
                            break;
                        }
                        line = line.NextLine;
                    }
                    _scrollingTop++;
                    _scrollingBottom++;
                }
            }

            _invalidatedRegion.InvalidatedAll = true;
        }
Exemplo n.º 7
0
        public void ClearRange(int from, int to, TextDecoration dec)
        {
            GLine l = FindLineOrNullClipTop(from);

            if (l == null)
            {
                return;
            }

            while (l != null && l.ID < to)
            {
                l.Clear(dec);
                _invalidatedRegion.InvalidateLine(l.ID);
                l = l.NextLine;
            }
        }
Exemplo n.º 8
0
        public void ClearAfter(int from, TextDecoration dec)
        {
            GLine l = FindLineOrNullClipTop(from);

            if (l == null)
            {
                return;
            }

            while (l != null)
            {
                l.Clear(dec);
                l = l.NextLine;
            }

            _invalidatedRegion.InvalidatedAll = true;
        }