diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-05-31 21:19:24 +0200 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-05-31 21:19:24 +0200 |
| commit | aa7b0bb1445feeefafdcf47fd639b10500b45c03 (patch) | |
| tree | 529351a0ee2862448680b0189d7ee72768f45357 /src/core-commands.c | |
| parent | 957f24cf63261424288a8794f61cfdf5e5606fad (diff) | |
implemented but disabled block-wise backwards search algorithm
* The block-wise search algorithm allows for efficient backwards searches
on large files.
* On the downside the results are not entirely symmetric to forward searches.
It therefore makes sense to still support the old correct but possibly slow
algorithm.
Since the old algorithm is just a special case of the new one (with a single
block stretching the entire search range), you can configure the block size
using `8EJ`.
* Unfortunately, the new block-wise algorithm won't work due to a bug in GRegex
(only in the glib wrapper code).
It is therefore disabled for the time being by default and will probably
only be enabled once we switch to a new regexp engine.
See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/5199
Diffstat (limited to 'src/core-commands.c')
| -rw-r--r-- | src/core-commands.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/core-commands.c b/src/core-commands.c index 63d8dbc..5ca508c 100644 --- a/src/core-commands.c +++ b/src/core-commands.c @@ -2110,6 +2110,7 @@ teco_state_ecommand_flags(teco_machine_main_t *ctx, GError **error) * of buffers in the ring. * (\fBread-only\fP) * .IP 2: + * .SCITECO_TOPIC "memory limit" * The current memory limit in bytes. * This limit helps to prevent dangerous out-of-memory * conditions (e.g. resulting from infinite loops) by @@ -2134,7 +2135,7 @@ teco_state_ecommand_flags(teco_machine_main_t *ctx, GError **error) * requirements are too large for the new limit \(em if * this happens you may have to clear your command-line * first. - * Memory limiting is enabled by default. + * Memory limiting is enabled by default (default: 500MB). * .IP 3: * .SCITECO_TOPIC palette * This \fBwrite-only\fP property allows disabling use of @@ -2167,6 +2168,7 @@ teco_state_ecommand_flags(teco_machine_main_t *ctx, GError **error) * You are recommended to add \(lq0,3EJ\(rq to all color * schemes that rely on exact RGB values. * .IP 4: + * .SCITECO_TOPIC caretx * The column after the last horizontal movement. * This is only used by \fBfnkeys.tes\fP and is similar to the Scintilla-internal * setting \fBSCI_CHOOSECARETX\fP. @@ -2208,6 +2210,22 @@ teco_state_ecommand_flags(teco_machine_main_t *ctx, GError **error) * work both on white on black and black on white terminals. * Use -1 to disable default foreground or background colors. * It has no effect when using the GTK interface. + * .IP 8: + * .SCITECO_TOPIC "block size" + * Block size during backwards searches (e.g. \(lq-S\(rq). + * When searching backwards \*(ST will perform forward searches + * in within blocks before the search range's end. + * If not enough matches could be produced, it moves back + * another block. + * The smaller the block size the more likely that a match + * will not be the leftmost longest, but the less matching overhead. + * A negative or 0 value (\(lq0,8EJ\(rq) is the maximum block size and + * ensures forward searches over the entire search range. + * Only this setting guarantees leftmost longest matches that + * are entirely symmetric to forward searches, but can be + * unpractically slow on huge files. + * The default is 0. + * \# FIXME: Feature is currently broken! * . * .IP -1: * Type of the last mouse event (\fBread-only\fP). @@ -2263,7 +2281,8 @@ teco_state_ecommand_properties(teco_machine_main_t *ctx, GError **error) EJ_CARETX, EJ_CMDLINE_HEIGHT, EJ_RECOVERY_INTERVAL, - EJ_DEFAULT_COLORS + EJ_DEFAULT_COLORS, + EJ_SEARCH_BLOCK_SIZE }; static teco_int_t caret_x = 0; @@ -2328,6 +2347,10 @@ teco_state_ecommand_properties(teco_machine_main_t *ctx, GError **error) break; } + case EJ_SEARCH_BLOCK_SIZE: + teco_undo_gsize(teco_search_block_size) = MAX(0, value); + break; + default: g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED, "Cannot set property %" TECO_INT_FORMAT " " @@ -2391,6 +2414,10 @@ teco_state_ecommand_properties(teco_machine_main_t *ctx, GError **error) teco_expressions_push(teco_ring_recovery_interval); break; + case EJ_SEARCH_BLOCK_SIZE: + teco_expressions_push(teco_search_block_size); + break; + default: g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED, "Invalid property %" TECO_INT_FORMAT " " |
