]> git.lizzy.rs Git - micro.git/blob - src/statusline.d
Start selection box
[micro.git] / src / statusline.d
1 import termbox;
2 import view;
3
4 class StatusLine {
5     View view;
6
7     this(View v) {
8         this.view = v;
9     }
10
11     void display() {
12         int y = view.height;
13         string file = view.buf.path;
14         if (file == "") {
15             file = "untitled";
16         }
17         if (view.buf.toString != view.buf.savedText) {
18             file ~= " +";
19         }
20         file ~= "  (" ~ to!string(view.cursor.y + 1) ~ "," ~ to!string(view.cursor.x + 1) ~ ")";
21         foreach (x; 0 .. view.width) {
22             if (x >= 1 && x < 1 + file.length) {
23                 setCell(x, y, cast(uint) file[x - 1], Color.black, Color.blue);
24             } else  {
25                 setCell(x, y, ' ', Color.black, Color.blue);
26             }
27         }
28     }
29 }