public void ResizeBuffer(int width, int height) { width = Math.Max(width, WindowWidth); height = Math.Max(height, WindowHeight); if (width != BufferWidth || height != BufferHeight) { var x = 0; var w = Math.Min(width, BufferWidth - x); var y = Math.Max(0, LastRow - height - 1); var h = Math.Min(height, BufferHeight - y); var buf = new TextBuffer(width, height, Buffer.ForeColor, Buffer.BackColor); buf.CopyRect(0, 0, Buffer, x, y, w, h); CursorPos = Rebase(x, y, width, height, CursorPos); homePos = Rebase(x, y, width, height, homePos); //caretPos = Rebase(x, y, width, height, caretPos); savedPos = Rebase(x, y, width, height, savedPos); LastPos = Rebase(x, y, width, height, LastPos); if (BufferMark != -1) { BufferMark = Rebase(x, y, width, height, BufferMark); } if (BufferBound != -1) { BufferBound = Rebase(x, y, width, height, BufferBound); } Buffer = buf; Refresh(); } }
public TextBuffer Copy(int x, int y, int w, int h) { var buf = new TextBuffer(w, h, ForeColor, BackColor); buf.CopyRect(0, 0, this, x, y, w, h); return(buf); }
public void ResizeBuffer(int width, int height) { width = Math.Max(width, WindowWidth); height = Math.Max(height, WindowHeight); if (width != BufferWidth || height != BufferHeight) { var x = 0; var w = Math.Min(width, BufferWidth - x); var y = Math.Max(0, LastRow - height - 1); var h = Math.Min(height, BufferHeight - y); var buf = new TextBuffer(width, height, Buffer.ForeColor, Buffer.BackColor); buf.CopyRect(0, 0, Buffer, x, y, w, h); CursorPos = Rebase(x, y, width, height, CursorPos); homePos = Rebase(x, y, width, height, homePos); //caretPos = Rebase(x, y, width, height, caretPos); savedPos = Rebase(x, y, width, height, savedPos); LastPos = Rebase(x, y, width, height, LastPos); if (BufferMark != -1) { BufferMark = Rebase(x, y, width, height, BufferMark); } if (BufferBound != -1) { BufferBound = Rebase(x, y, width, height, BufferBound); } Buffer = buf; Refresh(); } }
public TextBuffer Copy(int x, int y, int w, int h) { var buf = new TextBuffer(w, h, ForeColor, BackColor); buf.CopyRect(0, 0, this, x, y, w, h); return buf; }