Foundry.FileSearchReplacement¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Foundry.FileSearchReplacement(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Perform text replacements across search matches.
This class takes a list of [class`Foundry`.FileSearchMatch] objects and applies text replacements to each match location. It supports both literal text replacement and regex-based replacement with back references.
The replacement operation is performed asynchronously using fibers, and all edits are applied through the [class`Foundry`.TextManager] to ensure proper undo/redo support. The files are saved after applying changes.
New in version 1.1.
- classmethod new(context, matches, options, replacement_text)¶
- Parameters:
context (
Foundry.Context) – a [class`Foundry`.Context]matches (
Gio.ListModel) – a [iface`Gio`.ListModel] of [class`Foundry`.FileSearchMatch]options (
Foundry.FileSearchOptions) – a [class`Foundry`.FileSearchOptions]replacement_text (
str) – the replacement text (may contain back references if regex is enabled)
- Returns:
a new [class`Foundry`.FileSearchReplacement]
- Return type:
Creates a new [class`Foundry`.FileSearchReplacement] for performing single or bulk text replacements.
The replacement_text can contain back references (like
\1,\2, etc.) if options has regex enabled via [method`Foundry`.FileSearchOptions.set_use_regex].New in version 1.1.
- apply()¶
- Returns:
a [class`Dex`.Future] that completes when all replacements are finished
- Return type:
Applies the text replacements to all matched locations.
This method starts a fiber and performs replacements asynchronously. Each replacement is performed using [class`Foundry`.TextEdit] and applied using [class`Foundry`.TextManager].
New in version 1.1.