<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>docs/config/lua/window-events/format-tab-title.md - fork/wezterm @ termiz-0.23.3</title>
<meta name="description" content="docs/config/lua/window-events/format-tab-title.md in fork/wezterm at termiz-0.23.3.">
<meta property="og:title" content="docs/config/lua/window-events/format-tab-title.md - fork/wezterm @ termiz-0.23.3">
<meta property="og:description" content="docs/config/lua/window-events/format-tab-title.md in fork/wezterm at termiz-0.23.3.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="git.julia.blue">
<link rel="stylesheet" href="/css/style.css?v=62">
<script type="module" src="/js/main.js?v=62"></script>
</head>
<body>
<main data-ref="termiz-0.23.3" data-tip="4bf28e253c0167102f07bfc7e7199c13eed98012">
<noscript>
  <div class="callout">
    <p>
      hey! this is a static git repo viewer. commit diffs, file history,
      older commits and other revisions won't load without javascript.
    </p>
    <p>
      you are still able to view source files on branch/tag tips,
      but the experience is degraded.
    </p>
  </div>
</noscript>
<header class="repo"><div>
<h1>fork/wezterm</h1>
</div>
<pre class="clone">git clone https://git.julia.blue/fork/wezterm</pre>
</header>
<p class="snapshot-commit"><span class="commit-author">Asher</span><span class="commit-message" data-commit="39638059ef281c277dcb0e4ca9c8ae566ada467e">Update format-tab-title.md</span><span class="snapshot-sha sha" data-commit="39638059ef281c277dcb0e4ca9c8ae566ada467e">39638059e</span><time datetime="2023-04-20T13:33:12+01:00" title="2023-04-20 13:33:12 +0100">2023-04-20</time></p>
<header class="topbar"><details class="switcher"><summary>termiz-0.23.3</summary><div class="menu"><strong>branches</strong><a href="/fork/wezterm/ref/main/">main</a><strong>tags</strong><a href="/fork/wezterm/ref/termiz-0.23.1/">termiz-0.23.1</a><a href="/fork/wezterm/ref/termiz-0.23.2/">termiz-0.23.2</a><a class="current" href="/fork/wezterm/ref/termiz-0.23.3/">termiz-0.23.3</a><a href="/fork/wezterm/ref/termwiz-0.23.0/">termwiz-0.23.0</a><a href="/fork/wezterm/ref/termwiz-0.23.1/">termwiz-0.23.1</a><a href="/fork/wezterm/ref/termwiz-0.23.2/">termwiz-0.23.2</a><a href="/fork/wezterm/ref/termwiz-0.23.3/">termwiz-0.23.3</a><a href="/fork/wezterm/ref/vtparse-0.7.0/">vtparse-0.7.0</a><a class="all" href="/fork/wezterm/refs">all refs →</a></div></details><nav class="crumbs"><a href="/fork/wezterm/">wezterm</a> / <a href="/fork/wezterm/ref/termiz-0.23.3/tree/docs/">docs</a> / <a href="/fork/wezterm/ref/termiz-0.23.3/tree/docs/config/">config</a> / <a href="/fork/wezterm/ref/termiz-0.23.3/tree/docs/config/lua/">lua</a> / <a href="/fork/wezterm/ref/termiz-0.23.3/tree/docs/config/lua/window-events/">window-events</a> / <span class="cur">format-tab-title.md</span></nav>
<span class="view-stats"><span>5.0 KiB</span><span>147 lines</span></span><span class="actions"><a class="raw" href="/fork/wezterm/raw/d8a0b31a4aa814c8c4f6d52f04edaab95eaf4490/docs/config/lua/window-events/format-tab-title.md">raw</a></span></header>
<div class="markdown-view"><input type="radio" name="markdown-view" id="markdown-rendered" checked><label for="markdown-rendered">rendered</label><input type="radio" name="markdown-view" id="markdown-code"><label for="markdown-code">code</label><section class="readme rendered"><h1><code>format-tab-title</code></h1>
<p>{{since('20210502-130208-bff6815d')}}</p>
<p>The <code>format-tab-title</code> event is emitted when the text for a tab title
needs to be recomputed.</p>
<p>This event is a bit special in that it is <em>synchronous</em> and must return as
quickly as possible in order to avoid blocking the GUI thread.</p>
<p>The most notable consequence of this is that some functions that are
asynchronous (such as
<a href="/fork/wezterm/ref/termiz-0.23.3/blob/docs/config/lua/wezterm/run_child_process.md">wezterm.run_child_process</a>) are not possible
to call from inside the event handler and will generate a <code>format-tab-title: runtime error: attempt to yield from outside a coroutine</code> error.</p>
<p>This example overrides the default tab title so that the background color
is blue for the active tab.  This is partially redundant because there is
already configuration for this in <a href="/fork/wezterm/ref/termiz-0.23.3/blob/docs/config/lua/config/tab_bar_style.md">tab_bar_style</a>,
but it demonstrates that it is possible to format more than just the text
shown in the tab.</p>
<pre class="language-lua"><a-c>-- This function returns the suggested title for a tab.</a-c>
<a-c>-- It prefers the title that was set via `tab:set_title()`</a-c>
<a-c>-- or `wezterm cli set-tab-title`, but falls back to the</a-c>
<a-c>-- title of the active pane in that tab.</a-c>
<a-k>function</a-k> <a-f>tab_title</a-f><a-p>(</a-p><a-v>tab_info</a-v><a-p>)</a-p>
  <a-k>local</a-k> <a-v>title</a-v> = <a-v>tab_info</a-v><a-p>.</a-p><a-v>tab_title</a-v>
  <a-c>-- if the tab title is explicitly set, take that</a-c>
  <a-k>if</a-k> <a-v>title</a-v> <a-k>and</a-k> <a-o>#</a-o><a-v>title</a-v> <a-o>&gt;</a-o> <a-n>0</a-n> <a-k>then</a-k>
    <a-k>return</a-k> <a-v>title</a-v>
  <a-k>end</a-k>
  <a-c>-- Otherwise, use the title from the active pane</a-c>
  <a-c>-- in that tab</a-c>
  <a-k>return</a-k> <a-v>tab_info</a-v><a-p>.</a-p><a-v>active_pane</a-v><a-p>.</a-p><a-v>title</a-v>
<a-k>end</a-k>

<a-v>wezterm</a-v><a-p>.</a-p><a-f>on</a-f><a-p>(</a-p>
  <a-s>&#39;format-tab-title&#39;</a-s><a-p>,</a-p>
  <a-k>function</a-k><a-p>(</a-p><a-v>tab</a-v><a-p>,</a-p> <a-v>tabs</a-v><a-p>,</a-p> <a-v>panes</a-v><a-p>,</a-p> <a-v>config</a-v><a-p>,</a-p> <a-v>hover</a-v><a-p>,</a-p> <a-v>max_width</a-v><a-p>)</a-p>
    <a-k>local</a-k> <a-v>title</a-v> = <a-f>tab_title</a-f><a-p>(</a-p><a-v>tab</a-v><a-p>)</a-p>
    <a-k>if</a-k> <a-v>tab</a-v><a-p>.</a-p><a-v>is_active</a-v> <a-k>then</a-k>
      <a-k>return</a-k> <a-cr>{</a-cr>
        <a-cr>{</a-cr> <a-v>Background</a-v> = <a-cr>{</a-cr> <a-v>Color</a-v> = <a-s>&#39;blue&#39;</a-s> <a-cr>}</a-cr> <a-cr>}</a-cr><a-p>,</a-p>
        <a-cr>{</a-cr> <a-v>Text</a-v> = <a-s>&#39; &#39;</a-s> <a-o>..</a-o> <a-v>title</a-v> <a-o>..</a-o> <a-s>&#39; &#39;</a-s> <a-cr>}</a-cr><a-p>,</a-p>
      <a-cr>}</a-cr>
    <a-k>end</a-k>
    <a-k>return</a-k> <a-v>title</a-v>
  <a-k>end</a-k>
<a-p>)</a-p></pre>
<p>The parameters to the event are:</p>
<ul>
<li><code>tab</code> - the <a href="/fork/wezterm/ref/termiz-0.23.3/blob/docs/config/lua/TabInformation.md">TabInformation</a> for the active tab</li>
<li><code>tabs</code> - an array containing <a href="/fork/wezterm/ref/termiz-0.23.3/blob/docs/config/lua/TabInformation.md">TabInformation</a> for each of the tabs in the window</li>
<li><code>panes</code> - an array containing <a href="/fork/wezterm/ref/termiz-0.23.3/blob/docs/config/lua/PaneInformation.md">PaneInformation</a> for each of the panes in the active tab</li>
<li><code>config</code> - the effective configuration for the window</li>
<li><code>hover</code> - true if the current tab is in the hover state</li>
<li><code>max_width</code> - the maximum number of cells available to draw this tab when using the retro tab bar style.</li>
</ul>
<p>The return value of the event can be:</p>
<ul>
<li>a string, holding the text to use for the tab title</li>
<li>a table holding <code>FormatItem</code>s as used in the <a href="/fork/wezterm/ref/termiz-0.23.3/blob/docs/config/lua/wezterm/format.md">wezterm.format</a> function.  This allows formatting style and color information for individual elements within the tab.</li>
</ul>
<p>If the event encounters an error, or returns something that is not one of the
types mentioned above, then the default tab title text will be computed and
used instead.</p>
<p>When the tab bar is computed, this event is called twice for each tab;
on the first pass, <code>hover</code> will be <code>false</code> and <code>max_width</code> will be set
to <a href="/fork/wezterm/ref/termiz-0.23.3/blob/docs/config/lua/config/tab_max_width.md">tab_max_width</a>.  WezTerm will then compute
the tab widths that will fit in the tab bar, and then call the event again
for the set of tabs, this time with appropriate <code>hover</code> and <code>max_width</code>
values.</p>
<p>Only the first <code>format-tab-title</code> event will be executed; it doesn't make
sense to define multiple instances of the event with multiple
<code>wezterm.on("format-tab-title", ...)</code> calls.</p>
<p>A more elaborate example:</p>
<pre class="language-lua"><a-k>local</a-k> <a-v>wezterm</a-v> = <a-f>require</a-f> <a-s>&#39;wezterm&#39;</a-s>

<a-c>-- The filled in variant of the &lt; symbol</a-c>
<a-k>local</a-k> <a-co>SOLID_LEFT_ARROW</a-co> = <a-v>wezterm</a-v><a-p>.</a-p><a-v>nerdfonts</a-v><a-p>.</a-p><a-v>pl_right_hard_divider</a-v>

<a-c>-- The filled in variant of the &gt; symbol</a-c>
<a-k>local</a-k> <a-co>SOLID_RIGHT_ARROW</a-co> = <a-v>wezterm</a-v><a-p>.</a-p><a-v>nerdfonts</a-v><a-p>.</a-p><a-v>pl_left_hard_divider</a-v>

<a-c>-- This function returns the suggested title for a tab.</a-c>
<a-c>-- It prefers the title that was set via `tab:set_title()`</a-c>
<a-c>-- or `wezterm cli set-tab-title`, but falls back to the</a-c>
<a-c>-- title of the active pane in that tab.</a-c>
<a-k>function</a-k> <a-f>tab_title</a-f><a-p>(</a-p><a-v>tab_info</a-v><a-p>)</a-p>
  <a-k>local</a-k> <a-v>title</a-v> = <a-v>tab_info</a-v><a-p>.</a-p><a-v>tab_title</a-v>
  <a-c>-- if the tab title is explicitly set, take that</a-c>
  <a-k>if</a-k> <a-v>title</a-v> <a-k>and</a-k> <a-o>#</a-o><a-v>title</a-v> <a-o>&gt;</a-o> <a-n>0</a-n> <a-k>then</a-k>
    <a-k>return</a-k> <a-v>title</a-v>
  <a-k>end</a-k>
  <a-c>-- Otherwise, use the title from the active pane</a-c>
  <a-c>-- in that tab</a-c>
  <a-k>return</a-k> <a-v>tab_info</a-v><a-p>.</a-p><a-v>active_pane</a-v><a-p>.</a-p><a-v>title</a-v>
<a-k>end</a-k>

<a-v>wezterm</a-v><a-p>.</a-p><a-f>on</a-f><a-p>(</a-p>
  <a-s>&#39;format-tab-title&#39;</a-s><a-p>,</a-p>
  <a-k>function</a-k><a-p>(</a-p><a-v>tab</a-v><a-p>,</a-p> <a-v>tabs</a-v><a-p>,</a-p> <a-v>panes</a-v><a-p>,</a-p> <a-v>config</a-v><a-p>,</a-p> <a-v>hover</a-v><a-p>,</a-p> <a-v>max_width</a-v><a-p>)</a-p>
    <a-k>local</a-k> <a-v>edge_background</a-v> = <a-s>&#39;#0b0022&#39;</a-s>
    <a-k>local</a-k> <a-v>background</a-v> = <a-s>&#39;#1b1032&#39;</a-s>
    <a-k>local</a-k> <a-v>foreground</a-v> = <a-s>&#39;#808080&#39;</a-s>

    <a-k>if</a-k> <a-v>tab</a-v><a-p>.</a-p><a-v>is_active</a-v> <a-k>then</a-k>
      <a-v>background</a-v> = <a-s>&#39;#2b2042&#39;</a-s>
      <a-v>foreground</a-v> = <a-s>&#39;#c0c0c0&#39;</a-s>
    <a-k>elseif</a-k> <a-v>hover</a-v> <a-k>then</a-k>
      <a-v>background</a-v> = <a-s>&#39;#3b3052&#39;</a-s>
      <a-v>foreground</a-v> = <a-s>&#39;#909090&#39;</a-s>
    <a-k>end</a-k>

    <a-k>local</a-k> <a-v>edge_foreground</a-v> = <a-v>background</a-v>

    <a-k>local</a-k> <a-v>title</a-v> = <a-f>tab_title</a-f><a-p>(</a-p><a-v>tab</a-v><a-p>)</a-p>

    <a-c>-- ensure that the titles fit in the available space,</a-c>
    <a-c>-- and that we have room for the edges.</a-c>
    <a-v>title</a-v> = <a-v>wezterm</a-v><a-p>.</a-p><a-f>truncate_right</a-f><a-p>(</a-p><a-v>title</a-v><a-p>,</a-p> <a-v>max_width</a-v> <a-o>-</a-o> <a-n>2</a-n><a-p>)</a-p>

    <a-k>return</a-k> <a-cr>{</a-cr>
      <a-cr>{</a-cr> <a-v>Background</a-v> = <a-cr>{</a-cr> <a-v>Color</a-v> = <a-v>edge_background</a-v> <a-cr>}</a-cr> <a-cr>}</a-cr><a-p>,</a-p>
      <a-cr>{</a-cr> <a-v>Foreground</a-v> = <a-cr>{</a-cr> <a-v>Color</a-v> = <a-v>edge_foreground</a-v> <a-cr>}</a-cr> <a-cr>}</a-cr><a-p>,</a-p>
      <a-cr>{</a-cr> <a-v>Text</a-v> = <a-co>SOLID_LEFT_ARROW</a-co> <a-cr>}</a-cr><a-p>,</a-p>
      <a-cr>{</a-cr> <a-v>Background</a-v> = <a-cr>{</a-cr> <a-v>Color</a-v> = <a-v>background</a-v> <a-cr>}</a-cr> <a-cr>}</a-cr><a-p>,</a-p>
      <a-cr>{</a-cr> <a-v>Foreground</a-v> = <a-cr>{</a-cr> <a-v>Color</a-v> = <a-v>foreground</a-v> <a-cr>}</a-cr> <a-cr>}</a-cr><a-p>,</a-p>
      <a-cr>{</a-cr> <a-v>Text</a-v> = <a-v>title</a-v> <a-cr>}</a-cr><a-p>,</a-p>
      <a-cr>{</a-cr> <a-v>Background</a-v> = <a-cr>{</a-cr> <a-v>Color</a-v> = <a-v>edge_background</a-v> <a-cr>}</a-cr> <a-cr>}</a-cr><a-p>,</a-p>
      <a-cr>{</a-cr> <a-v>Foreground</a-v> = <a-cr>{</a-cr> <a-v>Color</a-v> = <a-v>edge_foreground</a-v> <a-cr>}</a-cr> <a-cr>}</a-cr><a-p>,</a-p>
      <a-cr>{</a-cr> <a-v>Text</a-v> = <a-co>SOLID_RIGHT_ARROW</a-co> <a-cr>}</a-cr><a-p>,</a-p>
    <a-cr>}</a-cr>
  <a-k>end</a-k>
<a-p>)</a-p>

<a-k>return</a-k> <a-cr>{}</a-cr></pre>
</section><div class="code-panel"><pre class="code src language-markdown"><span class="code-line"><a class="ln" id="L1" href="#L1">1</a><span class="code-text"><a-p>#</a-p> <a-tt>`format-tab-title`</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L2" href="#L2">2</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L3" href="#L3">3</a><span class="code-text">{{since(&#39;20210502-130208-bff6815d&#39;)}}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L4" href="#L4">4</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L5" href="#L5">5</a><span class="code-text">The `format-tab-title` event is emitted when the text for a tab title</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L6" href="#L6">6</a><span class="code-text">needs to be recomputed.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L7" href="#L7">7</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L8" href="#L8">8</a><span class="code-text">This event is a bit special in that it is *synchronous* and must return as</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L9" href="#L9">9</a><span class="code-text">quickly as possible in order to avoid blocking the GUI thread.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L10" href="#L10">10</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L11" href="#L11">11</a><span class="code-text">The most notable consequence of this is that some functions that are</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L12" href="#L12">12</a><span class="code-text">asynchronous (such as</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L13" href="#L13">13</a><span class="code-text">[wezterm.run_child_process](../wezterm/run_child_process.md)) are not possible</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L14" href="#L14">14</a><span class="code-text">to call from inside the event handler and will generate a `format-tab-title:</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L15" href="#L15">15</a><span class="code-text">runtime error: attempt to yield from outside a coroutine` error.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L16" href="#L16">16</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L17" href="#L17">17</a><span class="code-text">This example overrides the default tab title so that the background color</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L18" href="#L18">18</a><span class="code-text">is blue for the active tab.  This is partially redundant because there is</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L19" href="#L19">19</a><span class="code-text">already configuration for this in [tab_bar_style](../config/tab_bar_style.md),</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L20" href="#L20">20</a><span class="code-text">but it demonstrates that it is possible to format more than just the text</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L21" href="#L21">21</a><span class="code-text">shown in the tab.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L22" href="#L22">22</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L23" href="#L23">23</a><span class="code-text"><a-p>```</a-p><a-tl>lua</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L24" href="#L24">24</a><span class="code-text"><a-p>-- This function returns the suggested title for a tab.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L25" href="#L25">25</a><span class="code-text"><a-p>-- It prefers the title that was set via `tab:set_title()`</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L26" href="#L26">26</a><span class="code-text"><a-p>-- or `wezterm cli set-tab-title`, but falls back to the</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L27" href="#L27">27</a><span class="code-text"><a-p>-- title of the active pane in that tab.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L28" href="#L28">28</a><span class="code-text"><a-p>function </a-p><a-f>tab_title</a-f><a-p>(</a-p><a-v>tab_info</a-v><a-p>)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L29" href="#L29">29</a><span class="code-text"><a-p>  </a-p><a-k>local</a-k><a-p> </a-p><a-v>title</a-v><a-p> = </a-p><a-v>tab_info</a-v><a-p>.</a-p><a-v>tab_title</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L30" href="#L30">30</a><span class="code-text"><a-p>  </a-p><a-c>-- if the tab title is explicitly set, take that</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L31" href="#L31">31</a><span class="code-text"><a-p>  </a-p><a-k>if</a-k><a-p> </a-p><a-v>title</a-v><a-p> </a-p><a-k>and</a-k><a-p> </a-p><a-o>#</a-o><a-v>title</a-v><a-p> </a-p><a-o>&gt;</a-o><a-p> </a-p><a-n>0</a-n><a-p> </a-p><a-k>then</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L32" href="#L32">32</a><span class="code-text"><a-p>    </a-p><a-k>return</a-k><a-p> </a-p><a-v>title</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L33" href="#L33">33</a><span class="code-text"><a-p>  </a-p><a-k>end</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L34" href="#L34">34</a><span class="code-text"><a-p>  </a-p><a-c>-- Otherwise, use the title from the active pane</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L35" href="#L35">35</a><span class="code-text"><a-p>  </a-p><a-c>-- in that tab</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L36" href="#L36">36</a><span class="code-text"><a-p>  </a-p><a-k>return</a-k><a-p> </a-p><a-v>tab_info</a-v><a-p>.</a-p><a-v>active_pane</a-v><a-p>.</a-p><a-v>title</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L37" href="#L37">37</a><span class="code-text"><a-p>end</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L38" href="#L38">38</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L39" href="#L39">39</a><span class="code-text"><a-p>wezterm.</a-p><a-f>on</a-f><a-p>(</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L40" href="#L40">40</a><span class="code-text"><a-p>  </a-p><a-s>&#39;format-tab-title&#39;</a-s><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L41" href="#L41">41</a><span class="code-text"><a-p>  </a-p><a-k>function</a-k><a-p>(</a-p><a-v>tab</a-v><a-p>, </a-p><a-v>tabs</a-v><a-p>, </a-p><a-v>panes</a-v><a-p>, </a-p><a-v>config</a-v><a-p>, </a-p><a-v>hover</a-v><a-p>, </a-p><a-v>max_width</a-v><a-p>)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L42" href="#L42">42</a><span class="code-text"><a-p>    </a-p><a-k>local</a-k><a-p> </a-p><a-v>title</a-v><a-p> = </a-p><a-f>tab_title</a-f><a-p>(</a-p><a-v>tab</a-v><a-p>)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L43" href="#L43">43</a><span class="code-text"><a-p>    </a-p><a-k>if</a-k><a-p> </a-p><a-v>tab</a-v><a-p>.</a-p><a-v>is_active</a-v><a-p> </a-p><a-k>then</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L44" href="#L44">44</a><span class="code-text"><a-p>      </a-p><a-k>return</a-k><a-p> </a-p><a-cr>{</a-cr></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L45" href="#L45">45</a><span class="code-text"><a-p>        </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Background</a-v><a-p> = </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Color</a-v><a-p> = </a-p><a-s>&#39;blue&#39;</a-s><a-p> </a-p><a-cr>}</a-cr><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L46" href="#L46">46</a><span class="code-text"><a-p>        </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Text</a-v><a-p> = </a-p><a-s>&#39; &#39;</a-s><a-p> </a-p><a-o>..</a-o><a-p> </a-p><a-v>title</a-v><a-p> </a-p><a-o>..</a-o><a-p> </a-p><a-s>&#39; &#39;</a-s><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L47" href="#L47">47</a><span class="code-text"><a-p>      </a-p><a-cr>}</a-cr></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L48" href="#L48">48</a><span class="code-text"><a-p>    </a-p><a-k>end</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L49" href="#L49">49</a><span class="code-text"><a-p>    </a-p><a-k>return</a-k><a-p> </a-p><a-v>title</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L50" href="#L50">50</a><span class="code-text"><a-p>  </a-p><a-k>end</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L51" href="#L51">51</a><span class="code-text"><a-p>)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L52" href="#L52">52</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L53" href="#L53">53</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L54" href="#L54">54</a><span class="code-text"><a-p>The parameters to the event are:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L55" href="#L55">55</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L56" href="#L56">56</a><span class="code-text"><a-p>* `tab` - the [TabInformation](../TabInformation.md) for the active tab</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L57" href="#L57">57</a><span class="code-text"><a-p>* `tabs` - an array containing [TabInformation](../TabInformation.md) for each of the tabs in the window</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L58" href="#L58">58</a><span class="code-text"><a-p>* `panes` - an array containing [PaneInformation](../PaneInformation.md) for each of the panes in the active tab</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L59" href="#L59">59</a><span class="code-text"><a-p>* `config` - the effective configuration for the window</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L60" href="#L60">60</a><span class="code-text"><a-p>* `hover` - true if the current tab is in the hover state</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L61" href="#L61">61</a><span class="code-text"><a-p>* `max_width` - the maximum number of cells available to draw this tab when using the retro tab bar style.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L62" href="#L62">62</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L63" href="#L63">63</a><span class="code-text"><a-p>The return value of the event can be:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L64" href="#L64">64</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L65" href="#L65">65</a><span class="code-text"><a-p>* a string, holding the text to use for the tab title</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L66" href="#L66">66</a><span class="code-text"><a-p>* a table holding `FormatItem`s as used in the [wezterm.format](../wezterm/format.md) function.  This allows formatting style and color information for individual elements within the tab.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L67" href="#L67">67</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L68" href="#L68">68</a><span class="code-text"><a-p>If the event encounters an error, or returns something that is not one of the</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L69" href="#L69">69</a><span class="code-text"><a-p>types mentioned above, then the default tab title text will be computed and</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L70" href="#L70">70</a><span class="code-text"><a-p>used instead.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L71" href="#L71">71</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L72" href="#L72">72</a><span class="code-text"><a-p>When the tab bar is computed, this event is called twice for each tab;</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L73" href="#L73">73</a><span class="code-text"><a-p>on the first pass, `hover` will be `false` and `max_width` will be set</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L74" href="#L74">74</a><span class="code-text"><a-p>to [tab_max_width](../config/tab_max_width.md).  WezTerm will then compute</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L75" href="#L75">75</a><span class="code-text"><a-p>the tab widths that will fit in the tab bar, and then call the event again</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L76" href="#L76">76</a><span class="code-text"><a-p>for the set of tabs, this time with appropriate `hover` and `max_width`</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L77" href="#L77">77</a><span class="code-text"><a-p>values.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L78" href="#L78">78</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L79" href="#L79">79</a><span class="code-text"><a-p>Only the first `format-tab-title` event will be executed; it doesn&#39;t make</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L80" href="#L80">80</a><span class="code-text"><a-p>sense to define multiple instances of the event with multiple</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L81" href="#L81">81</a><span class="code-text"><a-p>`wezterm.on(&quot;format-tab-title&quot;, ...)` calls.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L82" href="#L82">82</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L83" href="#L83">83</a><span class="code-text"><a-p>A more elaborate example:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L84" href="#L84">84</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L85" href="#L85">85</a><span class="code-text"><a-p>```</a-p><a-tl>lua</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L86" href="#L86">86</a><span class="code-text"><a-p>local </a-p><a-v>wezterm</a-v><a-p> = </a-p><a-f>require</a-f><a-p> </a-p><a-s>&#39;wezterm&#39;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L87" href="#L87">87</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L88" href="#L88">88</a><span class="code-text"><a-p>-- The filled in variant of the &lt; symbol</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L89" href="#L89">89</a><span class="code-text"><a-p>local </a-p><a-co>SOLID_LEFT_ARROW</a-co><a-p> = </a-p><a-v>wezterm</a-v><a-p>.</a-p><a-v>nerdfonts</a-v><a-p>.</a-p><a-v>pl_right_hard_divider</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L90" href="#L90">90</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L91" href="#L91">91</a><span class="code-text"><a-p>-- The filled in variant of the &gt; symbol</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L92" href="#L92">92</a><span class="code-text"><a-p>local </a-p><a-co>SOLID_RIGHT_ARROW</a-co><a-p> = </a-p><a-v>wezterm</a-v><a-p>.</a-p><a-v>nerdfonts</a-v><a-p>.</a-p><a-v>pl_left_hard_divider</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L93" href="#L93">93</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L94" href="#L94">94</a><span class="code-text"><a-p>-- This function returns the suggested title for a tab.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L95" href="#L95">95</a><span class="code-text"><a-p>-- It prefers the title that was set via `tab:set_title()`</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L96" href="#L96">96</a><span class="code-text"><a-p>-- or `wezterm cli set-tab-title`, but falls back to the</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L97" href="#L97">97</a><span class="code-text"><a-p>-- title of the active pane in that tab.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L98" href="#L98">98</a><span class="code-text"><a-p>function </a-p><a-f>tab_title</a-f><a-p>(</a-p><a-v>tab_info</a-v><a-p>)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L99" href="#L99">99</a><span class="code-text"><a-p>  </a-p><a-k>local</a-k><a-p> </a-p><a-v>title</a-v><a-p> = </a-p><a-v>tab_info</a-v><a-p>.</a-p><a-v>tab_title</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L100" href="#L100">100</a><span class="code-text"><a-p>  </a-p><a-c>-- if the tab title is explicitly set, take that</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L101" href="#L101">101</a><span class="code-text"><a-p>  </a-p><a-k>if</a-k><a-p> </a-p><a-v>title</a-v><a-p> </a-p><a-k>and</a-k><a-p> </a-p><a-o>#</a-o><a-v>title</a-v><a-p> </a-p><a-o>&gt;</a-o><a-p> </a-p><a-n>0</a-n><a-p> </a-p><a-k>then</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L102" href="#L102">102</a><span class="code-text"><a-p>    </a-p><a-k>return</a-k><a-p> </a-p><a-v>title</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L103" href="#L103">103</a><span class="code-text"><a-p>  </a-p><a-k>end</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L104" href="#L104">104</a><span class="code-text"><a-p>  </a-p><a-c>-- Otherwise, use the title from the active pane</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L105" href="#L105">105</a><span class="code-text"><a-p>  </a-p><a-c>-- in that tab</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L106" href="#L106">106</a><span class="code-text"><a-p>  </a-p><a-k>return</a-k><a-p> </a-p><a-v>tab_info</a-v><a-p>.</a-p><a-v>active_pane</a-v><a-p>.</a-p><a-v>title</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L107" href="#L107">107</a><span class="code-text"><a-p>end</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L108" href="#L108">108</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L109" href="#L109">109</a><span class="code-text"><a-p>wezterm.</a-p><a-f>on</a-f><a-p>(</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L110" href="#L110">110</a><span class="code-text"><a-p>  </a-p><a-s>&#39;format-tab-title&#39;</a-s><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L111" href="#L111">111</a><span class="code-text"><a-p>  </a-p><a-k>function</a-k><a-p>(</a-p><a-v>tab</a-v><a-p>, </a-p><a-v>tabs</a-v><a-p>, </a-p><a-v>panes</a-v><a-p>, </a-p><a-v>config</a-v><a-p>, </a-p><a-v>hover</a-v><a-p>, </a-p><a-v>max_width</a-v><a-p>)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L112" href="#L112">112</a><span class="code-text"><a-p>    </a-p><a-k>local</a-k><a-p> </a-p><a-v>edge_background</a-v><a-p> = </a-p><a-s>&#39;#0b0022&#39;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L113" href="#L113">113</a><span class="code-text"><a-p>    </a-p><a-k>local</a-k><a-p> </a-p><a-v>background</a-v><a-p> = </a-p><a-s>&#39;#1b1032&#39;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L114" href="#L114">114</a><span class="code-text"><a-p>    </a-p><a-k>local</a-k><a-p> </a-p><a-v>foreground</a-v><a-p> = </a-p><a-s>&#39;#808080&#39;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L115" href="#L115">115</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L116" href="#L116">116</a><span class="code-text"><a-p>    </a-p><a-k>if</a-k><a-p> </a-p><a-v>tab</a-v><a-p>.</a-p><a-v>is_active</a-v><a-p> </a-p><a-k>then</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L117" href="#L117">117</a><span class="code-text"><a-p>      </a-p><a-v>background</a-v><a-p> = </a-p><a-s>&#39;#2b2042&#39;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L118" href="#L118">118</a><span class="code-text"><a-p>      </a-p><a-v>foreground</a-v><a-p> = </a-p><a-s>&#39;#c0c0c0&#39;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L119" href="#L119">119</a><span class="code-text"><a-p>    </a-p><a-k>elseif</a-k><a-p> </a-p><a-v>hover</a-v><a-p> </a-p><a-k>then</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L120" href="#L120">120</a><span class="code-text"><a-p>      </a-p><a-v>background</a-v><a-p> = </a-p><a-s>&#39;#3b3052&#39;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L121" href="#L121">121</a><span class="code-text"><a-p>      </a-p><a-v>foreground</a-v><a-p> = </a-p><a-s>&#39;#909090&#39;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L122" href="#L122">122</a><span class="code-text"><a-p>    </a-p><a-k>end</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L123" href="#L123">123</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L124" href="#L124">124</a><span class="code-text"><a-p>    </a-p><a-k>local</a-k><a-p> </a-p><a-v>edge_foreground</a-v><a-p> = </a-p><a-v>background</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L125" href="#L125">125</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L126" href="#L126">126</a><span class="code-text"><a-p>    </a-p><a-k>local</a-k><a-p> </a-p><a-v>title</a-v><a-p> = </a-p><a-f>tab_title</a-f><a-p>(</a-p><a-v>tab</a-v><a-p>)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L127" href="#L127">127</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L128" href="#L128">128</a><span class="code-text"><a-p>    </a-p><a-c>-- ensure that the titles fit in the available space,</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L129" href="#L129">129</a><span class="code-text"><a-p>    </a-p><a-c>-- and that we have room for the edges.</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L130" href="#L130">130</a><span class="code-text"><a-p>    </a-p><a-v>title</a-v><a-p> = </a-p><a-v>wezterm</a-v><a-p>.</a-p><a-f>truncate_right</a-f><a-p>(</a-p><a-v>title</a-v><a-p>, </a-p><a-v>max_width</a-v><a-p> </a-p><a-o>-</a-o><a-p> </a-p><a-n>2</a-n><a-p>)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L131" href="#L131">131</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L132" href="#L132">132</a><span class="code-text"><a-p>    </a-p><a-k>return</a-k><a-p> </a-p><a-cr>{</a-cr></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L133" href="#L133">133</a><span class="code-text"><a-p>      </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Background</a-v><a-p> = </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Color</a-v><a-p> = </a-p><a-v>edge_background</a-v><a-p> </a-p><a-cr>}</a-cr><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L134" href="#L134">134</a><span class="code-text"><a-p>      </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Foreground</a-v><a-p> = </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Color</a-v><a-p> = </a-p><a-v>edge_foreground</a-v><a-p> </a-p><a-cr>}</a-cr><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L135" href="#L135">135</a><span class="code-text"><a-p>      </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Text</a-v><a-p> = </a-p><a-co>SOLID_LEFT_ARROW</a-co><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L136" href="#L136">136</a><span class="code-text"><a-p>      </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Background</a-v><a-p> = </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Color</a-v><a-p> = </a-p><a-v>background</a-v><a-p> </a-p><a-cr>}</a-cr><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L137" href="#L137">137</a><span class="code-text"><a-p>      </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Foreground</a-v><a-p> = </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Color</a-v><a-p> = </a-p><a-v>foreground</a-v><a-p> </a-p><a-cr>}</a-cr><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L138" href="#L138">138</a><span class="code-text"><a-p>      </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Text</a-v><a-p> = </a-p><a-v>title</a-v><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L139" href="#L139">139</a><span class="code-text"><a-p>      </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Background</a-v><a-p> = </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Color</a-v><a-p> = </a-p><a-v>edge_background</a-v><a-p> </a-p><a-cr>}</a-cr><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L140" href="#L140">140</a><span class="code-text"><a-p>      </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Foreground</a-v><a-p> = </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Color</a-v><a-p> = </a-p><a-v>edge_foreground</a-v><a-p> </a-p><a-cr>}</a-cr><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L141" href="#L141">141</a><span class="code-text"><a-p>      </a-p><a-cr>{</a-cr><a-p> </a-p><a-v>Text</a-v><a-p> = </a-p><a-co>SOLID_RIGHT_ARROW</a-co><a-p> </a-p><a-cr>}</a-cr><a-p>,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L142" href="#L142">142</a><span class="code-text"><a-p>    </a-p><a-cr>}</a-cr></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L143" href="#L143">143</a><span class="code-text"><a-p>  </a-p><a-k>end</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L144" href="#L144">144</a><span class="code-text"><a-p>)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L145" href="#L145">145</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L146" href="#L146">146</a><span class="code-text"><a-p>return </a-p><a-cr>{}</a-cr></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L147" href="#L147">147</a><span class="code-text"><a-p>```</a-p></span></span></pre></div></div>
</main>
</body>
</html>
