From 715901363a02634f5336c0d3f18cbd9a9c080b4a Mon Sep 17 00:00:00 2001
From: mitchell <70453897+orbitalquark@users.noreply.github.com>
Date: Fri, 30 Apr 2021 18:40:06 -0400
Subject: Replaced `events.FILE_{BEFORE,AFTER}_RELOAD` with
`events.BUFFER_{BEFORE,AFTER}_REPLACE_TEXT`. This allows more features to
save/restore state when buffer contents are replaced (e.g. file reload,
filter through, etc.)
---
docs/api.md | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
(limited to 'docs/api.md')
diff --git a/docs/api.md b/docs/api.md
index 61d61dbe..c73bdf7a 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -2933,7 +2933,6 @@ Parameters:
#### `buffer.reload`(*buffer*)
Reloads the buffer's file contents, discarding any changes.
-Emits `FILE_BEFORE_RELOAD` and `FILE_AFTER_RELOAD` events if the buffer is the current one.
Parameters:
@@ -3711,6 +3710,14 @@ Emitted as items are highlighted in an autocompletion or user list.
* _`text`_: The current selection's text.
* _`position`_: The position the list was displayed at.
+
+#### `events.BUFFER_AFTER_REPLACE_TEXT` (string)
+
+Emitted after replacing the contents of the current buffer.
+ Note that it is not guaranteed that [`events.BUFFER_BEFORE_REPLACE_TEXT`](#events.BUFFER_BEFORE_REPLACE_TEXT) was emitted
+ previously.
+ The buffer **must not** be modified during this event.
+
#### `events.BUFFER_AFTER_SWITCH` (string)
@@ -3718,6 +3725,14 @@ Emitted right after switching to another buffer.
The buffer being switched to is `buffer`.
Emitted by [`view.goto_buffer()`](#view.goto_buffer).
+
+#### `events.BUFFER_BEFORE_REPLACE_TEXT` (string)
+
+Emitted before replacing the contents of the current buffer.
+ Note that it is not guaranteed that [`events.BUFFER_AFTER_REPLACE_TEXT`](#events.BUFFER_AFTER_REPLACE_TEXT) will be emitted
+ shortly after this event.
+ The buffer **must not** be modified during this event.
+
#### `events.BUFFER_BEFORE_SWITCH` (string)
@@ -4139,12 +4154,6 @@ Extends Lua's `io` library with Textadept functions for working with files.
### Fields defined by `io`
-
-#### `events.FILE_AFTER_RELOAD` (string)
-
-Emitted after reloading the current file.
- Emitted by [`buffer:reload()`](#buffer.reload).
-
#### `events.FILE_AFTER_SAVE` (string)
@@ -4155,12 +4164,6 @@ Emitted right after saving a file to disk.
* _`filename`_: The filename of the file being saved.
* _`saved_as`_: Whether or not the file was saved under a different filename.
-
-#### `events.FILE_BEFORE_RELOAD` (string)
-
-Emitted before reloading the current file.
- Emitted by [`buffer:reload()`](#buffer.reload).
-
#### `events.FILE_BEFORE_SAVE` (string)
--
cgit v1.2.3