-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindow.cs
43 lines (35 loc) · 929 Bytes
/
Window.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.Collections.Generic;
namespace TextEditor
{
public class Window
{
const int DEFAULT_HEIGHT = 24;
const int DEFAULT_WIDTH = 80;
Buffer Buffer;
List<Cursor> CursorList;
public int Height { get; }
public int Width { get; }
public Window(int height = DEFAULT_HEIGHT, int width = DEFAULT_WIDTH)
{
Buffer = new Buffer();
CursorList = new List<Cursor>();
Cursor c = new Cursor();
c.Position.Top = 1;
CursorList.Add(c);
Height = height;
Width = width;
}
public Buffer GetActiveBuffer()
{
return Buffer;
}
public Cursor GetActiveCursor()
{
return CursorList.First();
}
public Line GetLineAt(int index)
{
return Buffer.GetLineAt(index);
}
}
}