Comments (9)
I also had a quick other unrelated question, I don't think it's possible to delete all images stored by kitty at once, as the
d=A
key will not delete virtual refs. I am deleting them by id for now but would it be possible to have a delete command for all images, including Unicode placeholders?
Unicode placeholders can only be deleted by deleting their associated
text, otherwise there are various issues as the lifetimes of unicode
placeholders are not tied to the underlying image data.
@sergei-grechanik should be able to elucidate those issues.
from kitty.
This should be fixed in the vt branch. I havent tested the performance,
but find_hole() is now O(1)
from kitty.
Wouldn't a simple fix be to have a deletion counter which tracks the
largest available hole size and its position in the file and the number
of holes. Only call find_hole
(largest_hole_size == 0 && num_of_holes > 0) || (largest_hole_size > required_size)
this way for your case of appending lots of images without a deletion,
find_hole wont be called until the cache is full. Once the cache is full
one would evict the oldest n images such that n is as small as possible
and the total size of the evicted images is greater than required_size.
So once again we can avoid calling find_hole.
Of course once deletions come into play, find_hole becomes necessary,
but again its frequency can be reduced by only doing it when cache is
limit is reached and then, depending on the value of the deletion
counter, either call find_hole or do a defrag.
Indeed, one could even maintain a list of the last N holes rather than
simply tracking the number and max size for more sophisticated handling.
from kitty.
I think keeping a list of all holes would make it possible to avoid calling find_hole completely.
It would also mean that one needs to handle merging adjacent holes, and this is probably an expensive operation. Calling defrag when the number of holes becomes too large might solve this issue.
In any case, any solution that avoids sorting the list of entries too often should be faster, and solve my issue.
I also had a quick other unrelated question, I don't think it's possible to delete all images stored by kitty at once, as the d=A
key will not delete virtual refs. I am deleting them by id for now but would it be possible to have a delete command for all images, including Unicode placeholders?
from kitty.
Yes, the intended approach when using Unicode placeholders is to erase the text and let the image itself be deleted automatically when the total size/count limit is reached. Deleting an image by id is ok too, but it's still recommended to erase the placeholder text, because there is no guarantee that a redraw will be triggered.
Adding a key to delete all images, including virtual ones, is possible, but I wouldn't recommend actually using it, since it will break images in other panes/windows when running in tmux, for example. (However, there is still value in having such a key for testing purposes).
from kitty.
Okay, I was interested in just cleaning up when my program exits, and at this point the screen does not have any placeholders, and will not use the images anymore. The size limit won't get reached either.
I think for my purpose deleting them by id is fine, but having a key for all of them would be a nice to have. Especially since removing them one by one is actually O(n!) instead of O(n), if I interpreted the code correctly.
from kitty.
I just tested it and it works great, thanks a lot!
from kitty.
I also just added a new deletion mode to delete images by range of ids. You can specify the upper limit of the range to be the max image id value to delete all images.
cebdc93
from kitty.
Nice, thanks again!
from kitty.
Related Issues (20)
- Build-time gcc detection fails if e.g. CC=x86_64-pc-linux-gnu-gcc (CC=gcc is fine) HOT 1
- The letter "f" looks weird in the title of the active tab when using the UbuntuMono Nerd Font HOT 1
- Minimized app uses default icon instead of custom one HOT 1
- bash: kitten: command not found HOT 1
- No window shadow on macOS HOT 3
- Kitty becomes unresponsive when using neovim HOT 1
- Cmd+K does not clear images on MacOS HOT 5
- Making `kitty icat` work in tmux popup HOT 4
- Monaspace not working HOT 1
- Box drawing char misalign HOT 1
- Fish shell integration automatically completes currently shown completion HOT 8
- Graphical glitching when using set-background-opacity and set-background-image HOT 2
- update to python3.12 HOT 1
- Other options in detach_window HOT 2
- Error on start: "EGL: Failed to create window surface: Arguments are inconsistent" HOT 8
- hints kitten with customized processing crashes with slice out of bounds on certain input HOT 1
- Linux Libertine Mono doesn't load HOT 2
- Feature request: show date each window was created in `kitty @ ls`.
- keyboard protocol: clarification on locked modifiers HOT 6
- Support for ESC X character strings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kitty.