mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 15:26:37 +02:00
core: use buffer pointer instead of window in input functions, add new function window_search_with_buffer in plugin API
This commit is contained in:
+352
-312
File diff suppressed because it is too large
Load Diff
+37
-38
@@ -21,7 +21,6 @@
|
||||
#define __WEECHAT_GUI_INPUT_H 1
|
||||
|
||||
struct t_gui_buffer;
|
||||
struct t_gui_window;
|
||||
|
||||
/* input variables */
|
||||
|
||||
@@ -39,43 +38,43 @@ extern int gui_input_insert_string (struct t_gui_buffer *buffer,
|
||||
const char *string, int pos);
|
||||
extern void gui_input_move_to_buffer (struct t_gui_buffer *from_buffer,
|
||||
struct t_gui_buffer *to_buffer);
|
||||
extern void gui_input_clipboard_paste (struct t_gui_window *window);
|
||||
extern void gui_input_return (struct t_gui_window *window);
|
||||
extern void gui_input_complete_next (struct t_gui_window *window);
|
||||
extern void gui_input_complete_previous (struct t_gui_window *window);
|
||||
extern void gui_input_search_text (struct t_gui_window *window);
|
||||
extern void gui_input_delete_previous_char (struct t_gui_window *window);
|
||||
extern void gui_input_delete_next_char (struct t_gui_window *window);
|
||||
extern void gui_input_delete_previous_word (struct t_gui_window *window);
|
||||
extern void gui_input_delete_next_word (struct t_gui_window *window);
|
||||
extern void gui_input_delete_beginning_of_line (struct t_gui_window *window);
|
||||
extern void gui_input_delete_end_of_line (struct t_gui_window *window);
|
||||
extern void gui_input_delete_line (struct t_gui_window *window);
|
||||
extern void gui_input_transpose_chars (struct t_gui_window *window);
|
||||
extern void gui_input_move_beginning_of_line (struct t_gui_window *window);
|
||||
extern void gui_input_move_end_of_line (struct t_gui_window *window);
|
||||
extern void gui_input_move_previous_char (struct t_gui_window *window);
|
||||
extern void gui_input_move_next_char (struct t_gui_window *window);
|
||||
extern void gui_input_move_previous_word (struct t_gui_window *window);
|
||||
extern void gui_input_move_next_word (struct t_gui_window *window);
|
||||
extern void gui_input_history_local_previous (struct t_gui_window *window);
|
||||
extern void gui_input_history_local_next (struct t_gui_window *window);
|
||||
extern void gui_input_history_global_previous (struct t_gui_window *window);
|
||||
extern void gui_input_history_global_next (struct t_gui_window *window);
|
||||
extern void gui_input_jump_smart (struct t_gui_window *window);
|
||||
extern void gui_input_jump_last_buffer (struct t_gui_window *window);
|
||||
extern void gui_input_jump_previously_visited_buffer (struct t_gui_window *window);
|
||||
extern void gui_input_jump_next_visited_buffer (struct t_gui_window *window);
|
||||
extern void gui_input_hotlist_clear (struct t_gui_window *window);
|
||||
extern void gui_input_grab_key (struct t_gui_window *window);
|
||||
extern void gui_input_grab_key_command (struct t_gui_window *window);
|
||||
extern void gui_input_scroll_unread (struct t_gui_window *window);
|
||||
extern void gui_input_clipboard_paste (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_return (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_complete_next (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_complete_previous (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_search_text (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_delete_previous_char (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_delete_next_char (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_delete_previous_word (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_delete_next_word (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_delete_beginning_of_line (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_delete_end_of_line (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_delete_line (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_transpose_chars (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_move_beginning_of_line (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_move_end_of_line (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_move_previous_char (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_move_next_char (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_move_previous_word (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_move_next_word (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_local_previous (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_local_next (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_global_previous (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_global_next (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_jump_smart (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_jump_last_buffer (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_jump_previously_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_grab_key (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_grab_key_command (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_scroll_unread (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_set_unread ();
|
||||
extern void gui_input_set_unread_current (struct t_gui_window *window);
|
||||
extern void gui_input_switch_active_buffer (struct t_gui_window *window);
|
||||
extern void gui_input_switch_active_buffer_previous (struct t_gui_window *window);
|
||||
extern void gui_input_insert (struct t_gui_window *window, const char *args);
|
||||
extern void gui_input_undo (struct t_gui_window *window);
|
||||
extern void gui_input_redo (struct t_gui_window *window);
|
||||
extern void gui_input_set_unread_current (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_switch_active_buffer (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_switch_active_buffer_previous (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_insert (struct t_gui_buffer *buffer, const char *args);
|
||||
extern void gui_input_undo (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_redo (struct t_gui_buffer *buffer);
|
||||
|
||||
#endif /* __WEECHAT_GUI_INPUT_H */
|
||||
|
||||
+34
-2
@@ -483,6 +483,38 @@ gui_window_valid (struct t_gui_window *window)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_search_with_buffer: search window displaying a buffer
|
||||
* return NULL if no window is displaying given
|
||||
* buffer
|
||||
* If many windows are displaying this buffer,
|
||||
* the first window in list is returned (or
|
||||
* current window if it is displaying this
|
||||
* buffer)
|
||||
*/
|
||||
|
||||
struct t_gui_window *
|
||||
gui_window_search_with_buffer (struct t_gui_buffer *buffer)
|
||||
{
|
||||
struct t_gui_window *ptr_window;
|
||||
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
|
||||
if (gui_current_window->buffer == buffer)
|
||||
return gui_current_window;
|
||||
|
||||
for (ptr_window = gui_windows; ptr_window;
|
||||
ptr_window = ptr_window->next_window)
|
||||
{
|
||||
if (ptr_window->buffer == buffer)
|
||||
return ptr_window;
|
||||
}
|
||||
|
||||
/* no window displaying buffer */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_get_integer: get a window property as integer
|
||||
*/
|
||||
@@ -1064,7 +1096,7 @@ gui_window_search_start (struct t_gui_window *window)
|
||||
if (window->buffer->input_buffer && window->buffer->input_buffer[0])
|
||||
window->buffer->text_search_input =
|
||||
strdup (window->buffer->input_buffer);
|
||||
gui_input_delete_line (window);
|
||||
gui_input_delete_line (window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1101,7 +1133,7 @@ gui_window_search_stop (struct t_gui_window *window)
|
||||
{
|
||||
window->buffer->text_search = GUI_TEXT_SEARCH_DISABLED;
|
||||
window->buffer->text_search = 0;
|
||||
gui_input_delete_line (window);
|
||||
gui_input_delete_line (window->buffer);
|
||||
if (window->buffer->text_search_input)
|
||||
{
|
||||
gui_input_insert_string (window->buffer,
|
||||
|
||||
@@ -128,6 +128,7 @@ extern struct t_gui_window *gui_window_new (struct t_gui_window *parent_window,
|
||||
int x, int y, int width, int height,
|
||||
int width_pct, int height_pct);
|
||||
extern int gui_window_valid (struct t_gui_window *window);
|
||||
extern struct t_gui_window *gui_window_search_with_buffer (struct t_gui_buffer *buffer);
|
||||
extern int gui_window_get_integer (struct t_gui_window *window,
|
||||
const char *property);
|
||||
extern const char *gui_window_get_string (struct t_gui_window *window,
|
||||
|
||||
Reference in New Issue
Block a user