---
layout: post
title: 'Support to tabs, custom key bindings, performance improvements and other updates'
date: 2023-08-02 12:34
description: 'Support to tabs, custom key bindings, performance improvements, color automation for tabs, binary size optimization, bug fixes and other updates.'
categories: windows macos linux webassembly
---

import { Tweet } from 'react-tweet';

This post also includes changes from v0.0.13 and v0.0.12.

## Highlights

- Navigation.
- Custom key bindings.
- Performance updates.
- Color automation for tabs.

## Navigation

Rio allows to choose navigation between the following options:

- `CollapsedTab`
- `BottomTab`
- `TopTab`
- `Breadcrumb`

You can set the navigation mode in the configuration file. An example of configuration:

```toml
[navigation]
mode = "BottomTab"
use-current-path = true
clickable = false
```

Note: BottomTab and TopTab does not support click mode yet.

Below some images with different navigation setups:

- First image: BottomTab navigation x11.
- Second image: TopTav navigation wayland.

![example navigation x11](/assets/posts/0.0.15/demo-navigation-x11.png)

![second example navigation Wayland](/assets/posts/0.0.15/demo-navigation-wayland.png)

- First image: Breadcrumb navigation macos.
- Second image: BottomTab navigation macos.

![example breadcrumb navigation macos](/assets/features/demo-breadcrumb.png)

![example BottomTab navigation macos](/assets/features/demo-bottom-tab.png)

More info about navigation in [docs/navigation](/docs/navigation/).

## Sugarloaf performance improvements

Performance improvements with Sugarloaf de-duplication of input data.

Before an average sugarloaf.stack call would cost around "~253.5µs" and now it does cost an average of "~51.5µs".

The algorithm is effective whenever the terminal has a lot of repetition like empty spaces. The benchmark test below was made rendering 100.000 characters that had repetition:

![second example navigation Wayland](/assets/posts/0.0.15/de-duplication-sugarloaf.jpg)

The de-duplication algorithm in the renderer considerably reduced the initial rendering time from avg **6ms to 2ms** and using Rio in a large screen (>=136 columns) has dropped from **36ms to 8ms**.

Tweet reference:

<Tweet id="1685612156773961728" />

## Color automation for navigation

Rio allows to specify color overwrites for tabs based on program context.

The example below sets `#FFFF00` as color background whenever `nvim` is running.

![example navigation with color automation](/assets/features/demo-colorized-navigation.png)
![second example navigation with color automation](/assets/features/demo-colorized-navigation-2.png)

The configuration would be like:

```toml
[navigation]
color-automation = [
  { program = "nvim", color = "#FFFF00" }
]
```

## Custom key bindings

Now you can configure custom key bindings for Rio terminal.

Below an example of two custom key bindings:

```toml
[bindings]
keys = [
  { key = "q", with = "super", action = "Quit" }
  # Bytes[27, 91, 53, 126] is equivalent to "\x1b[5~"
  { key = "home", with = "super | shift", bytes = [27, 91, 53, 126] }
]
```

For example, in the first binding will tell Rio to close the terminal every time that "q" key is pressed along with "super" (in MacOS the "super" key is "command").

More info about custom key bindings in [docs/default-key-bindings](/docs/default-key-bindings/).

## Changelog of v0.0.15 along with 0.0.13 and 0.0.12

- Introduce configurable navigation with the following options: "CollapsedTab" (default), "Breadcrumb", "TopTab" and "BottomTab".
- Performance improvements with Sugarloaf de-duplication of input data. Before: "~253.5µs" and now "~51.5µs".
- Introduce "navigation.use-current-path" which sets if a tab/breacrumb should be open from the current context path.
- Fix rendering unicode with 1 width glyphs (fix [#160](https://github.com/raphamorim/rio/issues/160)).
- Increased max tabs from 9 to 72.
- Default colors "selection-foreground" and "selection-background" has changed.
- Default colors "tab" and "tab-active" has changed.
- Implementation of custom key bindings ([#117](https://github.com/raphamorim/rio/issues/117)).
- Fix .deb packing in GH Actions.
- Fix key binding for switch tab next (MacOS only).
- Fix scroll when copying text outside of offset.
- Fix copy key bindings.
- Fix Fuzzy Finder issue ([#132](https://github.com/raphamorim/rio/issues/132)).
- Introduce Copa (Alacritty's VTE forked version to introduce new sequences/instructions in next versions).
- Upgraded Winit to 0.29.0-beta.0
- Support for keybindings with dead keys.
- "Back"/"Forward" mouse buttons support in bindings.
- Fix unconditional query of xdg-portal settings on Wayland
- Fix "Maximized" startup mode not filling the screen properly on GNOME Wayland.
- Fix Default Vi key bindings for "Last"/"First" actions not working on X11/Wayland.
- Set "padding-x" to 0 for non-macos.
- Set "app_id"/"WM_CLASS" property on Wayland/X11.
- Strip binary is on for release builds.
- Each paste or key binding that has writing leads to clear selection and scroll bottom.
- Fixed over-rendering when scrolling.
- Fix selection.
- Support to copy using VIM.
- Fix for MacOS deadzone changing cursor to draggable on window buttons.
- Fix for scroll using tmux.
