about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSpiridonov Alexander <spiridoncha@gmail.com>2016-11-07 03:26:15 +0300
committerSpiridonov Alexander <spiridoncha@gmail.com>2016-11-07 03:26:15 +0300
commitfd2346ccb4e4e447109fc49b16025aa87ae69b86 (patch)
tree48c68d1cb4413554f24df608b7133e603f5b4049
parent0d6aef68e7f08db1c3879a9e9a2c25db9838501d (diff)
downloadprofani-tty-fd2346ccb4e4e447109fc49b16025aa87ae69b86.tar.gz
Makes /clear behavior configurable.
-rw-r--r--src/config/preferences.c3
-rw-r--r--src/config/preferences.h1
-rw-r--r--src/ui/window.c5
3 files changed, 9 insertions, 0 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 4eed12ff..16c36c7e 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -1511,6 +1511,7 @@ _get_group(preference_t pref)
 {
     switch (pref)
     {
+        case PREF_CLEAR_PERSIST_HISTORY:
         case PREF_SPLASH:
         case PREF_BEEP:
         case PREF_THEME:
@@ -1626,6 +1627,8 @@ _get_key(preference_t pref)
 {
     switch (pref)
     {
+        case PREF_CLEAR_PERSIST_HISTORY:
+            return "clear.persist_history";
         case PREF_SPLASH:
             return "splash";
         case PREF_BEEP:
diff --git a/src/config/preferences.h b/src/config/preferences.h
index 72385de5..8b62f988 100644
--- a/src/config/preferences.h
+++ b/src/config/preferences.h
@@ -45,6 +45,7 @@
 // represents all settings in .profrc
 // each enum value is mapped to a group and key in .profrc (see preferences.c)
 typedef enum {
+    PREF_CLEAR_PERSIST_HISTORY,
     PREF_SPLASH,
     PREF_BEEP,
     PREF_VERCHECK,
diff --git a/src/ui/window.c b/src/ui/window.c
index bbc9b9d0..53dc9d02 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -562,6 +562,11 @@ win_sub_page_up(ProfWin *window)
 void
 win_clear(ProfWin *window)
 {
+    if (!prefs_get_boolean(PREF_CLEAR_PERSIST_HISTORY)) {
+        werase(window->layout->win);
+        return;
+    }
+
     int y = getcury(window->layout->win);
     int *page_start = &(window->layout->y_pos);
     *page_start = y;