mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Use @tabs_count instead of mixed tabs_count, num_tabs or tabs.
This commit is contained in:
parent
bac6e76c23
commit
3f94687e28
@ -218,7 +218,7 @@ tab_menu(struct session *ses, int x, int y, int place_above_cursor)
|
||||
{
|
||||
/* [gettext_accelerator_context(tab_menu)] */
|
||||
struct menu_item *menu;
|
||||
int tabs;
|
||||
int tabs_count;
|
||||
#ifdef CONFIG_BOOKMARKS
|
||||
int anonymous = get_cmd_opt_bool("anonymous");
|
||||
#endif
|
||||
@ -226,7 +226,7 @@ tab_menu(struct session *ses, int x, int y, int place_above_cursor)
|
||||
assert(ses && ses->tab);
|
||||
if_assert_failed return;
|
||||
|
||||
tabs = number_of_tabs(ses->tab->term);
|
||||
tabs_count = number_of_tabs(ses->tab->term);
|
||||
menu = new_menu(FREE_LIST);
|
||||
if (!menu) return;
|
||||
|
||||
@ -255,14 +255,14 @@ tab_menu(struct session *ses, int x, int y, int place_above_cursor)
|
||||
/* Keep tab related operations below this separator */
|
||||
add_menu_separator(&menu);
|
||||
|
||||
if (tabs > 1) {
|
||||
if (tabs_count > 1) {
|
||||
add_menu_action(&menu, N_("Nex~t tab"), ACT_MAIN_TAB_NEXT);
|
||||
add_menu_action(&menu, N_("Pre~v tab"), ACT_MAIN_TAB_PREV);
|
||||
}
|
||||
|
||||
add_menu_action(&menu, N_("~Close tab"), ACT_MAIN_TAB_CLOSE);
|
||||
|
||||
if (tabs > 1) {
|
||||
if (tabs_count > 1) {
|
||||
add_menu_action(&menu, N_("C~lose all tabs but the current"),
|
||||
ACT_MAIN_TAB_CLOSE_ALL_BUT_CURRENT);
|
||||
#ifdef CONFIG_BOOKMARKS
|
||||
|
@ -74,7 +74,7 @@ update_status(void)
|
||||
int set_window_title = get_opt_bool("ui.window_title");
|
||||
int insert_mode = get_opt_bool("document.browse.forms.insert_mode");
|
||||
struct session *ses;
|
||||
int tabs = 1;
|
||||
int tabs_count = 1;
|
||||
struct terminal *term = NULL;
|
||||
|
||||
foreach (ses, sessions) {
|
||||
@ -85,7 +85,7 @@ update_status(void)
|
||||
* tab sessions share the same term. */
|
||||
if (ses->tab->term != term) {
|
||||
term = ses->tab->term;
|
||||
tabs = number_of_tabs(term);
|
||||
tabs_count = number_of_tabs(term);
|
||||
}
|
||||
|
||||
if (status->force_show_title_bar >= 0)
|
||||
@ -102,8 +102,8 @@ update_status(void)
|
||||
dirty = 1;
|
||||
}
|
||||
|
||||
if (show_tabs(show_tabs_bar, tabs) != status->show_tabs_bar) {
|
||||
status->show_tabs_bar = show_tabs(show_tabs_bar, tabs);
|
||||
if (show_tabs(show_tabs_bar, tabs_count) != status->show_tabs_bar) {
|
||||
status->show_tabs_bar = show_tabs(show_tabs_bar, tabs_count);
|
||||
dirty = 1;
|
||||
}
|
||||
|
||||
|
@ -130,19 +130,19 @@ get_tab_number_by_xpos(struct terminal *term, int xpos)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* if @tabs > 0, then it is taken as the result of a recent
|
||||
/* if @tabs_count > 0, then it is taken as the result of a recent
|
||||
* call to number_of_tabs() so it just uses this value. */
|
||||
void
|
||||
switch_to_tab(struct terminal *term, int tab, int tabs)
|
||||
switch_to_tab(struct terminal *term, int tab, int tabs_count)
|
||||
{
|
||||
if (tabs < 0) tabs = number_of_tabs(term);
|
||||
if (tabs_count < 0) tabs_count = number_of_tabs(term);
|
||||
|
||||
if (tabs > 1) {
|
||||
if (tabs_count > 1) {
|
||||
if (get_opt_bool("ui.tabs.wraparound")) {
|
||||
tab %= tabs;
|
||||
if (tab < 0) tab += tabs;
|
||||
tab %= tabs_count;
|
||||
if (tab < 0) tab += tabs_count;
|
||||
} else
|
||||
int_bounds(&tab, 0, tabs - 1);
|
||||
int_bounds(&tab, 0, tabs_count - 1);
|
||||
} else tab = 0;
|
||||
|
||||
if (tab != term->current_tab) {
|
||||
@ -156,16 +156,16 @@ void
|
||||
switch_current_tab(struct session *ses, int direction)
|
||||
{
|
||||
struct terminal *term = ses->tab->term;
|
||||
int num_tabs = number_of_tabs(term);
|
||||
int tabs_count = number_of_tabs(term);
|
||||
int count;
|
||||
|
||||
if (num_tabs < 2)
|
||||
if (tabs_count < 2)
|
||||
return;
|
||||
|
||||
count = eat_kbd_repeat_count(ses);
|
||||
if (count) direction *= count;
|
||||
|
||||
switch_to_tab(term, term->current_tab + direction, num_tabs);
|
||||
switch_to_tab(term, term->current_tab + direction, tabs_count);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -175,9 +175,9 @@ really_close_tab(struct session *ses)
|
||||
struct window *current_tab = get_current_tab(term);
|
||||
|
||||
if (ses->tab == current_tab) {
|
||||
int num_tabs = number_of_tabs(term);
|
||||
int tabs_count = number_of_tabs(term);
|
||||
|
||||
switch_to_tab(term, term->current_tab - 1, num_tabs - 1);
|
||||
switch_to_tab(term, term->current_tab - 1, tabs_count - 1);
|
||||
}
|
||||
|
||||
delete_window(ses->tab);
|
||||
@ -187,9 +187,9 @@ void
|
||||
close_tab(struct terminal *term, struct session *ses)
|
||||
{
|
||||
/* [gettext_accelerator_context(close_tab)] */
|
||||
int num_tabs = number_of_tabs(term);
|
||||
int tabs_count = number_of_tabs(term);
|
||||
|
||||
if (num_tabs < 2) {
|
||||
if (tabs_count < 2) {
|
||||
query_exit(ses);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user