Compare commits

..

14 Commits

Author SHA1 Message Date
Kovid Goyal
1bfb1de7fc version 0.35.1 2024-05-31 14:22:58 +05:30
Kovid Goyal
f3d8cf5d29 Add tdf as a terminal PDF viewer that uses the kitty graphics protocol 2024-05-30 21:20:31 +05:30
Kovid Goyal
beb42d571b Forgot to use aspect ratio calculation when only one of r/c is specified for determining cursor position and image cell overlaps. Fixes #7479 2024-05-28 21:30:26 +05:30
Kovid Goyal
5e2fc4e90f Fix a regression in the previous release causing an error when setting background_opacity to zero
Fixes #7483
2024-05-28 20:03:10 +05:30
Kovid Goyal
48070ff38e Fix #7481 2024-05-28 15:14:13 +05:30
Kovid Goyal
57b6cec900 Update changelog 2024-05-28 10:29:12 +05:30
Kovid Goyal
55417e4269 Move the window context changing during show fix into glfw code
It more logically belongs there.
2024-05-28 09:46:16 +05:30
Kovid Goyal
9837531b63 Wayland: Fix a regression in 0.34 that caused the tab bar to not render in second and subsequent OS Windows under Hyprland
Fixes #7413
2024-05-28 09:12:37 +05:30
Kovid Goyal
149a26ce51 Merge branch 'typo-fixes' of https://github.com/RMGiroux/kitty 2024-05-27 20:25:14 +05:30
Mike Giroux
4aeb32cc4f Trivial "It's"->"Its" fix 2024-05-27 10:44:03 -04:00
Kovid Goyal
85280b0304 ... 2024-05-27 10:53:41 +05:30
Kovid Goyal
c57f65079f Forgot Apple likes to scroll backwards
Fixes #7475
2024-05-27 10:51:40 +05:30
Kovid Goyal
80d544c19f Merge branch 'dependabot/go_modules/all-go-deps-f3d74fa127' of https://github.com/kovidgoyal/kitty 2024-05-27 08:59:30 +05:30
dependabot[bot]
827a70bb86 Bump github.com/alecthomas/chroma/v2 in the all-go-deps group
Bumps the all-go-deps group with 1 update: [github.com/alecthomas/chroma/v2](https://github.com/alecthomas/chroma).


Updates `github.com/alecthomas/chroma/v2` from 2.13.0 to 2.14.0
- [Release notes](https://github.com/alecthomas/chroma/releases)
- [Changelog](https://github.com/alecthomas/chroma/blob/master/.goreleaser.yml)
- [Commits](https://github.com/alecthomas/chroma/compare/v2.13.0...v2.14.0)

---
updated-dependencies:
- dependency-name: github.com/alecthomas/chroma/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-go-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-27 03:14:55 +00:00
13 changed files with 57 additions and 22 deletions

View File

@@ -50,6 +50,18 @@ consumption to do the same tasks.
Detailed list of changes
-------------------------------------
0.35.1 [2024-05-31]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Wayland: Fix a regression in 0.34 that caused the tab bar to not render in second and subsequent OS Windows under Hyprland (:iss:`7413`)
- Fix a regression in the previous release that caused horizontal scrolling via touchpad in fullscreen applications to be reversed on non-Wayland platforms (:iss:`7475`, :iss:`7481`)
- Fix a regression in the previous release causing an error when setting background_opacity to zero (:iss:`7483`)
- Image display: Fix cursor movement and image hit region incorrect for image placements that specify only a number of rows or columns to display in (:iss:`7479`)
0.35.0 [2024-05-25]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -20,6 +20,12 @@ images and other types of documents directly in your terminal, even over SSH.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A terminal PDF/DJVU/CBR viewer
.. _tool_tdf:
`tdf <https://github.com/itsjunetime/tdf>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A terminal PDF viewer
.. _tool_mdcat:
`mdcat <https://github.com/lunaryorn/mdcat>`_

2
glfw/wl_init.c vendored
View File

@@ -224,7 +224,7 @@ pointer_handle_frame(void *data UNUSED, struct wl_pointer *pointer UNUSED) {
if (x != 0.0f || y != 0.0f) {
float scale = (float)_glfwWaylandWindowScale(window);
y *= scale; x *= scale;
_glfwInputScroll(window, x, y, highres, _glfw.wl.xkb.states.modifiers);
_glfwInputScroll(window, -x, y, highres, _glfw.wl.xkb.states.modifiers);
}
}

4
glfw/wl_window.c vendored
View File

@@ -896,6 +896,7 @@ attach_temp_buffer_during_window_creation(_GLFWwindow *window) {
static void
loop_till_window_fully_created(_GLFWwindow *window) {
if (!window->wl.window_fully_created) {
GLFWwindow *ctx = glfwGetCurrentContext();
debug("Waiting for compositor to send fractional scale for window %llu\n", window->id);
monotonic_t start = monotonic();
while (!window->wl.window_fully_created && monotonic() - start < ms_to_monotonic_t(300)) {
@@ -904,6 +905,9 @@ loop_till_window_fully_created(_GLFWwindow *window) {
}
}
window->wl.window_fully_created = true;
// If other OS windows were resized when this window is shown, the ctx might have been changed by
// user code, restore it to whatever it was at the start.
if (glfwGetCurrentContext() != ctx) glfwMakeContextCurrent(ctx);
}
}

2
go.mod
View File

@@ -4,7 +4,7 @@ go 1.22
require (
github.com/ALTree/bigfloat v0.2.0
github.com/alecthomas/chroma/v2 v2.13.0
github.com/alecthomas/chroma/v2 v2.14.0
github.com/bmatcuk/doublestar/v4 v4.6.1
github.com/dlclark/regexp2 v1.11.0
github.com/edwvee/exiffix v0.0.0-20240229113213-0dbb146775be

8
go.sum
View File

@@ -1,9 +1,9 @@
github.com/ALTree/bigfloat v0.2.0 h1:AwNzawrpFuw55/YDVlcPw0F0cmmXrmngBHhVrvdXPvM=
github.com/ALTree/bigfloat v0.2.0/go.mod h1:+NaH2gLeY6RPBPPQf4aRotPPStg+eXc8f9ZaE4vRfD4=
github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU=
github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/chroma/v2 v2.13.0 h1:VP72+99Fb2zEcYM0MeaWJmV+xQvz5v5cxRHd+ooU1lI=
github.com/alecthomas/chroma/v2 v2.13.0/go.mod h1:BUGjjsD+ndS6eX37YgTchSEG+Jg9Jv1GiZs9sqPqztk=
github.com/alecthomas/assert/v2 v2.7.0 h1:QtqSACNS3tF7oasA8CU6A6sXZSBDqnm7RfpLl9bZqbE=
github.com/alecthomas/assert/v2 v2.7.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E=
github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I=
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I=

View File

@@ -838,7 +838,7 @@ func EntryPoint(parent *cli.Command) {
func specialize_command(ssh *cli.Command) {
ssh.Usage = "arguments for the ssh command"
ssh.ShortDescription = "Truly convenient SSH"
ssh.HelpText = "The ssh kitten is a thin wrapper around the ssh command. It automatically enables shell integration on the remote host, re-uses existing connections to reduce latency, makes the kitty terminfo database available, etc. It's invocation is identical to the ssh command. For details on its usage, see :doc:`/kittens/ssh`."
ssh.HelpText = "The ssh kitten is a thin wrapper around the ssh command. It automatically enables shell integration on the remote host, re-uses existing connections to reduce latency, makes the kitty terminfo database available, etc. Its invocation is identical to the ssh command. For details on its usage, see :doc:`/kittens/ssh`."
ssh.IgnoreAllArgs = true
ssh.OnlyArgsAllowed = true
ssh.ArgCompleter = cli.CompletionForWrapper("ssh")

View File

@@ -1325,7 +1325,7 @@ class Boss:
tm.resize()
def _set_os_window_background_opacity(self, os_window_id: int, opacity: float) -> None:
change_background_opacity(os_window_id, max(0.1, min(opacity, 1.0)))
change_background_opacity(os_window_id, max(0.0, min(opacity, 1.0)))
@ac('win', '''
Set the background opacity for the active OS Window

View File

@@ -22,7 +22,7 @@ class Version(NamedTuple):
appname: str = 'kitty'
kitty_face = '🐱'
version: Version = Version(0, 35, 0)
version: Version = Version(0, 35, 1)
str_version: str = '.'.join(map(str, version))
_plat = sys.platform.lower()
is_macos: bool = 'darwin' in _plat

View File

@@ -798,14 +798,26 @@ static void
update_dest_rect(ImageRef *ref, uint32_t num_cols, uint32_t num_rows, CellPixelSize cell) {
uint32_t t;
if (num_cols == 0) {
t = (uint32_t)(ref->src_width + ref->cell_x_offset);
num_cols = t / cell.width;
if (t > num_cols * cell.width) num_cols += 1;
if (num_rows == 0) {
t = (uint32_t)(ref->src_width + ref->cell_x_offset);
num_cols = t / cell.width;
if (t > num_cols * cell.width) num_cols += 1;
} else {
double height_px = cell.height * num_rows + ref->cell_y_offset;
double width_px = height_px * ref->src_width / (double) ref->src_height;
num_cols = (uint32_t)ceil(width_px / cell.width);
}
}
if (num_rows == 0) {
t = (uint32_t)(ref->src_height + ref->cell_y_offset);
num_rows = t / cell.height;
if (t > num_rows * cell.height) num_rows += 1;
if (num_cols == 0) {
t = (uint32_t)(ref->src_height + ref->cell_y_offset);
num_rows = t / cell.height;
if (t > num_rows * cell.height) num_rows += 1;
} else {
double width_px = cell.width * num_cols + ref->cell_x_offset;
double height_px = width_px * ref->src_height / (double)ref->src_width;
num_rows = (uint32_t)ceil(height_px / cell.height);
}
}
ref->effective_num_rows = num_rows;
ref->effective_num_cols = num_cols;

View File

@@ -973,7 +973,7 @@ scroll_event(double xoffset, double yoffset, int flags, int modifiers) {
s = scale_scroll(screen->modes.mouse_tracking_mode, xoffset, is_high_resolution, &screen->pending_scroll_pixels_x, global_state.callback_os_window->fonts_data->cell_width);
if (s) {
if (screen->modes.mouse_tracking_mode) {
int sz = encode_mouse_scroll(w, s < 0 ? 6 : 7, modifiers);
int sz = encode_mouse_scroll(w, s > 0 ? 6 : 7, modifiers);
if (sz > 0) {
mouse_event_buf[sz] = 0;
for (s = abs(s); s > 0; s--) {

View File

@@ -67,7 +67,7 @@ equal to the specified value, otherwise it will be set to the specified value.
raise OpacityError('You must turn on the dynamic_background_opacity option in kitty.conf to be able to set background opacity')
windows = self.windows_for_payload(boss, window, payload_get)
for os_window_id in {w.os_window_id for w in windows if w}:
val: float = payload_get('opacity')
val: float = payload_get('opacity') or 0.
if payload_get('toggle'):
current = background_opacity_of(os_window_id)
if current == val:

View File

@@ -548,7 +548,7 @@ class TestGraphics(BaseTest):
def test_image_put(self):
cw, ch = 10, 20
s, dx, dy, put_image, put_ref, layers, rect_eq = put_helpers(self, cw, ch)
self.ae(put_image(s, 10, 20)[1], 'OK')
self.ae(put_image(s, cw, ch)[1], 'OK')
l0 = layers(s)
self.ae(len(l0), 1)
rect_eq(l0[0]['src_rect'], 0, 0, 1, 1)
@@ -556,7 +556,7 @@ class TestGraphics(BaseTest):
self.ae(l0[0]['group_count'], 1)
self.ae(s.cursor.x, 1), self.ae(s.cursor.y, 0)
src_width, src_height = 3, 5
iid, (code, idstr) = put_ref(s, num_cols=s.columns, x_off=2, y_off=1, width=src_width, height=src_height,
iid, (code, idstr) = put_ref(s, num_cols=s.columns, num_lines=1, x_off=2, y_off=1, width=src_width, height=src_height,
cell_x_off=3, cell_y_off=1, z=-1, placement_id=17)
self.ae(idstr, f'i={iid},p=17')
l2 = layers(s)
@@ -566,15 +566,16 @@ class TestGraphics(BaseTest):
self.ae(l2[0]['group_count'], 2)
left, top = -1 + dx + 3 * dx / cw, 1 - 1 * dy / ch
right = -1 + (1 + s.columns) * dx
width_px = ((right - left) / 2) * (cw * s.columns)
height_px = width_px * (src_height / src_width)
bottom = top - (height_px / (ch * s.lines)) * 2
bottom = 1 - dy
rect_eq(l2[0]['dest_rect'], left, top, right, bottom)
self.ae(s.cursor.x, 0), self.ae(s.cursor.y, 1)
self.ae(put_image(s, 10, 20, cursor_movement=1)[1], 'OK')
self.ae(s.cursor.x, 0), self.ae(s.cursor.y, 1)
s.reset()
self.assertEqual(s.grman.disk_cache.total_size, 0)
self.ae(put_image(s, 2*cw, 2*ch, num_cols=3)[1], 'OK')
self.ae((s.cursor.x, s.cursor.y), (3, 2))
rect_eq(layers(s)[0]['dest_rect'], -1, 1, -1 + 3 * dx, 1 - 3*dy)
def test_image_layer_grouping(self):
cw, ch = 10, 20