mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Fix behaviour for search-toggle-regex
text_typeahead_handler: Document that passing -2 for action_id will cause a search without error reporting. This behaviour is unintentionally the current behaviour of text_typeahead_handler, but now it is documented so that it can be used. input_line_event_handler: When rewinding, pass -2 for the action_id parameter to the handler instead of passing again whatever action led to the rewinding. The old behavior of input_line_event_handler was particularly problematic with the search-toggle-regex action and the text_typeahead_handler handler: input_line_event_handler would call the handler with ACT_EDIT_SEARCH_TOGGLE_REGEX, and the handler would toggle the setting and perform the search again; then if the search string no longer matched anything, the handler would return INPUT_LINE_REWIND to input_line_event_handler, which would rewind and call the handler with ACT_EDIT_SEARCH_TOGGLE_REGEX again, thus toggling the option back to the original setting. With the new behaviour, input_line_event_handler will not repeat the same action when re-invoking the handler; in the above example with search-toggle-regex, the search string will simply be rewound until it matches with the new setting.
This commit is contained in:
parent
0ced0c9851
commit
8d8ff02bbf
@ -856,6 +856,9 @@ cancel_input_line:
|
||||
|
||||
update_dialog_data(dlg_data);
|
||||
|
||||
/* Set action_id to -2 to signal to the handler that it should
|
||||
* not report errors or take any action except to search. */
|
||||
action_id = -2;
|
||||
goto send_action_to_handler;
|
||||
|
||||
case INPUT_LINE_PROCEED:
|
||||
|
@ -1378,6 +1378,9 @@ do_typeahead(struct session *ses, struct document_view *doc_view,
|
||||
/** @name Typeahead
|
||||
* @{ */
|
||||
|
||||
/** @a action_id can be a value from enum edit_action, in which case the
|
||||
* approriate action is performed; -1, which indicates to search and report any
|
||||
* errors; or -2, which indicates to search without reporting any errors. */
|
||||
static enum input_line_code
|
||||
text_typeahead_handler(struct input_line *line, int action_id)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user