|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | # |
| 3 | +# Copyright (C) 2025 Leo Vivier <zaeph@zaeph.net> |
3 | 4 | # Copyright (C) 2009-2023 Sébastien Helleu <flashcode@flashtux.org> |
4 | 5 | # Copyright (C) 2010 m4v <lambdae2@gmail.com> |
5 | 6 | # Copyright (C) 2011 stfn <stfnmd@googlemail.com> |
|
21 | 22 | # |
22 | 23 | # History: |
23 | 24 | # |
| 25 | +# 2025-10-17, Leo Vivier <zaeph@zaeph.net>: |
| 26 | +# version 3.1.0: add regexp search and cancellation with scroll_bottom |
24 | 27 | # 2024-05-30, Sébastien Helleu <flashcode@flashtux.org>: |
25 | 28 | # version 3.0.1: refresh buffer input at the end of search |
26 | 29 | # 2024-05-30, Sébastien Helleu <flashcode@flashtux.org>: |
|
105 | 108 |
|
106 | 109 | SCRIPT_NAME = 'go' |
107 | 110 | SCRIPT_AUTHOR = 'Sébastien Helleu <flashcode@flashtux.org>' |
108 | | -SCRIPT_VERSION = '3.0.1' |
| 111 | +SCRIPT_VERSION = '3.1.0' |
109 | 112 | SCRIPT_LICENSE = 'GPL3' |
110 | 113 | SCRIPT_DESC = 'Quick jump to buffers' |
111 | 114 |
|
|
148 | 151 | 'color_name_highlight_selected': ( |
149 | 152 | 'red,brown', |
150 | 153 | 'color for highlight in a selected buffer name'), |
| 154 | + 'regexp_search': ( |
| 155 | + 'off', |
| 156 | + 'search buffer matches using regexps'), |
151 | 157 | 'fuzzy_search': ( |
152 | 158 | 'off', |
153 | 159 | 'search buffer matches using approximation'), |
@@ -356,7 +362,10 @@ def go_matching_buffers(strinput): |
356 | 362 | full_name = '%s.%s' % ( |
357 | 363 | weechat.infolist_string(infolist, 'plugin_name'), |
358 | 364 | weechat.infolist_string(infolist, 'name')) |
359 | | - matching = name.lower().find(strinput) >= 0 |
| 365 | + if go_option_enabled('regexp_search'): |
| 366 | + matching = bool(re.search(strinput, name, re.IGNORECASE)) |
| 367 | + else: |
| 368 | + matching = name.lower().find(strinput) >= 0 |
360 | 369 | if not matching and strinput[-1] == ' ': |
361 | 370 | matching = name.lower().endswith(strinput.strip()) |
362 | 371 | if not matching and go_option_enabled('fuzzy_search'): |
@@ -546,6 +555,10 @@ def go_command_run_buffer(data, buf, command): |
546 | 555 |
|
547 | 556 | def go_command_run_window(data, buf, command): |
548 | 557 | """Function called when a command "/window xxx" is run.""" |
| 558 | + if command == '/window scroll_bottom': |
| 559 | + # cancel selection and return to input |
| 560 | + go_end(buf) |
| 561 | + return weechat.WEECHAT_RC_OK_EAT |
549 | 562 | return weechat.WEECHAT_RC_OK_EAT |
550 | 563 |
|
551 | 564 |
|
|
0 commit comments