Skip to content

Commit bc01816

Browse files
KevinSilvesterDrKJeff16
authored andcommitted
feat(events): create overload for Wezterm.on to account for events and handlers with arbitrary params; chore: fix grammar
1 parent f120587 commit bc01816

1 file changed

Lines changed: 21 additions & 6 deletions

File tree

lua/wezterm/types/wezterm.lua

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,17 +1420,32 @@ function M.log_warn(msg, ...) end
14201420

14211421
---A custom declared event handler.
14221422
---
1423-
---You may register handlers for arbitrary events for which wezterm itself has no special knowledge.
1423+
---You may register handlers for arbitrary events for which Wezterm itself has no special knowledge.
14241424
---
1425-
---It is recommended that you avoid event names that are likely to be used future versions of wezterm
1426-
---in order to avoid unexpected behavior if/when those names might be used in future.
1425+
---It is recommended that you avoid event names that are likely to be used future versions of Wezterm
1426+
---in order to avoid unexpected behavior if or when those names might be used in future.
14271427
---
1428-
---The `wezterm.emit` function and the `EmitEvent` key assignment can be used to emit events.
1428+
---The `wezterm.emit()` function and the `EmitEvent` key assignment can be used to emit events.
1429+
---
1430+
---See:
1431+
--- - [`Window`](lua://Window)
1432+
--- - [`Pane`](lua://Pane)
1433+
--- - [`EmitEvent`](lua://KeyAssignment.EmitEvent)
1434+
--- - [`wezterm.emit()`](lua://Wezterm.emit)
1435+
---
1436+
---@param event string
1437+
---@param callback fun(...:any): any
1438+
function M.on(event, callback) end
1439+
1440+
---A custom declared event handler for events emitted by the `EmitEvent` key assignment.
1441+
---
1442+
--- - The first event parameter is a `Window` object that represents the GUI window
1443+
--- - The second event parameter is a `Pane` object that represents the pane
1444+
--- in which the event was triggered
14291445
---
14301446
---See:
14311447
--- - [`Window`](lua://Window)
14321448
--- - [`Pane`](lua://Pane)
1433-
--- - [`wezterm.emit`](lua://Wezterm.emit)
14341449
--- - [`EmitEvent`](lua://KeyAssignment.EmitEvent)
14351450
---
14361451
---@param event string
@@ -1709,7 +1724,7 @@ function M.on(event, callback) end
17091724
---the `CompleteSelectionOrOpenLinkAtMouseCursor` key/mouse assignment is triggered.
17101725
---
17111726
---The default action is to open the active URI in your browser,
1712-
---but if you register for this event and return early with `false`,
1727+
---but if you register for this event and return early with `false`
17131728
---you can co-opt the default behavior.
17141729
---
17151730
---For more information, see:

0 commit comments

Comments
 (0)