mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
@@ -129,6 +129,8 @@ Detailed list of changes
|
|||||||
|
|
||||||
- diff kitten: Add half page and full page scroll vim-like bindings (:pull:`8514`)
|
- diff kitten: Add half page and full page scroll vim-like bindings (:pull:`8514`)
|
||||||
|
|
||||||
|
- diff kitten: Allow diffing named pipes (:iss:`8597`)
|
||||||
|
|
||||||
- Fix a regression that caused automatic color themes to not be re-applied after config file reload (:iss:`8530`)
|
- Fix a regression that caused automatic color themes to not be re-applied after config file reload (:iss:`8530`)
|
||||||
|
|
||||||
- Wayland: When the compositor supports the `xdg-system-bell
|
- Wayland: When the compositor supports the `xdg-system-bell
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"archive/tar"
|
"archive/tar"
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@@ -43,9 +44,33 @@ func isdir(path string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func exists(path string) bool {
|
var temp_files []string
|
||||||
_, err := os.Stat(path)
|
|
||||||
return err == nil
|
func resolve_path(path string) (ans string, err error) {
|
||||||
|
var s fs.FileInfo
|
||||||
|
if s, err = os.Stat(path); err != nil {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if s.Mode()&fs.ModeNamedPipe != 0 {
|
||||||
|
var src, dest *os.File
|
||||||
|
if src, err = os.Open(path); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer src.Close()
|
||||||
|
if dest, err = os.CreateTemp("", fmt.Sprintf("*-pipe-%d", len(temp_files)+1)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer dest.Close()
|
||||||
|
temp_files = append(temp_files, dest.Name())
|
||||||
|
if _, err = io.Copy(dest, src); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return dest.Name(), nil
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return path, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func get_ssh_file(hostname, rpath string) (string, error) {
|
func get_ssh_file(hostname, rpath string) (string, error) {
|
||||||
@@ -136,11 +161,16 @@ func main(_ *cli.Command, opts_ *Options, args []string) (rc int, err error) {
|
|||||||
if isdir(left) != isdir(right) {
|
if isdir(left) != isdir(right) {
|
||||||
return 1, fmt.Errorf("The items to be diffed should both be either directories or files. Comparing a directory to a file is not valid.'")
|
return 1, fmt.Errorf("The items to be diffed should both be either directories or files. Comparing a directory to a file is not valid.'")
|
||||||
}
|
}
|
||||||
if !exists(left) {
|
defer func() {
|
||||||
return 1, fmt.Errorf("%s does not exist", left)
|
for _, path := range temp_files {
|
||||||
|
os.Remove(path)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
if left, err = resolve_path(left); err != nil {
|
||||||
|
return 1, err
|
||||||
}
|
}
|
||||||
if !exists(right) {
|
if right, err = resolve_path(right); err != nil {
|
||||||
return 1, fmt.Errorf("%s does not exist", right)
|
return 1, err
|
||||||
}
|
}
|
||||||
lp, err = loop.New()
|
lp, err = loop.New()
|
||||||
loop.MouseTrackingMode(lp, loop.BUTTONS_AND_DRAG_MOUSE_TRACKING)
|
loop.MouseTrackingMode(lp, loop.BUTTONS_AND_DRAG_MOUSE_TRACKING)
|
||||||
|
|||||||
Reference in New Issue
Block a user