Compare commits

...

3 commits

Author SHA1 Message Date
Kovid Goyal
cb8fe24ab1
Merge branch 'fix/help-pager-fallback' of https://github.com/Xuyiyang23333/kitty
Some checks are pending
CI / Linux (python=3.13 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.11 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
2026-05-13 04:48:59 +05:30
Xuyiyang23333
c0661024d8 Fix silent failure when pager (less) is not installed
When kitten --help is run in a terminal and less is not available,
ShowHelpInPager silently discards the error from pager.Run(), resulting
in no output and a zero exit code. Fall back to writing help text
directly to stdout when the pager fails, matching the behavior of the
Python equivalent in kitty/cli.py which catches FileNotFoundError and
prints the text as a fallback.

Signed-off-by: Xuyiyang23333 <xuyiyang23333@gmail.com>
2026-05-13 00:37:55 +08:00
Kovid Goyal
824b46507c
Keep text/uri-list as private MIME for kitty to kitty DnD 2026-05-12 13:20:35 +05:30
2 changed files with 14 additions and 3 deletions

View file

@ -4351,12 +4351,21 @@ add_uri_list_drag_items(_GLFWwindow *window, NSMutableArray<NSDraggingItem*>* dr
static int
add_drag_items(_GLFWwindow *window, NSMutableArray<NSDraggingItem*>* dragItems, GLFWDragSourceItem *mime_item, const GLFWimage *thumbnail) {
// URI list items get added directly to the clipboard for use by native apps since macOS does not support
// the text/uri-list MIME type, however this type remains as a private
// kitty type to enable kitty to kitty DnD for remote clients.
bool is_uri_list = false;
if (strcmp(mime_item->mime_type, "text/uri-list") == 0 && mime_item->optional_data && mime_item->data_size) {
return add_uri_list_drag_items(window, dragItems, mime_item->optional_data, mime_item->data_size, mime_item->is_remote_client, thumbnail);
is_uri_list = true;
int err = add_uri_list_drag_items(window, dragItems, mime_item->optional_data, mime_item->data_size, mime_item->is_remote_client, thumbnail);
if (err != 0) return err;
}
NSString* utiString = mime_to_uti(mime_item->mime_type);
id w;
if (mime_item->optional_data) {
// remote client URI list must be set a file promise so that the kitty drag
// source code receives a request for it and can then fetch the remote
// files.
if (mime_item->optional_data && !(is_uri_list && mime_item->is_remote_client)) {
NSPasteboardItem *pbItem = [[[NSPasteboardItem alloc] init] autorelease];
NSData *data = [NSData dataWithBytes:mime_item->optional_data length:mime_item->data_size];
[pbItem setData:data forType:utiString];

View file

@ -131,7 +131,9 @@ func ShowHelpInPager(text string) {
pager.Stdin = strings.NewReader(text)
pager.Stdout = os.Stdout
pager.Stderr = os.Stderr
_ = pager.Run()
if err := pager.Run(); err != nil {
os.Stdout.WriteString(text)
}
}
func getDeterministicTimestamp() time.Time {