summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/main.c b/main.c
index 3b0ee82..151f2cd 100644
--- a/main.c
+++ b/main.c
@@ -529,6 +529,7 @@ void draw_buf(EditBuf *eb) {
VuiAttr txt = A_DEFAULT;
VuiAttr trailsp = BG_BLUE | FG_DEFAULT;
VuiAttr sel = norm | A_REVERSE;
+ if (eb->type != ED_BUF_FILE) txt |= A_ITALIC;
vui_clear();
{
@@ -540,11 +541,8 @@ void draw_buf(EditBuf *eb) {
VuiAttr a = i == e.bufi ? sel : norm;
Str p = basename(b->path);
x += vui_aprintf(x, y, a, " %.*s", (int)p.n, p.s);
- if (b->type != ED_BUF_SCRATCH && b->txt->ptbl.dirty) {
- x += vui_putsa(x, y, "* ", a);
- } else {
- vui_chra(x++, y, ' ', a);
- }
+ if (b->type != ED_BUF_SCRATCH && b->txt->ptbl.dirty) vui_chra(x++, y, '*', a);
+ vui_chra(x++, y, ' ', a);
}
int n = COLS;
if (e.msg.n) {
@@ -1608,6 +1606,8 @@ void mode_key_normal(Editor *e, u32 c) {
void mode_key_insert(Editor *e, u32 c) {
EditBuf *eb = &e->buf[e->bufi];
+ if (c != KEY_ESC && eb->txt->readonly)
+ e->msg = S("readonly buffer");
switch (c) {
case KEY_ESC:
if (txt_after(eb->cur, start_of_line(eb->cur))) {