1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

core: move /input hotlist actions to new command /hotlist

Actions moved to command `/hotlist`:

* `/input hotlist_clear` -> `/hotlist clear`
* `/input hotlist_remove_buffer` -> `/hotlist remove`
* `/input hotlist_restore_buffer` -> `/hotlist restore`
* `/input hotlist_restore_all` -> `/hotlist restore -all`
This commit is contained in:
Sébastien Helleu
2022-12-25 18:50:57 +01:00
parent 574a4c8834
commit babe1e7a42
37 changed files with 566 additions and 372 deletions
-102
View File
@@ -1460,108 +1460,6 @@ gui_input_history_global_next (struct t_gui_buffer *buffer)
}
}
/*
* Clears hotlist (default key: alt-h, alt-c).
*/
void
gui_input_hotlist_clear (struct t_gui_buffer *buffer,
const char *str_level_mask)
{
long level_mask;
char *error;
struct t_gui_hotlist *ptr_hotlist;
int priority;
if (str_level_mask)
{
if (strcmp (str_level_mask, "lowest") == 0)
{
/* clear only lowest priority currently in hotlist */
priority = GUI_HOTLIST_MAX + 1;
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
if ((int)ptr_hotlist->priority < priority)
priority = ptr_hotlist->priority;
}
if (priority <= GUI_HOTLIST_MAX)
{
gui_hotlist_clear (1 << priority);
gui_hotlist_initial_buffer = buffer;
}
}
else if (strcmp (str_level_mask, "highest") == 0)
{
/* clear only highest priority currently in hotlist */
priority = GUI_HOTLIST_MIN - 1;
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
if ((int)ptr_hotlist->priority > priority)
priority = ptr_hotlist->priority;
}
if (priority >= GUI_HOTLIST_MIN)
{
gui_hotlist_clear (1 << priority);
gui_hotlist_initial_buffer = buffer;
}
}
else
{
/* clear hotlist using a mask of levels */
error = NULL;
level_mask = strtol (str_level_mask, &error, 10);
if (error && !error[0] && (level_mask > 0))
{
gui_hotlist_clear ((int)level_mask);
gui_hotlist_initial_buffer = buffer;
}
}
}
else
{
gui_hotlist_clear (GUI_HOTLIST_MASK_MAX);
gui_hotlist_initial_buffer = buffer;
}
}
/*
* Removes buffer from hotlist (default key: alt-h, alt-m).
*/
void
gui_input_hotlist_remove_buffer (struct t_gui_buffer *buffer)
{
gui_hotlist_remove_buffer (buffer, 1);
}
/*
* Restores latest hotlist removed in a buffer (default key: alt-h, alt-r).
*/
void
gui_input_hotlist_restore_buffer (struct t_gui_buffer *buffer)
{
gui_hotlist_restore_buffer (buffer);
}
/*
* Restores latest hotlist removed in all buffers (default key: alt-h, alt-R).
*/
void
gui_input_hotlist_restore_all ()
{
struct t_gui_buffer *ptr_buffer;
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
gui_hotlist_restore_buffer (ptr_buffer);
}
}
/*
* Initializes "grab key mode" (next key will be inserted into input buffer)
* (default key: alt-k).