kitty 0.50.0

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

kitty 0.50.0

Changelog¶ kitty is a feature-rich, cross-platform, fast, GPU based terminal. To update kitty, follow the instructions. Recent major new features¶ Choose an edge when resizing [unreleased]¶ The resize page now offers two strategies: Window retains the usual width/height controls, while Edge lets you choose an internal pane edge in the Splits layout and move its divider in a physical direction. Press H to select the middle pane’s left edge. Gray edges are outside the layout and cannot be selected.¶

更新日志¶ kitty 是一款功能丰富、跨平台、快速且基于 GPU 的终端。要更新 kitty,请遵循相关说明。近期主要新功能¶ 调整大小时选择边缘 [未发布]¶ 调整大小页面现在提供两种策略:Window 保留通常的宽度/高度控制,而 Edge 允许您在拆分布局中选择内部窗格边缘,并沿物理方向移动其分隔线。按 H 可选择中间窗格的左边缘。灰色边缘位于布局之外,无法被选中。¶

After selecting H, Alt+H moves the left divider by one third of the remaining resize steps. The right divider stays in place.¶ Switch strategies with 1/2 inside the page. Each strategy remembers its own Alt/Shift modifier and fraction, configurable with M and F. A sole internal edge is selected automatically. In Splits, either strategy uses R to restore the proportions saved when resize mode opened. See Resizing windows for the controls and configuration options. Custom shaders [0.49]¶ kitty now has official support for Custom Shaders. These can be used for all manner of graphical effects, from animated backgrounds to focus highlighting to animations that change how cursor movements or mouse clicks are visualised. See the documentation for a video gallery showcasing various custom shaders that ship with kitty.¶

选中 H 后,Alt+H 可将左侧分隔线移动剩余调整步长的三分之一。右侧分隔线保持不动。¶ 在页面内使用 1/2 切换策略。每种策略都会记住其各自的 Alt/Shift 修饰键和比例,可通过 M 和 F 进行配置。单个内部边缘会自动被选中。在拆分布局中,两种策略均可使用 R 恢复进入调整模式时保存的比例。有关控件和配置选项,请参阅“调整窗口大小”。自定义着色器 [0.49]¶ kitty 现在正式支持自定义着色器。它们可用于各种图形效果,从动画背景到焦点高亮,再到改变光标移动或鼠标点击可视化方式的动画。请参阅文档中的视频库,查看 kitty 自带的各种自定义着色器。¶

Performance improvements [0.49]¶ This release saw tons of performance work focused on improving throughput making kitty even faster than it already is. Real world effective throughput should see a 15-35% improvement depending on workload. Some details: Improve throughput when processing large amounts of text with a scrollback buffer much larger than the CPU cache by ~35% by prefetching scrollback memory before it is written to Improve throughput when processing large amounts of text by ~50% for ASCII and ~15% for Unicode by writing runs of plain ASCII chars to the screen in batches and skipping unnecessary bookkeeping in the scrolling and tab handling hot paths Speed up SIMD UTF-8 decoding: ~20% faster for ASCII and ~50% faster for multi-byte text on both x86 and ARM, by processing pairs of vectors of plain ASCII text at a time and compacting decoded codepoints within 128-bit lanes, avoiding expensive cross-lane operations. Also add an AVX-512 based decoder, another ~75% faster for multi-byte text, used automatically on CPUs that support it (Intel Ice Lake+, AMD Zen 4+). Improve throughput when processing escape code heavy input by ~30% by taking the input buffer lock once per buffer of input rather than once per escape code and using cheaper arithmetic to parse CSI parameters Improve throughput when processing large amounts of plain text by another ~10% by finding runs of printable ASCII chars with SIMD, filling cells using wide stores and skipping unnecessary work in the scrolling hot path when there are no images Speed up pixel compositing with SIMD vectorization: alpha blending of graphics protocol images and animation frames is 2-3.5x faster and glyph alpha masks are composited onto canvases using the same vectorized primitives. Cache HarfBuzz results for repeated short runs (≤32 cells) so redraws of the same on-screen text are not reshaped¶

性能改进 [0.49]¶ 此版本进行了大量性能优化工作,旨在提高吞吐量,使 kitty 比以往更快。根据工作负载的不同,实际有效吞吐量应有 15-35% 的提升。部分细节:通过在写入前预取回滚内存,处理远大于 CPU 缓存的回滚缓冲区时,处理大量文本的吞吐量提高了约 35%;通过批量将纯 ASCII 字符写入屏幕并跳过滚动和标签处理热路径中不必要的簿记工作,处理大量文本时 ASCII 的吞吐量提高了约 50%,Unicode 提高了约 15%;加速 SIMD UTF-8 解码:在 x86 和 ARM 上,通过一次处理成对的纯 ASCII 文本向量并在 128 位通道内压缩解码后的码点,避免了昂贵的跨通道操作,ASCII 速度提升约 20%,多字节文本速度提升约 50%。此外还增加了基于 AVX-512 的解码器,多字节文本速度进一步提升约 75%,并在支持该指令集的 CPU(Intel Ice Lake+,AMD Zen 4+)上自动使用;通过每个输入缓冲区仅获取一次输入缓冲区锁(而非每个转义码获取一次)并使用更廉价的算术运算来解析 CSI 参数,处理包含大量转义码的输入时吞吐量提高了约 30%;通过使用 SIMD 查找可打印 ASCII 字符序列、使用宽存储填充单元格并在没有图像时跳过滚动热路径中的不必要工作,处理大量纯文本时的吞吐量又提高了约 10%;通过 SIMD 向量化加速像素合成:图形协议图像和动画帧的 Alpha 混合速度提高了 2-3.5 倍,字形 Alpha 遮罩使用相同的向量化原语合成到画布上;缓存重复短序列(≤32 个单元格)的 HarfBuzz 结果,从而无需对屏幕上相同的文本进行重排。¶

Vertical tabs [0.48]¶ kitty now has support for vertical tabs along the left or right edge of the OS Window. Useful for people that have wide aspect ratio windows. Drag and drop for terminal programs [0.47]¶ kitty now has a new Drag and Drop kitten that allows you to seamlessly drag and drop files between kitty and any GUI program like the OS file manager or a webapp. It even works over SSH! It is powered by a new protocol allowing the use of drag and drop from any TUI program. Mousing [0.46]¶ kitty already had excellent mouse support, but now it is taking it to the next level. The kitty scrollback buffer grew support for smooth scrolling and momentum based scrolling for a natural, smooth and kinetic scrolling experience. Additionally, you can now drag kitty tabs around with the mouse to re-order them, move them to another kitty OS Window or even detach them into their own OS Window. Finally, a long requested feature, the ability to resize kitty windows (aka splits) with the mouse was implemented.¶

垂直标签页 [0.48]¶ kitty 现在支持沿操作系统窗口左侧或右侧边缘放置垂直标签页。对于拥有宽屏比例窗口的用户非常有用。终端程序的拖放功能 [0.47]¶ kitty 现在拥有一个新的拖放 kitten,允许您在 kitty 与任何 GUI 程序(如操作系统文件管理器或 Web 应用)之间无缝拖放文件。它甚至可以通过 SSH 工作!它由一种新协议驱动,允许从任何 TUI 程序使用拖放功能。鼠标支持 [0.46]¶ kitty 本身已经具备出色的鼠标支持,但现在它更上一层楼。kitty 回滚缓冲区增加了对平滑滚动和基于动量的滚动的支持,带来自然、流畅且具有动感的滚动体验。此外,您现在可以用鼠标拖动 kitty 标签页来重新排序、将它们移动到另一个 kitty 操作系统窗口,甚至将它们分离成独立的操作系统窗口。最后,实现了一项长期被要求的功能:使用鼠标调整 kitty 窗口(即拆分窗口)大小的能力。¶

Choose files, fast [0.45]¶ A new kitten to select files at the speed of thought with a keyboard first interface and support for content previews of text files with syntax highlighting, images, videos, e-books and more. Allows you to select files for use at the shell prompt or other terminal workflows with just a few keystrokes, similar to how fuzzy finders like fzf operate, but designed for files in particular, leveraging the various innovations of kitty such as image display and variable sized text. On Linux, it can even be used as a drop in replacement for the File Open/Save dialog boxes in GUI programs. Sessions [0.43]¶ kitty has long had support for Sessions, aka simple text files where you can define what tabs, windows and programs you wish to run in kitty. Now in addition to that kitty has the ability to create and switch between sessions with a single keypress and also to manually setup some tabs/windows in kitty and save it as a session file, for seamless and intuitive session file creation. A scrollbar for the kitty scrollback [0.43]¶ A long requested feature, kitty has finally gotten a scrollbar that can be used with the mouse for browsing its scrollback. The bar appear automatically when you start scrolling backwards and is extensively configurable in kitty.conf. Note that the old scrollback_indicator_opacity option is deprecated. Multiple cursors [0.43]¶ kitty has pioneered a new escape code protocol that allows terminal applications to use multiple cursors, rendered natively. These are typically used in editors to make the same edit at multiple locations. Now terminal based editors can use properly rendered native cursors, just like their GUI cousins, at last. Access kitty with a single keypress [0.42]¶ kitty now has a Quake like floating, t¶

快速选择文件 [0.45]¶ 一个新的 kitten,以思维般的速度选择文件,采用键盘优先界面,并支持文本文件内容预览(带语法高亮)、图像、视频、电子书等。只需几次按键即可选择文件以供 shell 提示符或其他终端工作流使用,类似于 fzf 等模糊查找器的操作方式,但专门针对文件设计,利用了 kitty 的各种创新功能,如图像显示和可变大小文本。在 Linux 上,它甚至可以作为 GUI 程序中“打开/保存文件”对话框的直接替代品。会话 [0.43]¶ kitty 长期以来一直支持会话,即简单的文本文件,您可以在其中定义希望在 kitty 中运行的标签页、窗口和程序。现在,除了这些功能外,kitty 还能够通过单次按键创建和切换会话,并允许手动设置 kitty 中的某些标签页/窗口并将其保存为会话文件,从而实现无缝且直观的会话文件创建。kitty 回滚的滚动条 [0.43]¶ 一项长期被要求的功能,kitty 终于拥有了一个可以用鼠标操作的滚动条,用于浏览回滚内容。当您开始向后滚动时,该滚动条会自动出现,并且可以在 kitty.conf 中进行广泛配置。请注意,旧的 scrollback_indicator_opacity 选项已被弃用。多光标 [0.43]¶ kitty 开创了一种新的转义码协议,允许终端应用程序使用原生渲染的多光标。这些通常用于编辑器中,以便在多个位置进行相同的编辑。现在,基于终端的编辑器终于可以像 GUI 编辑器一样使用正确渲染的原生光标了。通过单次按键访问 kitty [0.42]¶ kitty 现在拥有一个类似 Quake 的浮动、t¶