]> git.mdlowis.com Git - projs/tide.git/commitdiff
Added error message for quit appended to tags view
authorMichael D. Lowis <mike@mdlowis.com>
Sun, 27 Nov 2016 16:37:39 +0000 (11:37 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Sun, 27 Nov 2016 16:37:39 +0000 (11:37 -0500)
inc/edit.h
libedit/view.c
xedit.c

index b8dced645abe78d9e5ac8240df1c39a9086bcb48..562f59318e0eef1963c50e41e5e5a5f47c9cb822 100644 (file)
@@ -168,6 +168,7 @@ void view_eol(View* view);
 void view_undo(View* view);
 void view_redo(View* view);
 void view_putstr(View* view, char* str);
+void view_append(View* view, char* str);
 char* view_getstr(View* view, Sel* sel);
 void view_scroll(View* view, int move);
 void view_scrollpage(View* view, int move);
index 422f963461c5c45022f522abc9c6d09f94c24cc1..198d533ab1d47222ab317620c9cf9fab11cc911e 100644 (file)
@@ -425,6 +425,14 @@ void view_putstr(View* view, char* str) {
     buf_loglock(&(view->buffer));
 }
 
+void view_append(View* view, char* str) {
+    size_t end = buf_end(&(view->buffer));
+    if (view->selection.end != end)
+        view->selection = (Sel){ .beg = end, .end = end };
+    view_putstr(view, str);
+    view_selprev(view);
+}
+
 char* view_getstr(View* view, Sel* range) {
     Buf* buf = &(view->buffer);
     Sel sel = (range ? *range : view->selection);
diff --git a/xedit.c b/xedit.c
index ece8de7cbfbd6ac5c911cc2b4fffd50cb334e383..38458a78a0dddccc80738a0ad287c312a9c85dce 100644 (file)
--- a/xedit.c
+++ b/xedit.c
@@ -376,6 +376,9 @@ static void quit(void) {
     prevtime = now;
     if (!getbuf(EDIT)->modified || num_clicks >= 2)
         exit(0);
+    else
+        view_append(getview(TAGS),
+            "File is modified. Double click Quit tag or press Ctrl+Q twice to discard changes.");
 }
 
 static void save(void) {