12 Commits
Author SHA1 Message Date
BlackAngelTV 1b9e076139 Merge pull request 'feat(file-manager): handle the wheel, double clicks and right clicks' (#57) from feat/file-manager-mouse into main
CI / check (push) Successful in 2m14s
Release / release (push) Successful in 5m12s
2026-12-03 10:23:10 +01:00
BlackAngelTV e1cce67221 chore(release): bump the fork version to 0.1.15
CI / check (pull_request) Successful in 3m55s
The file manager gained mouse support, so cut a patch release. All the version
copies must agree for the packaging workflow.
2026-12-03 10:23:04 +01:00
BlackAngelTV 406bd726e2 feat(file-manager): handle the wheel, double clicks and right clicks
The panel only reacted to a left click on a row, so every other gesture was
keyboard-only: the wheel did nothing, a double click did not open the entry and
there was no way to reach the actions from the pointer. The wheel now steps the
selection by three rows without leaking the event to the hosting terminal, a
second click on the same row within kitty's click interval runs the primary
action, and a right click opens the action palette on the clicked row.

Fixes #47
2026-12-03 10:23:04 +01:00
BlackAngelTV 271babc8f1 Merge pull request 'fix(shortcuts): stop the shortcuts panel shadowing show_scrollback' (#56) from fix/help-shortcut-docs into main
CI / check (push) Canceled after 0s
Release / release (push) Canceled after 0s
2026-12-03 10:21:42 +01:00
BlackAngelTV 6e60b16e36 chore(release): bump the fork version to 0.1.14
CI / check (pull_request) Failing after 5m24s
The default shortcut of the shortcuts panel changed, so cut a patch release.
All the version copies must agree for the packaging workflow.
2026-12-03 10:21:39 +01:00
BlackAngelTV 365873b9bb fix(shortcuts): stop the shortcuts panel shadowing show_scrollback
The panel was bound to kitty_mod+h, the trigger upstream gives show_scrollback,
so the last definition won: Ctrl+Shift+H stopped browsing the scrollback in a
pager while the docs and the built-in help still announced that behavior. The
panel now uses kitty_mod+alt+h and the documentation follows, with a test that
fails when two default actions claim the same trigger.

Fixes #46
2026-12-03 10:21:38 +01:00
BlackAngelTV b994ccffce Merge pull request 'fix(search): give the in-place search a usable shortcut' (#55) from fix/search-shortcut into main
CI / check (push) Canceled after 0s
Release / release (push) Canceled after 0s
2026-12-03 10:21:04 +01:00
BlackAngelTV 474f1c0568 chore(release): bump the fork version to 0.1.13
CI / check (pull_request) Successful in 6m22s
The default shortcut of the in-place search changed, so cut a patch release.
All the version copies must agree for the packaging workflow.
2026-12-03 10:21:00 +01:00
BlackAngelTV 17462f5198 fix(search): give the in-place search a usable shortcut
kitty_mod+shift+f is the same physical key as kitty_mod+f, and
move_window_forward accepts the shifted fallback, so both definitions resolved
to the same trigger and the last one won: Ctrl+Shift+F moved the window instead
of opening the prompt, and the search had no shortcut at all. It now sits on
kitty_mod+alt+s, which no other default action claims.

Fixes #45
2026-12-03 10:21:00 +01:00
BlackAngelTV b036fb352e Merge pull request 'fix(help): keep the shortcuts panel inside its dock' (#54) from fix/help-action-column into main
CI / check (push) Failing after 6m32s
Release / release (push) Successful in 11m42s
2026-12-03 10:17:01 +01:00
BlackAngelTV f76eccc169 chore(release): bump the fork version to 0.1.12
CI / check (pull_request) Failing after 5m21s
The shortcuts panel now renders differently, so cut a patch release. All the
version copies must agree for the packaging workflow.
2026-12-03 10:16:57 +01:00
BlackAngelTV 801b4a2d89 fix(help): keep the shortcuts panel inside its dock
The action column of the panel was written with no width limit, so on a narrow
dock a long action name was cut by the edge of the panel in the middle of an
identifier, and a selected row padded with reverse video overflowed. The column
is now bounded by the room the row leaves and ellipsized with a single cell
ellipsis, the key column shrinks on very narrow docks, and the full name of the
selected action stays reachable on the help line.

Fixes #50
2026-12-03 10:16:57 +01:00
17 changed files with 319 additions and 45 deletions

No files matched your search

+5 -4
View File
@@ -10,7 +10,7 @@ Les tableaux reflètent les valeurs de `kitty/options/definition.py`. La palette
de commandes (`Ctrl+Shift+F3`) liste en direct toutes les actions, leur touche
et leur catégorie, y compris les actions sans raccourci.
> **Aide rapide** : `Ctrl+Shift+H` (`kitty_mod+H`) ouvre le panneau latéral qui
> **Aide rapide** : `Ctrl+Shift+Alt+H` (`kitty_mod+alt+h`) ouvre le panneau latéral qui
> liste tous les raccourcis, avec recherche et catégories. Dans le shell kitty,
> `help` fait la même chose.
@@ -38,7 +38,7 @@ et leur catégorie, y compris les actions sans raccourci.
| `Ctrl+Shift+Alt+V` (`kitty_mod+alt+v`) | Colle une entrée de l'historique du presse-papiers. |
| `Ctrl+Shift+Alt+F` (`kitty_mod+alt+f`) | Demande une recherche floue, puis colle l'entrée choisie. |
| `Ctrl+Shift+Alt+R` (`kitty_mod+alt+r`) | Restaure la session enregistrée à la dernière fermeture de kitty. |
| `Ctrl+Shift+H` (`kitty_mod+H`) | Ouvre le panneau latéral de tous les raccourcis. |
| `Ctrl+Shift+Alt+H` (`kitty_mod+alt+h`) | Ouvre le panneau latéral de tous les raccourcis. |
Deux fonctions FWS ne demandent aucune touche :
@@ -81,7 +81,8 @@ Deux fonctions FWS ne demandent aucune touche :
| `Ctrl+Shift+X` | Va au prompt suivant. |
| `Ctrl+Shift+H` | Affiche tout l'historique dans un pager. |
| `Ctrl+Shift+G` | Affiche la sortie de la dernière commande dans un pager. |
| `Ctrl+Shift+/` | Recherche dans l'historique. |
| `Ctrl+Shift+/` | Recherche dans l'historique dans un pager. |
| `Ctrl+Shift+Alt+S` | Recherche avec surlignage sur place (`n`/`N` pour naviguer, `Échap` pour quitter). |
## Fenêtres
@@ -285,7 +286,7 @@ avec la syntaxe `map <touche> <action>`.
Dans le shell kitty (`Ctrl+Shift+Échap`), `help` sans argument ouvre un panneau
latéral qui liste tous les raccourcis actifs, classés par catégorie, avec une
recherche rapide. Depuis un terminal : `kitty +kitten help` ; le raccourci
par défaut `Ctrl+Shift+H` (`kitty_mod+H`) ouvre le même panneau.
par défaut `Ctrl+Shift+Alt+H` (`kitty_mod+alt+h`) ouvre le même panneau.
| Touche | Action |
| --- | --- |
+1 -1
View File
@@ -302,7 +302,7 @@ _branch=feat/file-manager-panel
### Publication automatique
`version`, à la racine, est la source de vérité des releases. Il suit la version
du fork FWS (`0.1.11`), pas la version amont de kitty embarquée dans le paquet :
du fork FWS (`0.1.15`), pas la version amont de kitty embarquée dans le paquet :
c'est elle qui nomme le tag, la release et le paquet
`fws-kitty-<version>-<rel>`. Il doit rester égal à `pkgver` dans
`packaging/PKGBUILD` et à la version affichée par `fws-kitty`
+3 -1
View File
@@ -30,7 +30,9 @@ Search scrollback in place :sc:`search_scrollback_prompt`
========================== =======================
The in-place search highlights every match without replacing the screen with a
pager. Prefix the query with ``\c`` to match case sensitively and with ``\r``
pager. It is bound to :kbd:`kitty_mod+alt+s` (:kbd:`Ctrl+Shift+Alt+S` by
default) and can also be run with :code:`kitten @ action
search_scrollback_prompt`. Prefix the query with ``\c`` to match case sensitively and with ``\r``
to use a regular expression; both modifiers can be combined. Write a doubled
backslash (``\\c``, ``\\r``) to search for those prefixes literally. While the search
is active, :kbd:`n` jumps to the next match, :kbd:`N` to the previous one and
+20
View File
@@ -263,6 +263,26 @@ Detailed list of changes
:kbd:`kitty_mod+H` is pressed. The panel can also be started with
:code:`kitty +kitten help`.
- The :doc:`file manager <kittens/file-manager>` can now be browsed with the
mouse: the wheel scrolls the list, a double click opens the entry under the
pointer like :kbd:`Enter` and a right click opens the action palette on the
clicked row.
- The in-place scrollback search got a usable default shortcut: it was bound
to :kbd:`kitty_mod+shift+f`, the same physical key as :ac:`move_window_forward`
(which allows the shifted fallback), so the last definition won and the search
never opened. It is now on :kbd:`kitty_mod+alt+s`.
- The keyboard shortcuts panel moved from :kbd:`kitty_mod+h` to
:kbd:`kitty_mod+alt+h`, so that :kbd:`Ctrl+Shift+H` browses the scrollback in
a pager again with :ac:`show_scrollback`, as documented. The two actions
shared the same default trigger and the panel silently took the key over.
- The keyboard shortcuts panel ellipsizes a long action name inside its own
column instead of letting the edge of the dock cut it, shrinks its key column
on very narrow docks so that a row always fits, and shows the full name of
the selected action on the help line.
- The default :opt:`tab_title_template` now shows the abbreviated working
directory of the tab before its title, so the directory indicator of the tab
bar is visible without configuration.
+10
View File
@@ -161,6 +161,16 @@ pas soumise.
synchronisation reste inerte.
Souris
------
Le panneau se pilote aussi à la souris. La molette parcourt la liste par pas de
trois lignes, sans transmettre l'événement au terminal qui héberge le dock. Un
double-clic ouvre l'entrée sous le pointeur, comme :kbd:`Entrée` : un répertoire
est parcouru, un fichier est confié à l'éditeur. Un clic droit ouvre la palette
d'actions sur la ligne cliquée, identique au raccourci :kbd:`:`.
.. _file-manager-shortcuts:
Raccourcis et configuration
+4 -3
View File
@@ -6,14 +6,15 @@ Panneau d'aide aux raccourcis
Le panneau d'aide affiche tous les raccourcis clavier actifs, triés par
catégorie, avec une recherche rapide. Il s'ouvre dans un dock latéral, comme le
gestionnaire de fichiers, et reste en lecture seule : :kbd:`Entrée` ne déclenche
aucune action. Il est mappé sur :kbd:`kitty_mod+H` (:kbd:`Ctrl+Shift+H` par
défaut).
aucune action. Il est mappé sur :kbd:`kitty_mod+alt+h`
(:kbd:`Ctrl+Shift+Alt+H` par défaut), pour laisser :kbd:`kitty_mod+h` à
:ac:`show_scrollback`.
Utilisation
-----------
Dans le :doc:`shell kitty </remote-control>` (:kbd:`Ctrl+Shift+Échap`), la commande
``help`` sans argument ouvre le panneau, tout comme :kbd:`kitty_mod+H` dans
``help`` sans argument ouvre le panneau, tout comme :kbd:`kitty_mod+alt+h` dans
n'importe quelle fenêtre ::
help
+71 -16
View File
@@ -220,28 +220,57 @@ type displayLine struct {
const maxKeyDisplayWidth = 30
// keyWidthFor is the number of cells reserved for the key itself. On a very
// narrow panel it shrinks, so that the action column still has room and the row
// never extends past the edge of the panel.
func keyWidthFor(panelWidth int) int {
return min(maxKeyDisplayWidth, max(panelWidth-10, 1))
}
// keyColumnWidthFor is the number of cells the key column takes: the four space
// indent, the padded key and the separating space.
func keyColumnWidthFor(panelWidth int) int {
return 4 + keyWidthFor(panelWidth) + 1
}
// unmappedLabel is shown in the key column for actions with no keyboard shortcut.
const unmappedLabel = "(unmapped)"
// truncateToWidth truncates s to fit within maxWidth cells, appending "..." if
// truncated and maxWidth > 3. When maxWidth <= 3, the string is simply trimmed
// to fit without appending ellipsis (no room for it).
// ellipsis marks a truncated string. It is a single cell, so that as much of the
// original text as possible is kept inside the panel.
const ellipsis = "…"
// truncateToWidth truncates s to fit within maxWidth cells, appending "…" if
// truncated and maxWidth > 1. When maxWidth <= 1, the string is simply trimmed
// to fit without appending the ellipsis (no room for it).
func truncateToWidth(s string, maxWidth int) string {
if wcswidth.Stringwidth(s) <= maxWidth {
return s
}
ellipsisWidth := wcswidth.Stringwidth(ellipsis)
runes := []rune(s)
if maxWidth <= 3 {
// Not enough room for ellipsis; just trim to fit
if maxWidth <= ellipsisWidth {
// Not enough room for the ellipsis; just trim to fit
for len(runes) > 0 && wcswidth.Stringwidth(string(runes)) > maxWidth {
runes = runes[:len(runes)-1]
}
return string(runes)
}
for len(runes) > 0 && wcswidth.Stringwidth(string(runes))+3 > maxWidth {
for len(runes) > 0 && wcswidth.Stringwidth(string(runes))+ellipsisWidth > maxWidth {
runes = runes[:len(runes)-1]
}
return string(runes) + "..."
return string(runes) + ellipsis
}
// actionColumnWidth is the number of cells left for the action column of a row,
// so that a long action name is ellipsized inside the panel instead of being cut
// by its edge. The category suffix, only shown in search results, is reserved.
func (h *Handler) actionColumnWidth(width int, b *Binding) int {
used := keyColumnWidthFor(width)
if h.query != "" && h.leader == nil {
used += categorySuffixWidth(b)
}
return max(width-used, 1)
}
// sectionHeader returns a separator line like " ── label ─────────".
@@ -642,11 +671,22 @@ func (h *Handler) draw_screen() {
h.drawFlatResults(resultsStartY, resultsHeight, width)
}
// Draw help text for selected binding
// Draw help text for selected binding, falling back to the full action name
// when the action column had to ellipsize it
h.lp.MoveCursorTo(1, helpY)
if b := h.selectedBinding(); b != nil && b.Help != "" {
helpStr := truncateToWidth(b.Help, max(width-2, 3))
h.lp.QueueWriteString(h.lp.SprintStyled("dim italic", " "+helpStr))
if b := h.selectedBinding(); b != nil {
detail := b.Help
if full := h.selectedActionText(); wcswidth.Stringwidth(full) > h.actionColumnWidth(width, b) {
if detail == "" {
detail = full
} else {
detail = full + " " + detail
}
}
if detail != "" {
helpStr := truncateToWidth(detail, max(width-2, 1))
h.lp.QueueWriteString(h.lp.SprintStyled("dim italic", " "+helpStr))
}
}
// Draw key hints footer
@@ -863,8 +903,9 @@ func (h *Handler) drawBindingLine(filteredIdx, width int, isSelected bool) {
b := &h.all_items[idx].binding
actionDisplay := h.all_items[idx].actionText
// Build the key display
keyDisplay := keyDisplayText(b)
// Build the key display, bounded by the room the panel leaves as well
keyWidth := keyWidthFor(width)
keyDisplay := truncateToWidth(keyDisplayText(b), keyWidth)
// Determine match info for highlighting (only set when a query is active)
var mi *matchInfo
@@ -893,8 +934,8 @@ func (h *Handler) drawBindingLine(filteredIdx, width int, isSelected bool) {
return s
}
// Render key column (4-space indent + key padded to maxKeyDisplayWidth + space)
paddingLen := max(0, maxKeyDisplayWidth-wcswidth.Stringwidth(keyDisplay))
// Render key column (4-space indent + key padded to the key column width)
paddingLen := max(0, keyWidth-wcswidth.Stringwidth(keyDisplay))
pad := strings.Repeat(" ", paddingLen) + " "
ks := keyStyle
if b.Key == "" {
@@ -908,7 +949,8 @@ func (h *Handler) drawBindingLine(filteredIdx, width int, isSelected bool) {
h.lp.QueueWriteString(h.lp.SprintStyled(ks, " "+keyDisplay+pad))
}
// Render action display column
// Render action display column, bounded by the room the panel leaves
actionDisplay = truncateToWidth(actionDisplay, h.actionColumnWidth(width, b))
if mi != nil && len(mi.actionPositions) > 0 {
h.lp.QueueWriteString(h.highlightMatchedChars(actionDisplay, mi.actionPositions, baseStyle, matchStyle))
} else {
@@ -932,6 +974,19 @@ func (h *Handler) drawBindingLine(filteredIdx, width int, isSelected bool) {
}
}
// selectedActionText returns the action text of the selected row, which is the
// full name even when the row has to ellipsize it.
func (h *Handler) selectedActionText() string {
if h.selected_idx < 0 || h.selected_idx >= len(h.filtered_idx) {
return ""
}
idx := h.filtered_idx[h.selected_idx]
if idx < 0 || idx >= len(h.all_items) {
return ""
}
return h.all_items[idx].actionText
}
// rowToFilteredIdx converts a 0-indexed cell Y coordinate to a filtered item
// index, or -1 if the cell is not over a clickable item. Internally converts
// to 1-indexed screen rows (matching the MoveCursorTo convention) to compare
+69 -7
View File
@@ -7,6 +7,7 @@ import (
"testing"
"github.com/kovidgoyal/kitty/tools/tui/loop"
"github.com/kovidgoyal/kitty/tools/wcswidth"
)
// testBinding creates a Binding where Action, ActionDisplay, and Definition all
@@ -435,13 +436,13 @@ func TestTruncateToWidth(t *testing.T) {
t.Fatalf("Expected %q unchanged at exact width, got %q", "hello", got)
}
// Over width: truncated with ellipsis
// Over width: truncated with a single cell ellipsis
got = truncateToWidth("hello world", 8)
if !strings.HasSuffix(got, "...") {
t.Fatalf("Expected truncated string to end with '...', got %q", got)
if !strings.HasSuffix(got, ellipsis) {
t.Fatalf("Expected truncated string to end with %q, got %q", ellipsis, got)
}
if len([]rune(got)) > 8 {
t.Fatalf("Expected truncated string to be at most 8 runes, got %d in %q", len([]rune(got)), got)
if wcswidth.Stringwidth(got) > 8 {
t.Fatalf("Expected truncated string to be at most 8 cells, got %d in %q", wcswidth.Stringwidth(got), got)
}
// Long key like a mouse binding should be truncated
@@ -450,8 +451,69 @@ func TestTruncateToWidth(t *testing.T) {
if len([]rune(got)) > maxKeyDisplayWidth {
t.Fatalf("Key should be truncated to maxKeyDisplayWidth, got len=%d: %q", len([]rune(got)), got)
}
if !strings.HasSuffix(got, "...") {
t.Fatalf("Truncated key should end with '...', got %q", got)
if !strings.HasSuffix(got, ellipsis) {
t.Fatalf("Truncated key should end with %q, got %q", ellipsis, got)
}
}
func TestActionColumnStaysInsideThePanel(t *testing.T) {
h := newTestHandler()
b := testBinding("ctrl+shift+alt+v", "paste_from_clipboard_history", "Paste an entry from the clipboard history")
b.Category = "Copy/paste"
const width = 50
// Without a query there is no category suffix, so the whole rest of the row
// belongs to the action
keyColumnWidth := keyColumnWidthFor(width)
budget := h.actionColumnWidth(width, &b)
if budget != width-keyColumnWidth {
t.Fatalf("Expected %d cells for the action, got %d", width-keyColumnWidth, budget)
}
// Search results reserve the room the category suffix needs
h.query = "paste"
budget = h.actionColumnWidth(width, &b)
if want := width - keyColumnWidth - categorySuffixWidth(&b); budget != want {
t.Fatalf("Expected %d cells for the action next to the suffix, got %d", want, budget)
}
// A long name is ellipsized within its own column rather than cut by the edge
got := truncateToWidth(b.ActionDisplay, budget)
if w := wcswidth.Stringwidth(got); w > budget {
t.Fatalf("Action display is %d cells, over the %d cell column: %q", w, budget, got)
}
if !strings.HasSuffix(got, ellipsis) {
t.Fatalf("Expected the action display to be ellipsized, got %q", got)
}
// A name that fits is left untouched
short := testBinding("ctrl+shift+c", "copy_to_clipboard", "Copy")
const wideWidth = 80
if got := truncateToWidth(short.ActionDisplay, h.actionColumnWidth(wideWidth, &short)); got != short.ActionDisplay {
t.Fatalf("Expected %q unchanged, got %q", short.ActionDisplay, got)
}
}
func TestRowFitsInNarrowPanel(t *testing.T) {
h := newTestHandler()
h.query = "paste"
b := testBinding("ctrl+shift+alt+v press", "paste_from_clipboard_history", "Paste an entry")
b.Category = "Copy/paste"
for _, width := range []int{10, 20, 35, 50, 104} {
keyWidth := keyWidthFor(width)
key := truncateToWidth(keyDisplayText(&b), keyWidth)
action := truncateToWidth(b.ActionDisplay, h.actionColumnWidth(width, &b))
row := 4 + wcswidth.Stringwidth(key) + max(0, keyWidth-wcswidth.Stringwidth(key)) + 1 + wcswidth.Stringwidth(action)
if row > width {
t.Fatalf("Row is %d cells wide in a %d cell panel: key %q action %q", row, width, key, action)
}
}
// The key column only shrinks when the panel cannot hold the full one
if keyWidthFor(104) != maxKeyDisplayWidth {
t.Fatalf("Expected the full key column on a wide panel, got %d", keyWidthFor(104))
}
if keyWidthFor(20) >= maxKeyDisplayWidth {
t.Fatalf("Expected the key column to shrink on a narrow panel, got %d", keyWidthFor(20))
}
}
+54 -2
View File
@@ -228,6 +228,28 @@ func truncate_to_width(s string, max_width int) string {
return string(runes) + "\u2026"
}
// wheel_scroll_lines is the number of rows one wheel notch scrolls. It sits
// between a single line, which makes a long directory tedious, and the default
// kitty wheel_scroll_multiplier of five, which skips too much in a panel.
const wheel_scroll_lines = 3
// double_click_interval is the largest gap between two clicks on the same row
// that still counts as a double click, matching kitty's click_interval default.
const double_click_interval = 500 * time.Millisecond
// click_tracker remembers the last click so that a second click on the same row
// opens it, while clicks on different rows stay single selections.
type click_tracker struct {
at time.Time
idx int
}
func (c *click_tracker) is_double(now time.Time, idx int) bool {
prev_at, prev_idx := c.at, c.idx
c.at, c.idx = now, idx
return idx == prev_idx && !prev_at.IsZero() && now.Sub(prev_at) <= double_click_interval
}
type Handler struct {
lp *loop.Loop
screen_size loop.ScreenSize
@@ -255,6 +277,7 @@ type Handler struct {
sync *shell_sync
sync_handled bool
sync_published bool
clicks click_tracker
}
func (h *Handler) initialize() (string, error) {
@@ -1088,13 +1111,42 @@ func (h *Handler) row_to_entry(cell_y int) int {
}
func (h *Handler) on_mouse_event(ev *loop.MouseEvent) error {
// The palette owns the pointer while it is open, so clicks and wheel events
// do not change the selection behind it.
if h.palette_open && ev.Event_type != loop.MOUSE_MOVE {
return nil
}
switch ev.Event_type {
case loop.MOUSE_PRESS:
// Wheel notches arrive as presses carrying a wheel button. Moving the
// selection keeps the list scrolled to the row under it, without sending
// the event to the terminal that hosts the dock.
switch {
case ev.Buttons&loop.MOUSE_WHEEL_UP != 0:
h.move_selection(-wheel_scroll_lines)
case ev.Buttons&loop.MOUSE_WHEEL_DOWN != 0:
h.move_selection(wheel_scroll_lines)
}
case loop.MOUSE_CLICK:
if ev.Buttons&loop.LEFT_MOUSE_BUTTON != 0 {
switch {
case ev.Buttons&loop.LEFT_MOUSE_BUTTON != 0:
idx := h.row_to_entry(ev.Cell.Y)
if idx < 0 {
return nil
}
h.selected = idx
if h.clicks.is_double(time.Now(), idx) {
h.activate()
return nil
}
h.draw_screen()
case ev.Buttons&loop.RIGHT_MOUSE_BUTTON != 0:
// The context menu is the action palette that :: already opens, so
// every panel action is reachable from the pointer too.
if idx := h.row_to_entry(ev.Cell.Y); idx >= 0 {
h.selected = idx
h.draw_screen()
}
h.open_palette()
}
case loop.MOUSE_MOVE:
h.lp.ClearPointerShapes()
+43
View File
@@ -8,6 +8,8 @@ import (
"path/filepath"
"testing"
"time"
"github.com/kovidgoyal/kitty/tools/tui/loop"
)
func TestSortEntriesDirectoriesFirstThenByName(t *testing.T) {
@@ -430,6 +432,47 @@ func TestEditArgsInWindow(t *testing.T) {
}
}
func TestRowToEntryAccountsForScroll(t *testing.T) {
h := &Handler{
screen_size: loop.ScreenSize{WidthCells: 40, HeightCells: 10},
entries: make([]Entry, 12),
scroll: 3,
}
// The list starts on row 2 and the status line takes the last row, so rows
// 2..8 display entries 3..9
cases := map[int]int{0: -1, 1: 3, 4: 6, 7: 9, 8: -1, 9: -1}
for cell_y, want := range cases {
if got := h.row_to_entry(cell_y); got != want {
t.Fatalf("cell Y %d: wanted entry %d, got %d", cell_y, want, got)
}
}
// A scroll past the end of the list maps to no entry rather than panicking
h.scroll = 20
if got := h.row_to_entry(1); got != -1 {
t.Fatalf("wanted no entry past the end of the list, got %d", got)
}
}
func TestClickTrackerDetectsDoubleClick(t *testing.T) {
start := time.Unix(1000, 0)
var c click_tracker
if c.is_double(start, 2) {
t.Fatal("a first click must not be a double click")
}
if !c.is_double(start.Add(200*time.Millisecond), 2) {
t.Fatal("a second click on the same row within the interval is a double click")
}
if c.is_double(start.Add(5*time.Second), 2) {
t.Fatal("a click after the interval must not be a double click")
}
if c.is_double(start.Add(5*time.Second+100*time.Millisecond), 7) {
t.Fatal("a click on another row must not be a double click")
}
if !c.is_double(start.Add(5*time.Second+200*time.Millisecond), 7) {
t.Fatal("the tracker must accept the row clicked last")
}
}
func TestTruncateToWidth(t *testing.T) {
if got := truncate_to_width("abcdef", 3); got != "ab\u2026" {
t.Fatalf("unexpected truncation %q", got)
+2 -2
View File
@@ -424,10 +424,10 @@ handle_fast_commandline(CLISpec *cli_spec, const char *instance_group_prefix) {
if (get_bool_cli_val(cli_spec, "version")) {
if (isatty(STDOUT_FILENO)) {
printf("\x1b[3mkitty\x1b[23m \x1b[32m%s\x1b[39m created by \x1b[1;34mKovid Goyal\x1b[22;39m\n", KITTY_VERSION);
printf("\x1b[3mfws-kitty\x1b[23m \x1b[32m0.1.11\x1b[39m by \x1b[1;34mBlackAngelTV\x1b[22;39m\n");
printf("\x1b[3mfws-kitty\x1b[23m \x1b[32m0.1.15\x1b[39m by \x1b[1;34mBlackAngelTV\x1b[22;39m\n");
} else {
printf("kitty %s created by Kovid Goyal\n", KITTY_VERSION);
printf("fws-kitty 0.1.11 by BlackAngelTV\n");
printf("fws-kitty 0.1.15 by BlackAngelTV\n");
}
exit(0);
}
+7 -4
View File
@@ -4159,13 +4159,14 @@ map('Search the scrollback within a pager', 'search_scrollback --allow-fallback=
map(
'Search and highlight the scrollback in place',
'search_scrollback_prompt kitty_mod+shift+f search_scrollback_prompt',
'search_scrollback_prompt kitty_mod+alt+s search_scrollback_prompt',
long_text="""
Search the scrollback without opening a pager. Every match is highlighted in
the scrollback and the ``[current/total]`` counter is shown in the window title.
Prefix the query with ``\\c`` to match case sensitively and with ``\\r`` to use
a regular expression. While a search is active, :kbd:`n` and :kbd:`N` jump to
the next and previous match and :kbd:`Escape` ends the search.
the next and previous match and :kbd:`Escape` ends the search. The default
binding is :kbd:`kitty_mod+alt+s` (:kbd:`Ctrl+Shift+Alt+S` by default).
The :ac:`scrollback_search_next`, :ac:`scrollback_search_prev` and
:ac:`clear_scrollback_search` actions can be mapped to other keys.
@@ -4719,11 +4720,13 @@ map('Command palette', 'command_palette kitty_mod+f3 command_palette')
map(
'Keyboard shortcuts',
'keyboard_shortcuts kitty_mod+h launch --type=window-dock --dock-edge=left --dock-size=60 kitty +kitten help',
'keyboard_shortcuts kitty_mod+alt+h launch --type=window-dock --dock-edge=left --dock-size=60 kitty +kitten help',
long_text="""
Open the searchable keyboard shortcuts panel in a dock at the left edge of the
current window. It can also be launched manually with :code:`kitty +kitten help`.
The default binding is :kbd:`kitty_mod+h` (:kbd:`Ctrl+Shift+H` by default).
The default binding is :kbd:`kitty_mod+alt+h` (:kbd:`Ctrl+Shift+Alt+H` by
default), so that :kbd:`kitty_mod+h` keeps browsing the scrollback in a pager
with :ac:`show_scrollback`.
""",
)
+2 -2
View File
@@ -937,7 +937,7 @@ defaults.map = [
# search_scrollback
KeyDefinition(trigger=SingleKey(mods=256, key=47), definition='search_scrollback'),
# search_scrollback_prompt
KeyDefinition(trigger=SingleKey(mods=257, key=102), definition='search_scrollback_prompt'),
KeyDefinition(trigger=SingleKey(mods=258, key=115), definition='search_scrollback_prompt'),
# new_window
KeyDefinition(trigger=SingleKey(mods=256, key=57345), definition='new_window'),
# new_os_window
@@ -1041,7 +1041,7 @@ defaults.map = [
# file_manager
KeyDefinition(trigger=SingleKey(mods=5, key=101), definition='launch --type=window-dock --dock-edge=left --dock-size=60 kitten file-manager'),
# keyboard_shortcuts
KeyDefinition(trigger=SingleKey(mods=5, key=104), definition='launch --type=window-dock --dock-edge=left --dock-size=60 kitty +kitten help'),
KeyDefinition(trigger=SingleKey(mods=258, key=104), definition='launch --type=window-dock --dock-edge=left --dock-size=60 kitty +kitten help'),
# toggle_fullscreen
KeyDefinition(trigger=SingleKey(mods=256, key=57374), definition='toggle_fullscreen'),
# toggle_maximized
+25
View File
@@ -29,6 +29,31 @@ class TestConfParsing(BaseTest):
def test_conf_parsing(self):
conf_parsing(self)
def test_default_shortcuts_have_no_duplicate_trigger(self):
from kitty.config import load_config
opts = load_config(overrides=())
keymap = opts.keyboard_modes[''].keymap
# The file manager deliberately takes kitty_mod+e over from open_url, a
# decision documented in the changelog. Every other collision means the
# last definition wins silently and one of the two actions is unreachable.
accepted = {frozenset(('launch', 'open_url_with_hints'))}
for key, defns in keymap.items():
actions = {d.definition.split()[0] for d in defns}
if len(actions) > 1 and frozenset(actions) not in accepted:
self.fail(f'{key!r} is claimed by several actions: {sorted(actions)}')
def test_default_search_shortcut(self):
from kitty.config import load_config
opts = load_config(overrides=())
keymap = opts.keyboard_modes[''].keymap
keys = [key for key, defns in keymap.items() if any(d.definition.split()[0] == 'search_scrollback_prompt' for d in defns)]
self.ae(len(keys), 1, 'the in-place search must have exactly one default shortcut')
# A shared trigger means the last definition wins silently and the search
# never opens, which is what happened with move_window_forward.
self.ae([d.definition.split()[0] for d in keymap[keys[0]]], ['search_scrollback_prompt'])
def test_launcher(self):
launcher(self)
+1 -1
View File
@@ -13,7 +13,7 @@
pkgname=fws-kitty
# Fork version from the version file: it names the release and the package.
# The upstream kitty release built inside is tracked by _kittyver below.
pkgver=0.1.11
pkgver=0.1.15
pkgrel=1
pkgdesc='Fast, feature-rich, GPU based terminal (FWS fork with the file-manager kitten)'
arch=('x86_64' 'aarch64')
+1 -1
View File
@@ -31,7 +31,7 @@ func ShowError(err error) {
func (self *Command) version_string(formatter *markup.Context) string {
return fmt.Sprintln(formatter.Italic(self.CommandStringForUsage()), formatter.Opt(kitty.VersionString+kitty.VersionSuffix), "created by", formatter.Title("Kovid Goyal")) +
fmt.Sprintln(formatter.Italic("fws-kitty"), formatter.Opt("0.1.11"), "by", formatter.Title("BlackAngelTV"))
fmt.Sprintln(formatter.Italic("fws-kitty"), formatter.Opt("0.1.15"), "by", formatter.Title("BlackAngelTV"))
}
func (self *Command) ShowVersion() {
+1 -1
View File
@@ -1 +1 @@
0.1.11
0.1.15