115 Commits

Author SHA1 Message Date
Kovid Goyal
45b2678db1 Allow backspace to wrap cursor to previous line
Fixes #8841
2025-07-23 08:56:54 +05:30
Kovid Goyal
24a195c7c7 Graphics: Fix deletion of images by id not working for images with no placements 2024-12-24 09:39:01 +05:30
Kovid Goyal
8facaf4fa0 Graphics: Fix deleted but not freed images without any references being incorrectly freed on a subsequent delete command 2024-12-18 09:25:06 +05:30
Kovid Goyal
cb2e1fcd04 Graphics protocol: Fix delete by number not deleting newest image with the specified number
Fixes #8071
2024-11-24 10:11:34 +05:30
Kovid Goyal
70d72b22d8 Graphics protocol: Clear any partially uploaded data for a chunked load when any delete command is received
Fixes #7968
2024-10-13 09:49:44 +05:30
Kovid Goyal
a0dc062032 Fix render cache not being used 2024-07-23 15:07:41 +05:30
Kovid Goyal
8201f0dd0e Move caching implementation to Python
Less code, more performant since the cache is used from Python.
And we can make the Go code a pure image format conversion filter.
2024-07-23 13:37:53 +05:30
Kovid Goyal
d08dcd92c7 Python wrapper to use image to RGBA Go code 2024-07-22 22:39:12 +05:30
Kovid Goyal
2ba28171ab DRYer 2024-07-16 10:45:46 +05:30
Kovid Goyal
c056df223e Nicer way to prevent defrag 2024-07-16 07:43:50 +05:30
Kovid Goyal
9a50e453b2 Ensure defrag doesnt run when testing hole coalescing 2024-07-15 22:41:22 +05:30
Kovid Goyal
24e6dda0bc disk-cache: Improve hole management
Make coalescing of neighboring holes robust. Speed up hole finding.
Cost is we replace a single array tracking holes with three hashmaps
tracking size->[pos] pos->size and endpos->size.
2024-07-15 21:13:59 +05:30
Kovid Goyal
2058cac203 Now the test should be fully robust 2024-07-15 09:29:30 +05:30
Kovid Goyal
a49bb8c5f9 DRYer 2024-07-15 09:24:19 +05:30
Kovid Goyal
638a4b19ee ... 2024-07-15 09:19:13 +05:30
Kovid Goyal
aaf7808328 Add explicit check for holes in test 2024-07-15 09:05:44 +05:30
Kovid Goyal
85f49c4310 ... 2024-07-15 08:52:21 +05:30
Kovid Goyal
d93e91d115 Fix flaky test 2024-07-14 14:31:47 +05:30
Kovid Goyal
bc8c4ac3d6 migrate graphics code to verstable 2024-07-12 11:45:48 +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
82ab44826c Graphics: Fix aspect ratio of images not being preserved when only a single dimension of the destination rectangle is specified
Fixes #7380
2024-04-24 12:28:35 +05:30
Kovid Goyal
1a9a7a59ac Make XOR64 test also test alignment issues 2024-02-25 09:57:44 +05:30
Kovid Goyal
c19488f3be Graphics protocol: Add a new delete mode for deleting images whose ids fall within a range
Useful for bulk deletion. See #7080
2024-02-25 09:57:44 +05:30
Kovid Goyal
ad3ab877f8 Use a fast SIMD implementation to XOR data going into the disk cache 2024-02-25 09:57:43 +05:30
Kovid Goyal
de92470f0d Improve performance of disk cache when there are thousands of small images
Fixes #7080
2024-02-25 09:57:43 +05:30
Kovid Goyal
409ca6bfab Allow larger graphics escape code sizes 2024-02-25 09:57:25 +05:30
Kovid Goyal
5168e0b576 Port parse_bytes() used in the tests 2024-02-25 09:57:22 +05:30
Kovid Goyal
77292a16d6 Make shebangs consistent
Follow PEP 0394 and use /usr/bin/env python so that the python in the
users venv is respected. Not that the kitty python files are meant to be
executed standalone anyway, but, whatever.

Fixes #6810
2023-11-11 08:32:05 +05:30
Kovid Goyal
52d5a4679f Graphics protocol: Support for positioning images relative to other images
Fixes #6617
2023-10-27 15:27:30 +05:30
Sergei Grechanik
63cc5d7e49 Fix erasure of unicode placeholder images on reset 2023-09-03 15:33:30 -07:00
Kovid Goyal
951951776a Ensure group_count is never zero in any ImageRef
Now group_count means the number of refs pointing to the same image from
that ref onwards. This is needed because we can index the list of refs
at any point when drawing not just at the start of a group.

Fixes #6594
2023-09-02 12:48:44 +05:30
Kovid Goyal
af724090d2 Add a non-delete test as well 2023-06-14 09:44:51 +05:30
Kovid Goyal
4c5f4c4baf Apparently Python 3.12 no longer raises FileNotFoundError when closing a deleted file
Fixes #6360 (I hope) dont have time to actually test with pre-release
python builds
2023-06-14 08:06:47 +05:30
Sergei Grechanik
d63eeada73 Image placement using Unicode placeholders
This commit introduces the Unicode placeholder image placement method.
In particular:
- Virtual placements can be created by passing `U=1` in a put command.
- Images with virtual placements can be displayed using the placeholder
  character `U+10EEEE` with diacritics indicating rows and columns.
- The image ID is indicated by the foreground color of the placeholder.
  Additionally, the most significant byte of the ID can be specified via
  the third diacritic.
- Underline color can be optionally used to specify the placement ID.
- A bug was fixed, which caused incomplete image removal when it was
  overwritten by another image with the same ID.
2023-02-21 18:23:16 -08:00
Kovid Goyal
7fe5d7b58f Replace isort with ruff 2023-01-09 16:47:42 +05:30
Kovid Goyal
a068e3e655 Fix issues reported by ruff 2023-01-09 15:54:41 +05:30
Sergei Grechanik
32d8aac808 Fix scrolling images within margins
This commit fixes an off-by-one error in image scrolling that caused
images to not be scrolled or to be cropped at the wrong line.
2022-12-25 15:34:54 -08:00
Kovid Goyal
d0c50248ea Graphics protocol: Only delete temp files if they have the string tty-graphics-protocol in their file paths.
This prevents deletion of arbitrary files in /tmp via the graphics
protocol.
2022-08-16 11:25:33 +05:30
Kovid Goyal
362c4147e4 ... 2022-01-08 12:21:55 +05:30
Luflosi
e82e57a30c Remove unused code
Since 99d9cb0b0d runs all tests with HOME set to a temporary directory, this code setting the cache directory to a temporary directory is no longer needed. `cache_dir()` will choose a directory in the home directory if neither KITTY_CACHE_DIRECTORY or XDG_CACHE_HOME are set.
2021-10-31 11:42:55 +01:00
Kovid Goyal
6546c1da9b run pyupgrade to upgrade the codebase to python3.6 2021-10-21 12:43:55 +05:30
Kovid Goyal
340159b591 Graphics protocol: Support for frame composition
Fixes #3809
2021-07-22 18:58:59 +05:30
Kovid Goyal
1d9626d493 Graphics protocol: Fix image without placements being deleted when screen scrolls 2021-07-10 14:05:53 +05:30
Kovid Goyal
83bbcf0aa1 Graphics protocol: Add a control to allow clients to specify that the cursor should not move when displaying an image
Fixes #3411
2021-03-22 22:16:40 +05:30
Kovid Goyal
9fdaef1da6 Graphics protocol: Fix suppression of responses not working for chunked transmission
Now the starting escape codes q value is used unless the last escape
code specifies a non-zero q value of its own. Fixes #3375
2021-03-10 09:58:49 +05:30
Kovid Goyal
38992e25d7 Make the tests into a package
Useful to make the tests runnable in a frozen build.
2021-02-19 14:35:25 +05:30
Kovid Goyal
625f0f77bb Ensure disk cache is cleared 2021-02-19 09:43:57 +05:30
Kovid Goyal
0341b64748 Allow caching of disk cache entries in RAM 2021-02-18 10:22:42 +05:30
Kovid Goyal
fe07306ff1 Use a nicer decorator for functions that only need to be run once 2021-02-05 10:40:52 +05:30
Kovid Goyal
4ba35d4a93 Clear cache_dir lru cache when testing 2021-02-05 09:56:17 +05:30