Skip to content

Commit

Permalink
docs: add missing document about dropbar_symbol_t.callback_idx
Browse files Browse the repository at this point in the history
  • Loading branch information
bekaboo committed Dec 22, 2023
1 parent 3dd2c28 commit ffa55b3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1895,27 +1895,28 @@ basic element of [`dropbar_t`](#dropbar_t) and [`dropbar_menu_entry_t`](#dropbar
`dropbar_symbol_t` has the following fields:
| Field | Type | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `name` | `string` | name of the symbol |
| `icon` | `string` | icon of the symbol |
| `name_hl` | `string?` | highlight of the name of the symbol |
| `icon_hl` | `string?` | highlight of the icon of the symbol |
| `win` | `integer?` | the source window the symbol is shown in |
| `buf` | `integer?` | the source buffer the symbol is defined in |
| `view` | `table?` | The original view of the source window, created by `winsaveview()`, used to restore the view after previewing the symbol |
| `bar` | [`dropbar_t?`](#dropbar_t) | the dropbar<sub>[`dropbar_t`](#dropbar_t)</sub> the symbol belongs to, if the symbol is shown inside a winbar |
| `menu` | [`dropbar_menu_t?`](#dropbar_menu_t) | menu<sub>[`dropbar_menu_t`](#dropbar_menu_t)</sub> associated with the symbol, if the symbol is shown inside a winbar |
| `entry` | [`dropbar_menu_entry_t?`](#dropbar_menu_entry_t) | the dropbar menu entry<sub>[`dropbar_menu_entry_t`](#dropbar_menu_entry_t)</sub> the symbol belongs to, if the symbol is shown inside a menu |
| `children` | `dropbar_symbol_t[]?` | children of the symbol (e.g. a children of a function symbol can be local variables inside the function) |
| `siblings` | `dropbar_symbol_t[]?` | siblings of the symbol (e.g. a sibling of a symbol that represents a level 4 markdown heading can be other headings with level 4) |
| `bar_idx` | `integer?` | index of the symbol in the dropbar<sub>[`dropbar_t`](#dropbar_t)</sub> |
| `entry_idx` | `integer?` | index of the symbol in the menu entry<sub>[`dropbar_menu_entry_t`](#dropbar_menu_entry_t)</sub> |
| `sibling_idx` | `integer?` | index of the symbol in the siblings |
| `range` | `{start: {line: integer, character: integer}, end: {line: integer, character: integer}}` | range of the symbol in the source window |
| `on_click` | `fun(this: dropbar_symbol_t, min_width: integer?, n_clicks: integer?, button: string?, modifiers: string?)\|false?` | callback to invoke when the symbol is clicked, force disable `on_click` when the value if set to `false` |
| `opts` | `dropbar_symbol_opts_t?` | options passed to `winbar_symbol_t:new()` when the symbols is created |
| `data` | `table?` | any extra data associated with the symbol |
| Field | Type | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `name` | `string` | name of the symbol |
| `icon` | `string` | icon of the symbol |
| `name_hl` | `string?` | highlight of the name of the symbol |
| `icon_hl` | `string?` | highlight of the icon of the symbol |
| `win` | `integer?` | the source window the symbol is shown in |
| `buf` | `integer?` | the source buffer the symbol is defined in |
| `view` | `table?` | The original view of the source window, created by `winsaveview()`, used to restore the view after previewing the symbol |
| `bar` | [`dropbar_t?`](#dropbar_t) | the dropbar<sub>[`dropbar_t`](#dropbar_t)</sub> the symbol belongs to, if the symbol is shown inside a winbar |
| `menu` | [`dropbar_menu_t?`](#dropbar_menu_t) | menu<sub>[`dropbar_menu_t`](#dropbar_menu_t)</sub> associated with the symbol, if the symbol is shown inside a winbar |
| `entry` | [`dropbar_menu_entry_t?`](#dropbar_menu_entry_t) | the dropbar menu entry<sub>[`dropbar_menu_entry_t`](#dropbar_menu_entry_t)</sub> the symbol belongs to, if the symbol is shown inside a menu |
| `children` | `dropbar_symbol_t[]?` | children of the symbol (e.g. a children of a function symbol can be local variables inside the function) |
| `siblings` | `dropbar_symbol_t[]?` | siblings of the symbol (e.g. a sibling of a symbol that represents a level 4 markdown heading can be other headings with level 4) |
| `bar_idx` | `integer?` | index of the symbol in the dropbar<sub>[`dropbar_t`](#dropbar_t)</sub> |
| `entry_idx` | `integer?` | index of the symbol in the menu entry<sub>[`dropbar_menu_entry_t`](#dropbar_menu_entry_t)</sub> |
| `sibling_idx` | `integer?` | index of the symbol in the siblings |
| `range` | `{start: {line: integer, character: integer}, end: {line: integer, character: integer}}` | range of the symbol in the source window |
| `on_click` | `fun(this: dropbar_symbol_t, min_width: integer?, n_clicks: integer?, button: string?, modifiers: string?)\|false?` | callback to invoke when the symbol is clicked, force disable `on_click` when the value if set to `false` |
| `callback_idx` | `integer?` | idx of the on_click callback in `_G.dropbar.callbacks[buf][win]`, use this to index callback function because `bar_idx` could change after truncate |
| `opts` | `dropbar_symbol_opts_t?` | options passed to `winbar_symbol_t:new()` when the symbols is created |
| `data` | `table?` | any extra data associated with the symbol |
`dropbar_symbol_t` has the following methods:
Expand Down
9 changes: 9 additions & 0 deletions doc/dropbar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,15 @@ dropbar_symbol_t.on_click *dropbar_symbol_t.on_click*
about the execute function label in the help page for
'statusline'.

dropbar_symbol_t.callback_idx *dropbar_symbol_t.callback_idx*

Index of the `on_click()` callback in
`_G.dropbar.callbacks[buf][win]`, use this to index callback function
because `bar_idx` could change after truncate

Type ~
integer?

dropbar_symbol_t.opts *dropbar_symbol_t.opts*

Options passed to `dropbar_symbol_t:new()` when the symbols is created
Expand Down

0 comments on commit ffa55b3

Please sign in to comment.