core: add options in command /input and new keys to remove/restore buffers in hotlist

New options in command /input:

- hotlist_remove_buffer
- hotlist_restore_buffer
- hotlist_restore_all

New keys:

- alt+h, alt+c: clear the whole hotlist (former key: alt+h)
- alt+h, alt+m: mark the current buffer as read by removing it from the hotlist
- alt+h, alt+r: restore latest hotlist removed in the current buffer
- alt+h, alt+shift+R: restore latest hotlist removed in all buffers
This commit is contained in:
Sébastien Helleu 2021-08-31 22:32:38 +02:00
parent 5b5626a82b
commit 12be3b8c33
17 changed files with 240 additions and 48 deletions

View File

@ -20,6 +20,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features:: New features::
* core: change key kbd:[Alt+h] to kbd:[Alt+h], kbd:[Alt+c] (clear hotlist)
* core: add options "hotlist_remove_buffer", "hotlist_restore_buffer" and "hotlist_restore_all" in command /input, add default keys kbd:[Alt+h], kbd:[Alt+m] (remove buffer), kbd:[Alt+h], kbd:[Alt+r] (restore hotlist in current buffer) and kbd:[Alt+h], kbd:[Alt+Shift+R] (restore hotlist in all buffers)
* core: add option "certs" in command /debug * core: add option "certs" in command /debug
* api: add `${re:repl_index}` to get the index of replacement in function string_eval_expression (issue #1689) * api: add `${re:repl_index}` to get the index of replacement in function string_eval_expression (issue #1689)
* api: add random integer number in evaluation of expressions with "random:min,max" * api: add random integer number in evaluation of expressions with "random:min,max"

View File

@ -20,6 +20,29 @@ https://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog]
[[v3.3]] [[v3.3]]
== Version 3.3 (under dev) == Version 3.3 (under dev)
[[v3.3_hotlist_keys_clear_restore]]
=== New keys for hotlist
New keys have been added to manipulate the hotlist:
* kbd:[Alt+h], kbd:[Alt+c]: clear the whole hotlist (former key: kbd:[Alt+h])
* kbd:[Alt+h], kbd:[Alt+m]: mark the current buffer as read by removing it from the hotlist
* kbd:[Alt+h], kbd:[Alt+r]: restore latest hotlist removed in the current buffer
* kbd:[Alt+h], kbd:[Alt+Shift+R]: restore latest hotlist removed in all buffers
You can add them with the following command:
----
/key missing
----
Since the key kbd:[Alt+h] has been moved to kbd:[Alt+h], kbd:[Alt+c], you must
manually remove the old key:
----
/key unbind meta-h
----
[[v3.3_typing_bar_item]] [[v3.3_typing_bar_item]]
=== Bar item "typing" === Bar item "typing"
@ -1581,7 +1604,7 @@ The command `/input jump_last_buffer` still works for compatibility reasons,
but it should not be used any more. but it should not be used any more.
Similarly, a new key has been added to jump to first buffer: kbd:[Alt+j], kbd:[Alt+f]. Similarly, a new key has been added to jump to first buffer: kbd:[Alt+j], kbd:[Alt+f].
You can add it with following command: You can add it with the following command:
---- ----
/key missing /key missing
@ -2321,7 +2344,7 @@ All users of version 0.3.1 should upgrade to this version.
=== Aliases === Aliases
IRC commands /ame and /amsg are now aliases, if you are upgrading from version IRC commands /ame and /amsg are now aliases, if you are upgrading from version
0.3.0, you must create aliases with following commands: 0.3.0, you must create aliases with the following commands:
---- ----
/alias aaway allserv /away /alias aaway allserv /away

View File

@ -2022,7 +2022,18 @@ und um eine Hilfe zu erhalten wie man es nutzt: `+/help buffer_autoset+`.
| kbd:[Alt+F12] | springt zum Ende der Benutzerliste. | `+/bar scroll nicklist * e+` | kbd:[Alt+F12] | springt zum Ende der Benutzerliste. | `+/bar scroll nicklist * e+`
| kbd:[Alt+a] | wechselt zum nächsten Buffer mit Aktivität (nach Priorität: highlight, Nachricht, ...). | `+/input jump_smart+` | kbd:[Alt+a] | wechselt zum nächsten Buffer mit Aktivität (nach Priorität: highlight, Nachricht, ...). | `+/input jump_smart+`
| kbd:[Alt+Shift+B] | buflist-Bar umschalten. | `+/buflist toggle+` | kbd:[Alt+Shift+B] | buflist-Bar umschalten. | `+/buflist toggle+`
| kbd:[Alt+h] | löscht Hotliste (Aktivitätsanzeige für die Buffer). | `+/input hotlist_clear+` // TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+c] | Clear hotlist (activity notification on buffers). | `+/input hotlist_clear+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+m] | Remove current buffer from hotlist. | `+/input hotlist_remove_buffer+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+r] | Restore latest hotlist removed in the current buffer. | `+/input hotlist_restore_buffer+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+Shift+R] | Restore latest hotlist removed in all buffers. | `+/input hotlist_restore_all+`
| kbd:[Alt+j], | kbd:[Alt+j],
kbd:[Alt+f] | wechselt zum ersten Buffer. | `+/buffer -+` kbd:[Alt+f] | wechselt zum ersten Buffer. | `+/buffer -+`
| kbd:[Alt+j], | kbd:[Alt+j],

View File

@ -1986,7 +1986,14 @@ with `+/script install buffer_autoset.py+` and get help with
| kbd:[Alt+F12] | Go to the end of nicklist. | `+/bar scroll nicklist * e+` | kbd:[Alt+F12] | Go to the end of nicklist. | `+/bar scroll nicklist * e+`
| kbd:[Alt+a] | Switch to next buffer with activity (with priority: highlight, message, other). | `+/input jump_smart+` | kbd:[Alt+a] | Switch to next buffer with activity (with priority: highlight, message, other). | `+/input jump_smart+`
| kbd:[Alt+Shift+B] | Toggle buflist. | `+/buflist toggle+` | kbd:[Alt+Shift+B] | Toggle buflist. | `+/buflist toggle+`
| kbd:[Alt+h] | Clear hotlist (activity notification on other buffers). | `+/input hotlist_clear+` | kbd:[Alt+h],
kbd:[Alt+c] | Clear hotlist (activity notification on buffers). | `+/input hotlist_clear+`
| kbd:[Alt+h],
kbd:[Alt+m] | Remove current buffer from hotlist. | `+/input hotlist_remove_buffer+`
| kbd:[Alt+h],
kbd:[Alt+r] | Restore latest hotlist removed in the current buffer. | `+/input hotlist_restore_buffer+`
| kbd:[Alt+h],
kbd:[Alt+Shift+R] | Restore latest hotlist removed in all buffers. | `+/input hotlist_restore_all+`
| kbd:[Alt+j], | kbd:[Alt+j],
kbd:[Alt+f] | Switch to first buffer. | `+/buffer -+` kbd:[Alt+f] | Switch to first buffer. | `+/buffer -+`
| kbd:[Alt+j], | kbd:[Alt+j],

View File

@ -2052,7 +2052,14 @@ avec `+/help buffer_autoset+`.
| kbd:[Alt+F12] | Aller à la fin de la liste des pseudos. | `+/bar scroll nicklist * e+` | kbd:[Alt+F12] | Aller à la fin de la liste des pseudos. | `+/bar scroll nicklist * e+`
| kbd:[Alt+a] | Sauter au prochain tampon avec activité (avec priorité : highlight, message, autre). | `+/input jump_smart+` | kbd:[Alt+a] | Sauter au prochain tampon avec activité (avec priorité : highlight, message, autre). | `+/input jump_smart+`
| kbd:[Alt+Shift+B] | Activer/désactiver buflist. | `+/buflist toggle+` | kbd:[Alt+Shift+B] | Activer/désactiver buflist. | `+/buflist toggle+`
| kbd:[Alt+h] | Vider la hotlist (notification d'activité sur les autres tampons). | `+/input hotlist_clear+` | kbd:[Alt+h],
kbd:[Alt+c] | Vider la hotlist (notification d'activité sur les tampons). | `+/input hotlist_clear+`
| kbd:[Alt+h],
kbd:[Alt+m] | Supprimer le tampon courant de la hotlist. | `+/input hotlist_remove_buffer+`
| kbd:[Alt+h],
kbd:[Alt+r] | Restaurer la dernière hotlist supprimée dans le tampon courant. | `+/input hotlist_restore_buffer+`
| kbd:[Alt+h],
kbd:[Alt+Shift+R] | Restaurer la dernière hotlist supprimée dans tous les tampons. | `+/input hotlist_restore_all+`
| kbd:[Alt+j], | kbd:[Alt+j],
kbd:[Alt+f] | Sauter au premier tampon. | `+/buffer -+` kbd:[Alt+f] | Sauter au premier tampon. | `+/buffer -+`
| kbd:[Alt+j], | kbd:[Alt+j],

View File

@ -2118,7 +2118,18 @@ with `+/script install buffer_autoset.py+` and get help with `+/help buffer_auto
| kbd:[Alt+a] | Passa al buffer successivo con attività (con priorità: highligh, messagge, altro). | `+/input jump_smart+` | kbd:[Alt+a] | Passa al buffer successivo con attività (con priorità: highligh, messagge, altro). | `+/input jump_smart+`
// TRANSLATION MISSING // TRANSLATION MISSING
| kbd:[Alt+Shift+B] | Toggle buflist. | `+/buflist toggle+` | kbd:[Alt+Shift+B] | Toggle buflist. | `+/buflist toggle+`
| kbd:[Alt+h] | Pulisce hotlist (notifica di attività su altri buffer). | `+/input hotlist_clear+` // TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+c] | Clear hotlist (activity notification on buffers). | `+/input hotlist_clear+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+m] | Remove current buffer from hotlist. | `+/input hotlist_remove_buffer+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+r] | Restore latest hotlist removed in the current buffer. | `+/input hotlist_restore_buffer+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+Shift+R] | Restore latest hotlist removed in all buffers. | `+/input hotlist_restore_all+`
// TRANSLATION MISSING // TRANSLATION MISSING
| kbd:[Alt+j], | kbd:[Alt+j],
kbd:[Alt+f] | Switch to first buffer. | `+/buffer -+` kbd:[Alt+f] | Switch to first buffer. | `+/buffer -+`

View File

@ -2048,7 +2048,18 @@ irc サーバ "libera" に含まれる全てのバッファに対して設定す
| kbd:[Alt+a] | 変更のあった次のバッファに移動 (優先順位: ハイライト、新規メッセージ、その他) | `+/input jump_smart+` | kbd:[Alt+a] | 変更のあった次のバッファに移動 (優先順位: ハイライト、新規メッセージ、その他) | `+/input jump_smart+`
// TRANSLATION MISSING // TRANSLATION MISSING
| kbd:[Alt+Shift+B] | Toggle buflist. | `+/buflist toggle+` | kbd:[Alt+Shift+B] | Toggle buflist. | `+/buflist toggle+`
| kbd:[Alt+h] | ホットリスト (他のバッファにあった変更通知リスト) を消去 | `+/input hotlist_clear+` // TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+c] | Clear hotlist (activity notification on buffers). | `+/input hotlist_clear+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+m] | Remove current buffer from hotlist. | `+/input hotlist_remove_buffer+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+r] | Restore latest hotlist removed in the current buffer. | `+/input hotlist_restore_buffer+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+Shift+R] | Restore latest hotlist removed in all buffers. | `+/input hotlist_restore_all+`
| kbd:[Alt+j], | kbd:[Alt+j],
kbd:[Alt+f] | 最初のバッファに移動 | `+/buffer -+` kbd:[Alt+f] | 最初のバッファに移動 | `+/buffer -+`
| kbd:[Alt+j], | kbd:[Alt+j],

View File

@ -1999,7 +1999,18 @@ Można ją zapisać za pomocą skryptu _buffer_autoset.py_: można go zaintalowa
| kbd:[Alt+F12] | Idź na koniec listy nicków. | `+/bar scroll nicklist * e+` | kbd:[Alt+F12] | Idź na koniec listy nicków. | `+/bar scroll nicklist * e+`
| kbd:[Alt+a] | Przełącz na następny bufor z aktywnością (z priorytetem: powiadomienie, wiadomość, inne). | `+/input jump_smart+` | kbd:[Alt+a] | Przełącz na następny bufor z aktywnością (z priorytetem: powiadomienie, wiadomość, inne). | `+/input jump_smart+`
| kbd:[Alt+Shift+B] | Przełącza widoczność listy buforów. | `+/buflist toggle+` | kbd:[Alt+Shift+B] | Przełącza widoczność listy buforów. | `+/buflist toggle+`
| kbd:[Alt+h] | Wyczyść hotlistę (powiadomienia o aktywności w innych buforach). | `+/input hotlist_clear+` // TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+c] | Clear hotlist (activity notification on buffers). | `+/input hotlist_clear+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+m] | Remove current buffer from hotlist. | `+/input hotlist_remove_buffer+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+r] | Restore latest hotlist removed in the current buffer. | `+/input hotlist_restore_buffer+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+Shift+R] | Restore latest hotlist removed in all buffers. | `+/input hotlist_restore_all+`
| kbd:[Alt+j], | kbd:[Alt+j],
kbd:[Alt+f] | Przełącz na pierwszy bufor. | `+/buffer -+` kbd:[Alt+f] | Przełącz na pierwszy bufor. | `+/buffer -+`
| kbd:[Alt+j], | kbd:[Alt+j],

View File

@ -1840,7 +1840,18 @@ _трака_ је површина уз разговор која може да
| kbd:[Alt+F12] | Скок на крај листе надимака. | `+/bar scroll nicklist * e+` | kbd:[Alt+F12] | Скок на крај листе надимака. | `+/bar scroll nicklist * e+`
| kbd:[Alt+a] | Пребацивање на следећи бафер у коме има активности (са приоритетом: истицање, порука, остало). | `+/input jump_smart+` | kbd:[Alt+a] | Пребацивање на следећи бафер у коме има активности (са приоритетом: истицање, порука, остало). | `+/input jump_smart+`
| kbd:[Alt+Shift+B] | Пребацивање активности листе бафера. | `+/buflist toggle+` | kbd:[Alt+Shift+B] | Пребацивање активности листе бафера. | `+/buflist toggle+`
| kbd:[Alt+h] | Чишћење вруће листе (обавештавање о активности у осталим баферима). | `+/input hotlist_clear+` // TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+c] | Clear hotlist (activity notification on buffers). | `+/input hotlist_clear+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+m] | Remove current buffer from hotlist. | `+/input hotlist_remove_buffer+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+r] | Restore latest hotlist removed in the current buffer. | `+/input hotlist_restore_buffer+`
// TRANSLATION MISSING
| kbd:[Alt+h],
kbd:[Alt+Shift+R] | Restore latest hotlist removed in all buffers. | `+/input hotlist_restore_all+`
| kbd:[Alt+j], | kbd:[Alt+j],
kbd:[Alt+f] | Пребацивање на први бафер. | `+/buffer -+` kbd:[Alt+f] | Пребацивање на први бафер. | `+/buffer -+`
| kbd:[Alt+j], | kbd:[Alt+j],

View File

@ -3329,6 +3329,12 @@ COMMAND_CALLBACK(input)
gui_input_jump_next_visited_buffer (buffer); gui_input_jump_next_visited_buffer (buffer);
else if (string_strcasecmp (argv[1], "hotlist_clear") == 0) else if (string_strcasecmp (argv[1], "hotlist_clear") == 0)
gui_input_hotlist_clear (buffer, (argc > 2) ? argv[2] : NULL); gui_input_hotlist_clear (buffer, (argc > 2) ? argv[2] : NULL);
else if (string_strcasecmp (argv[1], "hotlist_remove_buffer") == 0)
gui_input_hotlist_remove_buffer (buffer);
else if (string_strcasecmp (argv[1], "hotlist_restore_buffer") == 0)
gui_input_hotlist_restore_buffer (buffer);
else if (string_strcasecmp (argv[1], "hotlist_restore_all") == 0)
gui_input_hotlist_restore_all ();
else if (string_strcasecmp (argv[1], "grab_key") == 0) else if (string_strcasecmp (argv[1], "grab_key") == 0)
gui_input_grab_key (buffer, 0, (argc > 2) ? argv[2] : NULL); gui_input_grab_key (buffer, 0, (argc > 2) ? argv[2] : NULL);
else if (string_strcasecmp (argv[1], "grab_key_command") == 0) else if (string_strcasecmp (argv[1], "grab_key_command") == 0)
@ -7815,6 +7821,11 @@ command_init ()
"clear only lowest level in hotlist, \"highest\" to clear only " "clear only lowest level in hotlist, \"highest\" to clear only "
"highest level in hotlist, or level mask: integer which is a " "highest level in hotlist, or level mask: integer which is a "
"combination of 1=join/part, 2=message, 4=private, 8=highlight)\n" "combination of 1=join/part, 2=message, 4=private, 8=highlight)\n"
" hotlist_remove_buffer: remove current buffer from hotlist\n"
" hotlist_restore_buffer: restore latest hotlist removed in the "
"current buffer\n"
" hotlist_restore_all: restore latest hotlist removed in all "
"buffers\n"
" grab_key: grab a key (optional argument: delay for end of grab, " " grab_key: grab a key (optional argument: delay for end of grab, "
"default is 500 milliseconds)\n" "default is 500 milliseconds)\n"
" grab_key_command: grab a key with its associated command (optional " " grab_key_command: grab a key with its associated command (optional "
@ -7846,10 +7857,11 @@ command_init ()
"history_global_next || jump_smart || jump_last_buffer_displayed || " "history_global_next || jump_smart || jump_last_buffer_displayed || "
"jump_previously_visited_buffer || jump_next_visited_buffer || " "jump_previously_visited_buffer || jump_next_visited_buffer || "
"hotlist_clear 1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|lowest|highest || " "hotlist_clear 1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|lowest|highest || "
"grab_key || grab_key_command || grab_mouse || grab_mouse_area || " "hotlist_remove_buffer || hotlist_restore_buffer || "
"set_unread || set_unread_current_buffer || switch_active_buffer || " "hotlist_restore_all || grab_key || grab_key_command || grab_mouse || "
"switch_active_buffer_previous || zoom_merged_buffer || insert || " "grab_mouse_area || set_unread || set_unread_current_buffer || "
"send || paste_start || paste_stop", "switch_active_buffer || switch_active_buffer_previous || "
"zoom_merged_buffer || insert || send || paste_start || paste_stop",
&command_input, NULL, NULL); &command_input, NULL, NULL);
hook_command ( hook_command (
NULL, "key", NULL, "key",

View File

@ -137,7 +137,10 @@ gui_key_default_bindings (int context)
BIND(/* m-j,m-l */ "meta-jmeta-l", "/buffer +"); BIND(/* m-j,m-l */ "meta-jmeta-l", "/buffer +");
BIND(/* m-j,m-r */ "meta-jmeta-r", "/server raw"); BIND(/* m-j,m-r */ "meta-jmeta-r", "/server raw");
BIND(/* m-j,m-s */ "meta-jmeta-s", "/server jump"); BIND(/* m-j,m-s */ "meta-jmeta-s", "/server jump");
BIND(/* m-h */ "meta-h", "/input hotlist_clear"); BIND(/* m-h,m-c */ "meta-hmeta-c", "/input hotlist_clear");
BIND(/* m-h,m-m */ "meta-hmeta-m", "/input hotlist_remove_buffer");
BIND(/* m-h,m-r */ "meta-hmeta-r", "/input hotlist_restore_buffer");
BIND(/* m-h,m-R */ "meta-hmeta-R", "/input hotlist_restore_all");
BIND(/* m-k */ "meta-k", "/input grab_key_command"); BIND(/* m-k */ "meta-k", "/input grab_key_command");
BIND(/* m-s */ "meta-s", "/mute spell toggle"); BIND(/* m-s */ "meta-s", "/mute spell toggle");
BIND(/* m-u */ "meta-u", "/window scroll_unread"); BIND(/* m-u */ "meta-u", "/window scroll_unread");

View File

@ -790,6 +790,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
/* hotlist */ /* hotlist */
new_buffer->hotlist = NULL; new_buffer->hotlist = NULL;
new_buffer->hotlist_removed = NULL;
new_buffer->hotlist_max_level_nicks = hashtable_new ( new_buffer->hotlist_max_level_nicks = hashtable_new (
32, 32,
WEECHAT_HASHTABLE_STRING, WEECHAT_HASHTABLE_STRING,
@ -2900,6 +2901,8 @@ gui_buffer_close (struct t_gui_buffer *buffer)
} }
gui_hotlist_remove_buffer (buffer, 1); gui_hotlist_remove_buffer (buffer, 1);
if (buffer->hotlist_removed)
free (buffer->hotlist_removed);
if (gui_hotlist_initial_buffer == buffer) if (gui_hotlist_initial_buffer == buffer)
gui_hotlist_initial_buffer = NULL; gui_hotlist_initial_buffer = NULL;
@ -4798,6 +4801,7 @@ gui_buffer_print_log ()
log_printf (" highlight_tags_count. . : %d", ptr_buffer->highlight_tags_count); log_printf (" highlight_tags_count. . : %d", ptr_buffer->highlight_tags_count);
log_printf (" highlight_tags_array. . : 0x%lx", ptr_buffer->highlight_tags_array); log_printf (" highlight_tags_array. . : 0x%lx", ptr_buffer->highlight_tags_array);
log_printf (" hotlist . . . . . . . . : 0x%lx", ptr_buffer->hotlist); log_printf (" hotlist . . . . . . . . : 0x%lx", ptr_buffer->hotlist);
log_printf (" hotlist_removed . . . . : 0x%lx", ptr_buffer->hotlist_removed);
log_printf (" keys. . . . . . . . . . : 0x%lx", ptr_buffer->keys); log_printf (" keys. . . . . . . . . . : 0x%lx", ptr_buffer->keys);
log_printf (" last_key. . . . . . . . : 0x%lx", ptr_buffer->last_key); log_printf (" last_key. . . . . . . . : 0x%lx", ptr_buffer->last_key);
log_printf (" keys_count. . . . . . . : %d", ptr_buffer->keys_count); log_printf (" keys_count. . . . . . . : %d", ptr_buffer->keys_count);

View File

@ -206,6 +206,7 @@ struct t_gui_buffer
/* hotlist */ /* hotlist */
struct t_gui_hotlist *hotlist; /* hotlist entry for buffer */ struct t_gui_hotlist *hotlist; /* hotlist entry for buffer */
struct t_gui_hotlist *hotlist_removed; /* hotlist that can be restored */
struct t_hashtable *hotlist_max_level_nicks; /* max hotlist level for */ struct t_hashtable *hotlist_max_level_nicks; /* max hotlist level for */
/* some nicks */ /* some nicks */

View File

@ -85,6 +85,32 @@ gui_hotlist_search (struct t_gui_hotlist *hotlist, struct t_gui_buffer *buffer)
return NULL; return NULL;
} }
/*
* Duplicates a hotlist element.
*
* Returns pointer to new hotlist, NULL if error.
*/
struct t_gui_hotlist *
gui_hotlist_dup (struct t_gui_hotlist *hotlist)
{
struct t_gui_hotlist *new_hotlist;
new_hotlist = malloc (sizeof (*new_hotlist));
if (!new_hotlist)
return NULL;
new_hotlist->priority = hotlist->priority;
memcpy (&(new_hotlist->creation_time), &(hotlist->creation_time),
sizeof (new_hotlist->creation_time));
new_hotlist->buffer = hotlist->buffer;
memcpy (new_hotlist->count, hotlist->count, sizeof (hotlist->count));
new_hotlist->prev_hotlist = NULL;
new_hotlist->next_hotlist = NULL;
return new_hotlist;
}
/* /*
* Frees a hotlist and removes it from hotlist queue. * Frees a hotlist and removes it from hotlist queue.
*/ */
@ -92,13 +118,23 @@ gui_hotlist_search (struct t_gui_hotlist *hotlist, struct t_gui_buffer *buffer)
void void
gui_hotlist_free (struct t_gui_hotlist **hotlist, gui_hotlist_free (struct t_gui_hotlist **hotlist,
struct t_gui_hotlist **last_hotlist, struct t_gui_hotlist **last_hotlist,
struct t_gui_hotlist *ptr_hotlist) struct t_gui_hotlist *ptr_hotlist,
int save_removed_hotlist)
{ {
struct t_gui_hotlist *new_hotlist; struct t_gui_hotlist *new_hotlist;
if (!ptr_hotlist) if (!ptr_hotlist)
return; return;
if (save_removed_hotlist)
{
if (ptr_hotlist->buffer->hotlist_removed)
free (ptr_hotlist->buffer->hotlist_removed);
ptr_hotlist->buffer->hotlist_removed = gui_hotlist_dup (ptr_hotlist);
ptr_hotlist->buffer->hotlist_removed->prev_hotlist = NULL;
ptr_hotlist->buffer->hotlist_removed->next_hotlist = NULL;
}
ptr_hotlist->buffer->hotlist = NULL; ptr_hotlist->buffer->hotlist = NULL;
/* remove hotlist from queue */ /* remove hotlist from queue */
@ -130,7 +166,7 @@ gui_hotlist_free_all (struct t_gui_hotlist **hotlist,
/* remove all hotlists */ /* remove all hotlists */
while (*hotlist) while (*hotlist)
{ {
gui_hotlist_free (hotlist, last_hotlist, *hotlist); gui_hotlist_free (hotlist, last_hotlist, *hotlist, 1);
} }
} }
@ -391,7 +427,7 @@ gui_hotlist_add (struct t_gui_buffer *buffer,
* and go on * and go on
*/ */
memcpy (count, ptr_hotlist->count, sizeof (ptr_hotlist->count)); memcpy (count, ptr_hotlist->count, sizeof (ptr_hotlist->count));
gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, ptr_hotlist); gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, ptr_hotlist, 1);
} }
new_hotlist = malloc (sizeof (*new_hotlist)); new_hotlist = malloc (sizeof (*new_hotlist));
@ -421,29 +457,31 @@ gui_hotlist_add (struct t_gui_buffer *buffer,
} }
/* /*
* Duplicates a hotlist element. * Restores a hotlist that was removed from a buffer.
*
* Returns pointer to new hotlist, NULL if error.
*/ */
struct t_gui_hotlist * void
gui_hotlist_dup (struct t_gui_hotlist *hotlist) gui_hotlist_restore_buffer (struct t_gui_buffer *buffer)
{ {
struct t_gui_hotlist *new_hotlist; struct t_gui_hotlist *ptr_hotlist;
new_hotlist = malloc (sizeof (*new_hotlist)); if (!buffer->hotlist_removed)
if (new_hotlist) return;
{
new_hotlist->priority = hotlist->priority; /* remove hotlist with buffer from list (if found) */
memcpy (&(new_hotlist->creation_time), &(hotlist->creation_time), ptr_hotlist = gui_hotlist_search (gui_hotlist, buffer);
sizeof (new_hotlist->creation_time)); if (ptr_hotlist)
new_hotlist->buffer = hotlist->buffer; gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, ptr_hotlist, 0);
memcpy (new_hotlist->count, hotlist->count, sizeof (hotlist->count));
new_hotlist->prev_hotlist = NULL; /* restore the removed hotlist */
new_hotlist->next_hotlist = NULL; buffer->hotlist_removed->buffer = buffer;
return new_hotlist; ptr_hotlist = gui_hotlist_dup (buffer->hotlist_removed);
} gui_hotlist_add_hotlist (&gui_hotlist, &last_gui_hotlist, ptr_hotlist);
return NULL;
free (buffer->hotlist_removed);
buffer->hotlist_removed = NULL;
gui_hotlist_changed_signal (buffer);
} }
/* /*
@ -503,7 +541,7 @@ gui_hotlist_clear (int level_mask)
ptr_next_hotlist = ptr_hotlist->next_hotlist; ptr_next_hotlist = ptr_hotlist->next_hotlist;
if (level_mask & (1 << ptr_hotlist->priority)) if (level_mask & (1 << ptr_hotlist->priority))
{ {
gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, ptr_hotlist); gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, ptr_hotlist, 1);
hotlist_changed = 1; hotlist_changed = 1;
} }
ptr_hotlist = ptr_next_hotlist; ptr_hotlist = ptr_next_hotlist;
@ -554,7 +592,7 @@ gui_hotlist_remove_buffer (struct t_gui_buffer *buffer,
if (buffer_to_remove) if (buffer_to_remove)
{ {
gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, ptr_hotlist); gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, ptr_hotlist, 1);
hotlist_changed = 1; hotlist_changed = 1;
} }

View File

@ -61,6 +61,7 @@ extern int gui_add_hotlist;
extern struct t_gui_hotlist *gui_hotlist_add (struct t_gui_buffer *buffer, extern struct t_gui_hotlist *gui_hotlist_add (struct t_gui_buffer *buffer,
enum t_gui_hotlist_priority priority, enum t_gui_hotlist_priority priority,
struct timeval *creation_time); struct timeval *creation_time);
extern void gui_hotlist_restore_buffer (struct t_gui_buffer *buffer);
extern void gui_hotlist_resort (); extern void gui_hotlist_resort ();
extern void gui_hotlist_clear (int level_mask); extern void gui_hotlist_clear (int level_mask);
extern void gui_hotlist_remove_buffer (struct t_gui_buffer *buffer, extern void gui_hotlist_remove_buffer (struct t_gui_buffer *buffer,

View File

@ -642,7 +642,7 @@ gui_input_search_compile_regex (struct t_gui_buffer *buffer)
} }
/* /*
* Switches case for search in buffer (default key: meta-c during search). * Switches case for search in buffer (default key: alt-c during search).
*/ */
void void
@ -894,7 +894,7 @@ gui_input_delete_previous_word (struct t_gui_buffer *buffer)
} }
/* /*
* Deletes next word (default key: meta-d). * Deletes next word (default key: alt-d).
*/ */
void void
@ -1006,7 +1006,7 @@ gui_input_delete_end_of_line (struct t_gui_buffer *buffer)
} }
/* /*
* Deletes entire line (default key: meta-r). * Deletes entire line (default key: alt-r).
*/ */
void void
@ -1121,7 +1121,7 @@ gui_input_move_next_char (struct t_gui_buffer *buffer)
} }
/* /*
* Moves cursor to beginning of previous word (default key: meta-b or * Moves cursor to beginning of previous word (default key: alt-b or
* ctrl-left). * ctrl-left).
*/ */
@ -1160,7 +1160,7 @@ gui_input_move_previous_word (struct t_gui_buffer *buffer)
} }
/* /*
* Moves cursor to the beginning of next word (default key: meta-f or * Moves cursor to the beginning of next word (default key: alt-f or
* ctrl-right). * ctrl-right).
*/ */
@ -1469,7 +1469,7 @@ gui_input_jump_smart (struct t_gui_buffer *buffer)
/* /*
* Jumps to last buffer displayed (before last jump to a buffer) (default key: * Jumps to last buffer displayed (before last jump to a buffer) (default key:
* meta-/). * alt-/).
*/ */
void void
@ -1489,7 +1489,7 @@ gui_input_jump_last_buffer_displayed (struct t_gui_buffer *buffer)
/* /*
* Jumps to previously visited buffer (buffer displayed before current one) * Jumps to previously visited buffer (buffer displayed before current one)
* (default key: meta-<). * (default key: alt-<).
*/ */
void void
@ -1523,7 +1523,7 @@ gui_input_jump_previously_visited_buffer (struct t_gui_buffer *buffer)
/* /*
* Jumps to next visited buffer (buffer displayed after current one) (default * Jumps to next visited buffer (buffer displayed after current one) (default
* key: meta->). * key: alt->).
*/ */
void void
@ -1555,7 +1555,7 @@ gui_input_jump_next_visited_buffer (struct t_gui_buffer *buffer)
} }
/* /*
* Clears hotlist (default key: meta-h). * Clears hotlist (default key: alt-h, alt-c).
*/ */
void void
@ -1620,9 +1620,45 @@ gui_input_hotlist_clear (struct t_gui_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) * Initializes "grab key mode" (next key will be inserted into input buffer)
* (default key: meta-k). * (default key: alt-k).
*/ */
void void

View File

@ -77,6 +77,9 @@ extern void gui_input_jump_previously_visited_buffer (struct t_gui_buffer *buffe
extern void gui_input_jump_next_visited_buffer (struct t_gui_buffer *buffer); extern void gui_input_jump_next_visited_buffer (struct t_gui_buffer *buffer);
extern void gui_input_hotlist_clear (struct t_gui_buffer *buffer, extern void gui_input_hotlist_clear (struct t_gui_buffer *buffer,
const char *level_mask); const char *level_mask);
extern void gui_input_hotlist_remove_buffer (struct t_gui_buffer *buffer);
extern void gui_input_hotlist_restore_buffer (struct t_gui_buffer *buffer);
extern void gui_input_hotlist_restore_all ();
extern void gui_input_grab_key (struct t_gui_buffer *buffer, int command, extern void gui_input_grab_key (struct t_gui_buffer *buffer, int command,
const char *delay); const char *delay);
extern void gui_input_grab_mouse (struct t_gui_buffer *buffer, int area); extern void gui_input_grab_mouse (struct t_gui_buffer *buffer, int area);