Remove empty tabs

This commit is contained in:
James Booth
2018-03-09 22:42:20 +00:00
parent 59382984c0
commit 136b975b6c
11 changed files with 21 additions and 137 deletions

View File

@@ -1123,15 +1123,6 @@ cons_wrap_setting(void)
cons_show("Word wrap (/wrap) : OFF");
}
void
cons_winstidy_setting(void)
{
if (prefs_get_boolean(PREF_WINS_AUTO_TIDY))
cons_show("Window Auto Tidy (/wins) : ON");
else
cons_show("Window Auto Tidy (/wins) : OFF");
}
void
cons_encwarn_setting(void)
{
@@ -1531,7 +1522,6 @@ cons_show_ui_prefs(void)
cons_splash_setting();
cons_winpos_setting();
cons_wrap_setting();
cons_winstidy_setting();
cons_time_setting();
cons_resource_setting();
cons_vercheck_setting();
@@ -1751,11 +1741,6 @@ cons_inpblock_setting(void)
void
cons_statusbar_setting(void)
{
if (prefs_get_boolean(PREF_STATUSBAR_SHOW_EMPTY)) {
cons_show("Show empty tabs (/statusbar) : ON");
} else {
cons_show("Show empty tabs (/statusbar) : OFF");
}
if (prefs_get_boolean(PREF_STATUSBAR_SHOW_NAME)) {
cons_show("Show tab names (/statusbar) : ON");
} else {

View File

@@ -292,7 +292,6 @@ _status_bar_draw(void)
pos = cols - _tabs_width();
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
gboolean show_empty = prefs_get_boolean(PREF_STATUSBAR_SHOW_EMPTY);
gboolean show_name = prefs_get_boolean(PREF_STATUSBAR_SHOW_NAME);
gint max_tabs = prefs_get_statusbartabs();
@@ -301,7 +300,7 @@ _status_bar_draw(void)
int display_num = i == 10 ? 0 : i;
StatusBarTab *tab = g_hash_table_lookup(statusbar->tabs, GINT_TO_POINTER(i));
if (tab || (tab == NULL && show_empty)) {
if (tab) {
wattron(statusbar_win, bracket_attrs);
if (i == statusbar->current_tab) {
mvwprintw(statusbar_win, 0, pos, "-");
@@ -382,46 +381,24 @@ _destroy_tab(StatusBarTab *tab)
static int
_tabs_width(void)
{
gboolean show_empty = prefs_get_boolean(PREF_STATUSBAR_SHOW_EMPTY);
gboolean show_name = prefs_get_boolean(PREF_STATUSBAR_SHOW_NAME);
gint max_tabs = prefs_get_statusbartabs();
if (show_name) {
if (show_empty) {
int width = 4;
int i = 0;
for (i = 1; i <= max_tabs; i++) {
StatusBarTab *tab = g_hash_table_lookup(statusbar->tabs, GINT_TO_POINTER(i));
if (tab) {
char *display_name = _display_name(tab);
width += strlen(display_name);
width += 4;
free(display_name);
} else {
width += 3;
}
int width = 4;
int i = 0;
for (i = 1; i <= max_tabs; i++) {
StatusBarTab *tab = g_hash_table_lookup(statusbar->tabs, GINT_TO_POINTER(i));
if (tab) {
char *display_name = _display_name(tab);
width += strlen(display_name);
width += 4;
free(display_name);
}
return width;
} else {
int width = 4;
int i = 0;
for (i = 1; i <= max_tabs; i++) {
StatusBarTab *tab = g_hash_table_lookup(statusbar->tabs, GINT_TO_POINTER(i));
if (tab) {
char *display_name = _display_name(tab);
width += strlen(display_name);
width += 4;
free(display_name);
}
}
return width;
}
return width;
} else {
if (show_empty) {
return max_tabs * 3 + 4;
} else {
return g_hash_table_size(statusbar->tabs) * 3 + 4;
}
return g_hash_table_size(statusbar->tabs) * 3 + 4;
}
}

View File

@@ -297,7 +297,6 @@ void cons_occupants_setting(void);
void cons_roster_setting(void);
void cons_presence_setting(void);
void cons_wrap_setting(void);
void cons_winstidy_setting(void);
void cons_time_setting(void);
void cons_wintitle_setting(void);
void cons_notify_setting(void);

View File

@@ -238,9 +238,7 @@ wins_close_plugin(char *tag)
int index = wins_get_num(toclose);
ui_close_win(index);
if (prefs_get_boolean(PREF_WINS_AUTO_TIDY)) {
wins_tidy();
}
wins_tidy();
}
GList*