public TerminalChanges GetChanges()
        {
            // get changed lines in buffer to the context (console or terminal)

            var changes = new TerminalChanges();

            var xs = 0;
            var ys = 0;

            while (ys < CurrentBuffer.Height)
            {
                if (IsLineChanged(CurrentBuffer, LastBuffer, ys))
                {
                    var line = changes.AddLine(ys);

                    xs = 0;
                    var str      = new System.Text.StringBuilder();
                    var cur_fore = CurrentBuffer[xs, ys].ForeColor;
                    var cur_back = CurrentBuffer[xs, ys].BackColor;
                    var cur_x    = 0;

                    while (xs < CurrentBuffer.Width)
                    {
                        var buf_char = CurrentBuffer[xs, ys];
                        if (buf_char.ForeColor != cur_fore || buf_char.BackColor != cur_back)
                        {
                            line.AddSpan(str.ToString(), cur_fore, cur_back, cur_x);
                            str      = new System.Text.StringBuilder();
                            cur_fore = buf_char.ForeColor;
                            cur_back = buf_char.BackColor;
                            cur_x    = xs;
                        }
                        str.Append(buf_char.Ch);

                        xs += 1;
                    }
                    line.AddSpan(str.ToString(), cur_fore, cur_back, cur_x);
                }
                ys += 1;
            }

            return(changes);
        }
Exemple #2
0
 public abstract void SubmitChanges(TerminalChanges changes);