Compare commits
6
Commits
v0.1.8
..
4ca4a516ae
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ca4a516ae
|
||
|
|
f616651c49
|
||
|
|
1bd822b9e5
|
||
|
|
ce9f7ab974
|
||
|
|
603ef78a6e
|
||
|
|
f2f026c748
|
No files matched your search
@@ -224,15 +224,29 @@ jobs:
|
|||||||
# CDN, so a HEAD is not enough: the index and the file can disagree
|
# CDN, so a HEAD is not enough: the index and the file can disagree
|
||||||
# for as long as the CDN caches the previous build under this name,
|
# for as long as the CDN caches the previous build under this name,
|
||||||
# and the checksum is exactly what pacman verifies before installing.
|
# and the checksum is exactly what pacman verifies before installing.
|
||||||
|
# A freshly accepted upload is not routable instantly, so an absent
|
||||||
|
# file is retried before giving up; different bytes are a real
|
||||||
|
# mismatch and fail at once, since that is what breaks pacman.
|
||||||
url="https://repo.laxacube.ch/x86_64/$PACKAGE_NAME"
|
url="https://repo.laxacube.ch/x86_64/$PACKAGE_NAME"
|
||||||
expected="$(cut -d' ' -f1 "$PACKAGE_FILE.sha256")"
|
expected="$(cut -d' ' -f1 "$PACKAGE_FILE.sha256")"
|
||||||
for _ in 1 2 3 4 5 6; do
|
code=000
|
||||||
if [ "$(curl -fsSL "$url" | sha256sum | cut -d' ' -f1)" = "$expected" ]; then
|
for _ in $(seq 1 24); do
|
||||||
echo "published $url"
|
code="$(curl -sS -o "$RUNNER_TEMP/served.pkg" -w '%{http_code}' "$url" || true)"
|
||||||
exit 0
|
if [ "$code" = 200 ]; then
|
||||||
|
served="$(sha256sum "$RUNNER_TEMP/served.pkg" | cut -d' ' -f1)"
|
||||||
|
if [ "$served" = "$expected" ]; then
|
||||||
|
echo "published $url"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "::error::$url serves sha256 $served instead of $expected"
|
||||||
|
echo "::error::the CDN is still caching another build under this name: purge it before re-running"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
echo "::error::$url does not serve this build (expected sha256 $expected)"
|
if [ "$code" = 404 ]; then
|
||||||
echo "::error::the CDN is probably still caching an older file under this name: purge it before re-running"
|
echo "::warning::$url is not visible yet; the repository accepted the upload, pacman will see it once the index is rebuilt"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "::error::$url answered HTTP $code after the upload"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -302,7 +302,7 @@ _branch=feat/file-manager-panel
|
|||||||
### Publication automatique
|
### Publication automatique
|
||||||
|
|
||||||
`version`, à la racine, est la source de vérité des releases. Il suit la version
|
`version`, à la racine, est la source de vérité des releases. Il suit la version
|
||||||
du fork FWS (`0.1.8`), pas la version amont de kitty embarquée dans le paquet :
|
du fork FWS (`0.1.10`), pas la version amont de kitty embarquée dans le paquet :
|
||||||
c'est elle qui nomme le tag, la release et le paquet
|
c'est elle qui nomme le tag, la release et le paquet
|
||||||
`fws-kitty-<version>-<rel>`. Il doit rester égal à `pkgver` dans
|
`fws-kitty-<version>-<rel>`. Il doit rester égal à `pkgver` dans
|
||||||
`packaging/PKGBUILD` et à la version affichée par `fws-kitty`
|
`packaging/PKGBUILD` et à la version affichée par `fws-kitty`
|
||||||
|
|||||||
+2
-1
@@ -31,7 +31,8 @@ Search scrollback in place :sc:`search_scrollback_prompt`
|
|||||||
|
|
||||||
The in-place search highlights every match without replacing the screen with a
|
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. Prefix the query with ``\c`` to match case sensitively and with ``\r``
|
||||||
to use a regular expression; both modifiers can be combined. While the search
|
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
|
is active, :kbd:`n` jumps to the next match, :kbd:`N` to the previous one and
|
||||||
:kbd:`Escape` ends it. The ``[current/total]`` counter is shown in the window
|
:kbd:`Escape` ends it. The ``[current/total]`` counter is shown in the window
|
||||||
title and matches use the first marker color (see :opt:`mark1_foreground`).
|
title and matches use the first marker color (see :opt:`mark1_foreground`).
|
||||||
|
|||||||
@@ -273,6 +273,23 @@ Detailed list of changes
|
|||||||
:doc:`accessibility guide </accessibility>` documents keyboard navigation and
|
:doc:`accessibility guide </accessibility>` documents keyboard navigation and
|
||||||
the :opt:`text_fg_override_threshold` :code:`4.5 ratio` contrast mode.
|
the :opt:`text_fg_override_threshold` :code:`4.5 ratio` contrast mode.
|
||||||
|
|
||||||
|
- The scrollback can now be searched in place: :ac:`search_scrollback_prompt`
|
||||||
|
highlights every match without opening the pager, shows the
|
||||||
|
:code:`[current/total]` counter in the window title and moves between matches
|
||||||
|
with :kbd:`n` and :kbd:`N`. Prefix the query with :code:`\c` for a case
|
||||||
|
sensitive search and :code:`\r` for a regular expression; write a doubled
|
||||||
|
backslash (:code:`\\c`, :code:`\\r`) to search for those prefixes literally.
|
||||||
|
See :doc:`basic` for the details.
|
||||||
|
|
||||||
|
- A configurable :opt:`leader` key now opens a which-key panel listing every
|
||||||
|
multi-key mapping available under that prefix, without waiting for a timeout.
|
||||||
|
The :doc:`command palette <kittens/command-palette>` shows the shortcut next
|
||||||
|
to each action and :kbd:`Ctrl+R` remaps it. See :ref:`leader_keymap`.
|
||||||
|
|
||||||
|
- The :doc:`file manager <kittens/file-manager>` now follows symbolic links to
|
||||||
|
directories, so they can be browsed like real ones, and expands a leading
|
||||||
|
:code:`~` in :code:`--start-dir`.
|
||||||
|
|
||||||
- A new :doc:`file manager kitten <kittens/file-manager>`, run with
|
- A new :doc:`file manager kitten <kittens/file-manager>`, run with
|
||||||
:code:`kitten file-manager`, that browses directories in a side panel and
|
:code:`kitten file-manager`, that browses directories in a side panel and
|
||||||
changes the working directory of the shell that launched it without leaving
|
changes the working directory of the shell that launched it without leaving
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ Il peut aussi tourner dans un :doc:`panneau du bureau </kittens/panel>` ou dans
|
|||||||
n'importe quelle :term:`fenêtre kitty <window>` classique.
|
n'importe quelle :term:`fenêtre kitty <window>` classique.
|
||||||
|
|
||||||
Le répertoire de départ est celui de la fenêtre courante, sauf si un répertoire
|
Le répertoire de départ est celui de la fenêtre courante, sauf si un répertoire
|
||||||
est passé en argument ou avec ``--start-dir``.
|
est passé en argument ou avec ``--start-dir``. Un chemin commençant par ``~``
|
||||||
|
y est développé, même lorsqu'il vient d'un mappage où le shell ne l'a pas fait.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@@ -61,7 +62,9 @@ Actions
|
|||||||
|
|
||||||
:kbd:`→` ou :kbd:`L`
|
:kbd:`→` ou :kbd:`L`
|
||||||
descend dans le répertoire sélectionné ; le shell y va aussi, au prompt
|
descend dans le répertoire sélectionné ; le shell y va aussi, au prompt
|
||||||
suivant, quand la synchronisation est active.
|
suivant, quand la synchronisation est active. Un lien symbolique vers un
|
||||||
|
répertoire se parcourt comme un répertoire ; un lien cassé reste une entrée
|
||||||
|
ordinaire, ouverte dans l'éditeur.
|
||||||
|
|
||||||
:kbd:`←`, :kbd:`Retour arrière` ou :kbd:`H`
|
:kbd:`←`, :kbd:`Retour arrière` ou :kbd:`H`
|
||||||
remonte au répertoire parent.
|
remonte au répertoire parent.
|
||||||
@@ -232,6 +235,9 @@ Limites
|
|||||||
pour changer de répertoire ; utilisez-le depuis une fenêtre de shell.
|
pour changer de répertoire ; utilisez-le depuis une fenêtre de shell.
|
||||||
- Le panneau ne suit pas les modifications faites par d'autres programmes :
|
- Le panneau ne suit pas les modifications faites par d'autres programmes :
|
||||||
utilisez :kbd:`Ctrl+R` pour relire le répertoire.
|
utilisez :kbd:`Ctrl+R` pour relire le répertoire.
|
||||||
|
- Les liens symboliques ne sont pas distingués des fichiers ordinaires dans
|
||||||
|
l'affichage : seul le fait qu'ils pointent vers un répertoire change leur
|
||||||
|
comportement à l'ouverture.
|
||||||
|
|
||||||
.. include:: /generated/conf-kitten-file_manager.rst
|
.. include:: /generated/conf-kitten-file_manager.rst
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,17 @@ func read_dir(dir string, show_hidden bool, sort_by string) ([]Entry, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
e := Entry{Name: name, IsDir: item.IsDir()}
|
e := Entry{Name: name, IsDir: item.IsDir()}
|
||||||
if info, ierr := item.Info(); ierr == nil {
|
info, ierr := item.Info()
|
||||||
|
if item.Type()&os.ModeSymlink != 0 {
|
||||||
|
// A symlink is reported as its own type, so a link to a directory
|
||||||
|
// would be opened in the editor instead of being browsed. Follow
|
||||||
|
// it to classify the entry; broken links stay plain entries.
|
||||||
|
if target, terr := os.Stat(filepath.Join(dir, name)); terr == nil {
|
||||||
|
info, ierr = target, nil
|
||||||
|
e.IsDir = target.IsDir()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ierr == nil {
|
||||||
e.ModTime = info.ModTime().Unix()
|
e.ModTime = info.ModTime().Unix()
|
||||||
e.Size = info.Size()
|
e.Size = info.Size()
|
||||||
}
|
}
|
||||||
@@ -90,6 +100,23 @@ func read_dir(dir string, show_hidden bool, sort_by string) ([]Entry, error) {
|
|||||||
return entries, nil
|
return entries, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// expand_home expands a leading ~ so that a directory given in a mapping or by
|
||||||
|
// the remote control API, where no shell expands it, names the same directory
|
||||||
|
// as it would on the command line.
|
||||||
|
func expand_home(path string) (string, error) {
|
||||||
|
if path != "~" && !strings.HasPrefix(path, "~/") {
|
||||||
|
return path, nil
|
||||||
|
}
|
||||||
|
home, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if path == "~" {
|
||||||
|
return home, nil
|
||||||
|
}
|
||||||
|
return filepath.Join(home, path[2:]), nil
|
||||||
|
}
|
||||||
|
|
||||||
func entry_path(dir, name string) string {
|
func entry_path(dir, name string) string {
|
||||||
return filepath.Join(dir, name)
|
return filepath.Join(dir, name)
|
||||||
}
|
}
|
||||||
@@ -169,6 +196,10 @@ func resolve_start_dir(candidate string) (string, error) {
|
|||||||
}
|
}
|
||||||
candidate = cwd
|
candidate = cwd
|
||||||
}
|
}
|
||||||
|
candidate, err := expand_home(candidate)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
abs, err := filepath.Abs(candidate)
|
abs, err := filepath.Abs(candidate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|||||||
@@ -80,6 +80,66 @@ func TestReadDirReportsErrors(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestReadDirAcceptsAnEmptyDirectory(t *testing.T) {
|
||||||
|
entries, err := read_dir(t.TempDir(), false, "name")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if len(entries) != 0 {
|
||||||
|
t.Fatalf("an empty directory must list nothing, got %#v", entries)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadDirReportsPermissionDenied(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
if err := os.Chmod(dir, 0o000); err != nil {
|
||||||
|
t.Skipf("cannot change permissions: %v", err)
|
||||||
|
}
|
||||||
|
// Make the directory readable again before TempDir cleans it up.
|
||||||
|
defer os.Chmod(dir, 0o700) //nolint:errcheck
|
||||||
|
if _, err := read_dir(dir, false, "name"); err == nil {
|
||||||
|
t.Skip("the current user can read a mode 000 directory, probably running as root")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadDirTreatsSymlinkedDirectoryAsDirectory(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
if err := os.Mkdir(filepath.Join(dir, "target"), 0o755); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := os.Symlink("target", filepath.Join(dir, "link")); err != nil {
|
||||||
|
t.Skipf("cannot create symlinks: %v", err)
|
||||||
|
}
|
||||||
|
entries, err := read_dir(dir, false, "name")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, e := range entries {
|
||||||
|
if e.Name == "link" {
|
||||||
|
if !e.IsDir {
|
||||||
|
t.Fatal("a symlink to a directory must be browsable, not opened as a file")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.Fatalf("the symlink is missing from the listing: %#v", entries)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadDirHandlesNonUTF8Names(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
name := string([]byte{'b', 'a', 'd', 0xff, '.', 't', 'x', 't'})
|
||||||
|
if err := os.WriteFile(filepath.Join(dir, name), nil, 0o644); err != nil {
|
||||||
|
t.Skipf("the filesystem rejects non-UTF-8 names: %v", err)
|
||||||
|
}
|
||||||
|
entries, err := read_dir(dir, false, "name")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if len(entries) != 1 || entries[0].Name != name {
|
||||||
|
t.Fatalf("the non-UTF-8 name must be listed unchanged, got %#v", entries)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestValidateEntryName(t *testing.T) {
|
func TestValidateEntryName(t *testing.T) {
|
||||||
for _, name := range []string{"", ".", "..", "a/b", "a\x00b"} {
|
for _, name := range []string{"", ".", "..", "a/b", "a\x00b"} {
|
||||||
if err := validate_entry_name(name); err == nil {
|
if err := validate_entry_name(name); err == nil {
|
||||||
@@ -148,6 +208,22 @@ func TestCreateRenameAndDelete(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestResolveStartDirExpandsHome(t *testing.T) {
|
||||||
|
home := t.TempDir()
|
||||||
|
projects := filepath.Join(home, "projects")
|
||||||
|
if err := os.Mkdir(projects, 0o755); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Setenv("HOME", home)
|
||||||
|
got, err := resolve_start_dir("~/projects")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if got != projects {
|
||||||
|
t.Fatalf("resolve_start_dir(~/projects) = %q, wanted %q", got, projects)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestResolveStartDirAcceptsFiles(t *testing.T) {
|
func TestResolveStartDirAcceptsFiles(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
file := filepath.Join(dir, "file.txt")
|
file := filepath.Join(dir, "file.txt")
|
||||||
|
|||||||
@@ -424,10 +424,10 @@ handle_fast_commandline(CLISpec *cli_spec, const char *instance_group_prefix) {
|
|||||||
if (get_bool_cli_val(cli_spec, "version")) {
|
if (get_bool_cli_val(cli_spec, "version")) {
|
||||||
if (isatty(STDOUT_FILENO)) {
|
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[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.8\x1b[39m by \x1b[1;34mBlackAngelTV\x1b[22;39m\n");
|
printf("\x1b[3mfws-kitty\x1b[23m \x1b[32m0.1.10\x1b[39m by \x1b[1;34mBlackAngelTV\x1b[22;39m\n");
|
||||||
} else {
|
} else {
|
||||||
printf("kitty %s created by Kovid Goyal\n", KITTY_VERSION);
|
printf("kitty %s created by Kovid Goyal\n", KITTY_VERSION);
|
||||||
printf("fws-kitty 0.1.8 by BlackAngelTV\n");
|
printf("fws-kitty 0.1.10 by BlackAngelTV\n");
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
The query parser and the matcher live here, away from the screen code, so that
|
The query parser and the matcher live here, away from the screen code, so that
|
||||||
they can be tested without a running terminal. A query can start with two
|
they can be tested without a running terminal. A query can start with two
|
||||||
modifiers, in any order: ``\\c`` makes matching case sensitive and ``\\r``
|
modifiers, in any order: ``\\c`` makes matching case sensitive and ``\\r``
|
||||||
treats the query as a regular expression.
|
treats the query as a regular expression. A doubled backslash escapes the
|
||||||
|
modifier syntax, so that the two prefixes can be searched for literally.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
@@ -57,6 +58,11 @@ def parse_query(raw: str) -> Query:
|
|||||||
case_sensitive = is_regex = False
|
case_sensitive = is_regex = False
|
||||||
while len(text) > 1 and text[0] == '\\':
|
while len(text) > 1 and text[0] == '\\':
|
||||||
modifier = text[1].lower()
|
modifier = text[1].lower()
|
||||||
|
if modifier == '\\':
|
||||||
|
# A doubled backslash stands for a literal one and ends the modifier
|
||||||
|
# section, which is the only way to search for \c or \r themselves.
|
||||||
|
text = text[1:]
|
||||||
|
break
|
||||||
if modifier == CASE_SENSITIVE_MODIFIER:
|
if modifier == CASE_SENSITIVE_MODIFIER:
|
||||||
case_sensitive = True
|
case_sensitive = True
|
||||||
elif modifier == REGEX_MODIFIER:
|
elif modifier == REGEX_MODIFIER:
|
||||||
|
|||||||
+6
-2
@@ -2676,7 +2676,8 @@ class Window:
|
|||||||
'sc',
|
'sc',
|
||||||
"""
|
"""
|
||||||
Search the scrollback in place, highlighting every match. Prefix the query with \\c for a case
|
Search the scrollback in place, highlighting every match. Prefix the query with \\c for a case
|
||||||
sensitive search and with \\r for a regular expression. Matches are navigated with n and N and
|
sensitive search and with \\r for a regular expression. To search for those two strings literally,
|
||||||
|
write a double backslash instead (``\\\\c`` and ``\\\\r``). Matches are navigated with n and N and
|
||||||
the search ends with Escape. The [current/total] counter is shown in the window title.
|
the search ends with Escape. The [current/total] counter is shown in the window title.
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
@@ -2691,7 +2692,10 @@ class Window:
|
|||||||
self.clear_scrollback_search()
|
self.clear_scrollback_search()
|
||||||
|
|
||||||
get_boss().get_line(
|
get_boss().get_line(
|
||||||
_('Search the scrollback. Prefix the query with \\c for a case sensitive search and \\r for a regular expression.'),
|
_(
|
||||||
|
'Search the scrollback. Prefix the query with \\c for a case sensitive search and \\r for a regular expression.'
|
||||||
|
' Write a double backslash to search for those strings literally.'
|
||||||
|
),
|
||||||
done,
|
done,
|
||||||
window=self,
|
window=self,
|
||||||
prompt=_('search> '),
|
prompt=_('search> '),
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# License: GPLv3 Copyright: 2026, FWS
|
||||||
|
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
|
from kittens.file_manager.main import change_directory, handle_result
|
||||||
|
|
||||||
|
from .base import BaseTest
|
||||||
|
|
||||||
|
|
||||||
|
class TestFileManager(BaseTest):
|
||||||
|
def test_file_manager(self):
|
||||||
|
"""The documented defaults are the ones the panel starts with."""
|
||||||
|
from kittens.file_manager.main import definition
|
||||||
|
|
||||||
|
options = {o.name: o for o in definition.iter_all_options()}
|
||||||
|
for name, expected in (
|
||||||
|
('show_hidden', 'no'),
|
||||||
|
('sort_by', 'name'),
|
||||||
|
('sync_cwd', 'yes'),
|
||||||
|
):
|
||||||
|
self.assertIn(name, options, f'{name} must be a documented option')
|
||||||
|
self.ae(options[name].defval_as_string, expected, name)
|
||||||
|
self.assertTrue(options[name].long_text, f'{name} must have help text')
|
||||||
|
|
||||||
|
def test_change_directory_at_the_prompt(self):
|
||||||
|
w = MagicMock()
|
||||||
|
w.at_prompt = True
|
||||||
|
change_directory(w, '/tmp/a b')
|
||||||
|
|
||||||
|
w.write_to_child.assert_called_once_with("cd '/tmp/a b'\r")
|
||||||
|
w.paste_text.assert_not_called()
|
||||||
|
|
||||||
|
def test_change_directory_while_a_program_runs(self):
|
||||||
|
# While a program owns the terminal the command is only pasted, so that
|
||||||
|
# it can be reviewed instead of being fed to the program's stdin.
|
||||||
|
w = MagicMock()
|
||||||
|
w.at_prompt = False
|
||||||
|
change_directory(w, "/tmp/it's")
|
||||||
|
|
||||||
|
w.paste_text.assert_called_once_with("cd '/tmp/it'\"'\"'s'")
|
||||||
|
w.write_to_child.assert_not_called()
|
||||||
|
|
||||||
|
def test_result_changes_the_target_window_directory(self):
|
||||||
|
boss = MagicMock()
|
||||||
|
window = MagicMock()
|
||||||
|
boss.window_id_map.get.return_value = window
|
||||||
|
with patch('kittens.file_manager.main.change_directory') as cd:
|
||||||
|
handle_result([], {'action': 'cd', 'path': '/tmp/project'}, 42, boss)
|
||||||
|
|
||||||
|
cd.assert_called_once_with(window, '/tmp/project')
|
||||||
|
boss.ring_bell_if_allowed.assert_not_called()
|
||||||
|
|
||||||
|
def test_result_with_sync_does_not_type_into_the_shell(self):
|
||||||
|
# With sync_cwd on, the panel wrote the directory in the session file
|
||||||
|
# and the shell hook applies it; typing a second cd would move twice.
|
||||||
|
boss = MagicMock()
|
||||||
|
with patch('kittens.file_manager.main.change_directory') as cd:
|
||||||
|
handle_result([], {'action': 'cd', 'path': '/tmp/project', 'sync': True}, 42, boss)
|
||||||
|
|
||||||
|
cd.assert_not_called()
|
||||||
|
boss.window_id_map.get.assert_not_called()
|
||||||
|
|
||||||
|
def test_result_without_the_target_window_rings_the_bell(self):
|
||||||
|
boss = MagicMock()
|
||||||
|
boss.window_id_map.get.return_value = None
|
||||||
|
handle_result([], {'action': 'cd', 'path': '/tmp/project'}, 42, boss)
|
||||||
|
|
||||||
|
boss.ring_bell_if_allowed.assert_called_once()
|
||||||
|
|
||||||
|
def test_result_ignores_incomplete_payloads(self):
|
||||||
|
boss = MagicMock()
|
||||||
|
with patch('kittens.file_manager.main.change_directory') as cd:
|
||||||
|
handle_result([], {}, 42, boss)
|
||||||
|
handle_result([], {'action': 'open', 'path': '/tmp'}, 42, boss)
|
||||||
|
handle_result([], {'action': 'cd'}, 42, boss)
|
||||||
|
|
||||||
|
cd.assert_not_called()
|
||||||
|
boss.ring_bell_if_allowed.assert_not_called()
|
||||||
@@ -46,6 +46,25 @@ class TestScrollbackSearch(BaseTest):
|
|||||||
with self.assertRaises(InvalidQuery):
|
with self.assertRaises(InvalidQuery):
|
||||||
compile_query(parse_query('\\r ('))
|
compile_query(parse_query('\\r ('))
|
||||||
|
|
||||||
|
def test_parse_query_escaped_backslash(self):
|
||||||
|
# A doubled backslash searches text starting with a backslash instead of
|
||||||
|
# being read as a modifier, so both modifier prefixes remain reachable.
|
||||||
|
for raw, expected in (('\\\\c', '\\c'), ('\\\\r', '\\r'), ('\\\\C', '\\C'), ('\\\\', '\\')):
|
||||||
|
with self.subTest(raw=raw):
|
||||||
|
q = parse_query(raw)
|
||||||
|
self.ae((q.text, q.case_sensitive, q.is_regex), (expected, False, False))
|
||||||
|
|
||||||
|
# Modifiers still combine with an escaped prefix in the searched text
|
||||||
|
q = parse_query('\\c\\\\r')
|
||||||
|
self.ae((q.text, q.case_sensitive, q.is_regex), ('\\r', True, False))
|
||||||
|
|
||||||
|
# The escaped prefix is matched like any other text, case insensitively
|
||||||
|
# by default, and the case sensitive modifier still applies to it.
|
||||||
|
matches = find_matches(['a \\c b', 'a \\C b'], parse_query('\\\\c'))
|
||||||
|
self.ae([(m.line, m.start, m.end) for m in matches], [(0, 2, 4), (1, 2, 4)])
|
||||||
|
matches = find_matches(['a \\c b', 'a \\C b'], parse_query('\\c\\\\c'))
|
||||||
|
self.ae([(m.line, m.start, m.end) for m in matches], [(0, 2, 4)])
|
||||||
|
|
||||||
def test_find_matches_plain(self):
|
def test_find_matches_plain(self):
|
||||||
lines = ['needle at start', 'Needle again', 'nothing', 'a needle here']
|
lines = ['needle at start', 'Needle again', 'nothing', 'a needle here']
|
||||||
matches = find_matches(lines, parse_query('needle'))
|
matches = find_matches(lines, parse_query('needle'))
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
pkgname=fws-kitty
|
pkgname=fws-kitty
|
||||||
# Fork version from the version file: it names the release and the package.
|
# Fork version from the version file: it names the release and the package.
|
||||||
# The upstream kitty release built inside is tracked by _kittyver below.
|
# The upstream kitty release built inside is tracked by _kittyver below.
|
||||||
pkgver=0.1.8
|
pkgver=0.1.10
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc='Fast, feature-rich, GPU based terminal (FWS fork with the file-manager kitten)'
|
pkgdesc='Fast, feature-rich, GPU based terminal (FWS fork with the file-manager kitten)'
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
|
|||||||
+2
-1
@@ -100,7 +100,8 @@ ce nom de paquet (relancer une release est sans effet), et demande d'incrémente
|
|||||||
`pkgrel` pour publier un build différent.
|
`pkgrel` pour publier un build différent.
|
||||||
Après l'envoi, il relit aussi le paquet servi et compare son `sha256` à celui du
|
Après l'envoi, il relit aussi le paquet servi et compare son `sha256` à celui du
|
||||||
build, pour ne pas annoncer une publication que les clients ne peuvent pas
|
build, pour ne pas annoncer une publication que les clients ne peuvent pas
|
||||||
installer.
|
installer. Le fichier met quelques secondes à être routé après l'upload : il est
|
||||||
|
retenté pendant deux minutes, et une empreinte différente échoue immédiatement.
|
||||||
|
|
||||||
`pkgver` est la version du fork FWS (fichier `version` à la racine), pas celle
|
`pkgver` est la version du fork FWS (fichier `version` à la racine), pas celle
|
||||||
de kitty : la version amont embarquée est dans `_kittyver`.
|
de kitty : la version amont embarquée est dans `_kittyver`.
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ func ShowError(err error) {
|
|||||||
|
|
||||||
func (self *Command) version_string(formatter *markup.Context) string {
|
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")) +
|
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.8"), "by", formatter.Title("BlackAngelTV"))
|
fmt.Sprintln(formatter.Italic("fws-kitty"), formatter.Opt("0.1.10"), "by", formatter.Title("BlackAngelTV"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Command) ShowVersion() {
|
func (self *Command) ShowVersion() {
|
||||||
|
|||||||
Reference in new issue
Block a user