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)] */
|
/* [gettext_accelerator_context(tab_menu)] */
|
||||||
struct menu_item *menu;
|
struct menu_item *menu;
|
||||||
int tabs;
|
int tabs_count;
|
||||||
#ifdef CONFIG_BOOKMARKS
|
#ifdef CONFIG_BOOKMARKS
|
||||||
int anonymous = get_cmd_opt_bool("anonymous");
|
int anonymous = get_cmd_opt_bool("anonymous");
|
||||||
#endif
|
#endif
|
||||||
@ -226,7 +226,7 @@ tab_menu(struct session *ses, int x, int y, int place_above_cursor)
|
|||||||
assert(ses && ses->tab);
|
assert(ses && ses->tab);
|
||||||
if_assert_failed return;
|
if_assert_failed return;
|
||||||
|
|
||||||
tabs = number_of_tabs(ses->tab->term);
|
tabs_count = number_of_tabs(ses->tab->term);
|
||||||
menu = new_menu(FREE_LIST);
|
menu = new_menu(FREE_LIST);
|
||||||
if (!menu) return;
|
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 */
|
/* Keep tab related operations below this separator */
|
||||||
add_menu_separator(&menu);
|
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_("Nex~t tab"), ACT_MAIN_TAB_NEXT);
|
||||||
add_menu_action(&menu, N_("Pre~v tab"), ACT_MAIN_TAB_PREV);
|
add_menu_action(&menu, N_("Pre~v tab"), ACT_MAIN_TAB_PREV);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_menu_action(&menu, N_("~Close tab"), ACT_MAIN_TAB_CLOSE);
|
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"),
|
add_menu_action(&menu, N_("C~lose all tabs but the current"),
|
||||||
ACT_MAIN_TAB_CLOSE_ALL_BUT_CURRENT);
|
ACT_MAIN_TAB_CLOSE_ALL_BUT_CURRENT);
|
||||||
#ifdef CONFIG_BOOKMARKS
|
#ifdef CONFIG_BOOKMARKS
|
||||||
|
@ -74,7 +74,7 @@ update_status(void)
|
|||||||
int set_window_title = get_opt_bool("ui.window_title");
|
int set_window_title = get_opt_bool("ui.window_title");
|
||||||
int insert_mode = get_opt_bool("document.browse.forms.insert_mode");
|
int insert_mode = get_opt_bool("document.browse.forms.insert_mode");
|
||||||
struct session *ses;
|
struct session *ses;
|
||||||
int tabs = 1;
|
int tabs_count = 1;
|
||||||
struct terminal *term = NULL;
|
struct terminal *term = NULL;
|
||||||
|
|
||||||
foreach (ses, sessions) {
|
foreach (ses, sessions) {
|
||||||
@ -85,7 +85,7 @@ update_status(void)
|
|||||||
* tab sessions share the same term. */
|
* tab sessions share the same term. */
|
||||||
if (ses->tab->term != term) {
|
if (ses->tab->term != term) {
|
||||||
term = ses->tab->term;
|
term = ses->tab->term;
|
||||||
tabs = number_of_tabs(term);
|
tabs_count = number_of_tabs(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status->force_show_title_bar >= 0)
|
if (status->force_show_title_bar >= 0)
|
||||||
@ -102,8 +102,8 @@ update_status(void)
|
|||||||
dirty = 1;
|
dirty = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show_tabs(show_tabs_bar, tabs) != status->show_tabs_bar) {
|
if (show_tabs(show_tabs_bar, tabs_count) != status->show_tabs_bar) {
|
||||||
status->show_tabs_bar = show_tabs(show_tabs_bar, tabs);
|
status->show_tabs_bar = show_tabs(show_tabs_bar, tabs_count);
|
||||||
dirty = 1;
|
dirty = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,19 +130,19 @@ get_tab_number_by_xpos(struct terminal *term, int xpos)
|
|||||||
return -1;
|
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. */
|
* call to number_of_tabs() so it just uses this value. */
|
||||||
void
|
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")) {
|
if (get_opt_bool("ui.tabs.wraparound")) {
|
||||||
tab %= tabs;
|
tab %= tabs_count;
|
||||||
if (tab < 0) tab += tabs;
|
if (tab < 0) tab += tabs_count;
|
||||||
} else
|
} else
|
||||||
int_bounds(&tab, 0, tabs - 1);
|
int_bounds(&tab, 0, tabs_count - 1);
|
||||||
} else tab = 0;
|
} else tab = 0;
|
||||||
|
|
||||||
if (tab != term->current_tab) {
|
if (tab != term->current_tab) {
|
||||||
@ -156,16 +156,16 @@ void
|
|||||||
switch_current_tab(struct session *ses, int direction)
|
switch_current_tab(struct session *ses, int direction)
|
||||||
{
|
{
|
||||||
struct terminal *term = ses->tab->term;
|
struct terminal *term = ses->tab->term;
|
||||||
int num_tabs = number_of_tabs(term);
|
int tabs_count = number_of_tabs(term);
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
if (num_tabs < 2)
|
if (tabs_count < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
count = eat_kbd_repeat_count(ses);
|
count = eat_kbd_repeat_count(ses);
|
||||||
if (count) direction *= count;
|
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
|
static void
|
||||||
@ -175,9 +175,9 @@ really_close_tab(struct session *ses)
|
|||||||
struct window *current_tab = get_current_tab(term);
|
struct window *current_tab = get_current_tab(term);
|
||||||
|
|
||||||
if (ses->tab == current_tab) {
|
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);
|
delete_window(ses->tab);
|
||||||
@ -187,9 +187,9 @@ void
|
|||||||
close_tab(struct terminal *term, struct session *ses)
|
close_tab(struct terminal *term, struct session *ses)
|
||||||
{
|
{
|
||||||
/* [gettext_accelerator_context(close_tab)] */
|
/* [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);
|
query_exit(ses);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user