73 Commits

Author SHA1 Message Date
Luflosi
5f855ce547
Use context managers to open files
Inspired by d50a6ddc1b.
2019-08-01 13:21:26 -05:00
Kovid Goyal
8ebad06e7e
clipboard kitten: Add a --wait-for-completion option to have the kitten wait till copying to clipboard is complete
Fixes #1693
2019-06-07 07:13:15 +05:30
Luflosi
2b095f720e
Use "with suppress()" to suppress python exceptions
Using
```Python
with suppress(OSError):
    os.remove('somefile.tmp')
```
instead of
```Python
try:
    os.remove('somefile.tmp')
except OSError:
    pass
```
makes the code more compact and more readable IMO.

This pattern was recommended by Raymond Hettinger, a Python Core
Developer in his talk "Transforming Code into Beautiful, Idiomatic Python" at https://www.youtube.com/watch?v=OSGv2VnC0go. The transcript is available at https://github.com/JeffPaine/beautiful_idiomatic_python
2019-06-03 12:27:43 +02:00
Luflosi
a792c94ccf
Use python3 shebang for all python scripts
Fixes #1624.
Use python3 shebang for all python scripts as python still defaults to python2 on many systems.
2019-05-20 14:44:24 +02:00
Kovid Goyal
1c4f5b471d
Fix #1575 2019-04-27 07:58:07 +05:30
Kovid Goyal
9fdd8e4ae4
macOS: Fix some kittens causing 100% CPU usage 2019-01-19 14:01:36 +05:30
Kovid Goyal
8d20dbe81d
Use the ! modifier when resizing images via ImageMagick
Should hopefully make ImageMagick respect the specified width and height
exactly.
2018-08-01 12:03:36 +05:30
Kovid Goyal
2c3235d452
Remove need to call super-class on_resize method 2018-07-15 16:19:54 +05:30
Kovid Goyal
0b662ecb9a
Refactor the kittens tui loop to use asyncio
Gets us timers and various jobs for free, and makes it easier to
integrate with libraries that use asyncio from the larger python
ecosystem.
2018-07-15 15:27:35 +05:30
Kovid Goyal
e8f7a2b345
Dont send on_text events with empty text 2018-06-16 08:55:10 +05:30
Kovid Goyal
6f7ea49008
Switch to high number OSC codes instead of DCS string codes for dynamic color push/pop 2018-06-15 15:21:46 +05:30
Kovid Goyal
cd6a46730a
... 2018-06-15 14:48:59 +05:30
Kovid Goyal
59743fd7a1
diff kitten: Allow theming the selection background/foreground as well 2018-06-15 14:43:39 +05:30
Kovid Goyal
fe3b10a8fb
diff kitten: Implement searching for text in the diff
Fixes #574
2018-06-15 14:28:42 +05:30
Kovid Goyal
82f9f002bd
diff kitten: Fix default foreground/background colors not being restored when kitten quits. Fixes #637 2018-06-14 23:25:13 +05:30
Kovid Goyal
7214b66aa5
A new tui API for simple line editing
Handles basic line-editing with the extended keyboard protocol and
support for wide chars.
Currently used by the unicode input kitten.
2018-06-14 13:11:48 +05:30
Kovid Goyal
02ac2336bd
DRYer 2018-06-09 12:47:52 +05:30
Kovid Goyal
c094ebce07
Set VMIN to 1 as without it poll() returns immediately even when no data is available to read on macOS 2018-06-09 11:17:12 +05:30
Kovid Goyal
65ed9c759c
... 2018-06-09 11:10:58 +05:30
Kovid Goyal
83fe2438f9
Forgot to port the exception handler loop 2018-06-09 11:08:25 +05:30
Kovid Goyal
caa20aa081
Use the new tty code in tui as well 2018-06-09 09:06:48 +05:30
Kovid Goyal
19721014d0
Remote control: Fix kitty @ sometimes failing to read the response from kitty.
Fixes #614
2018-06-08 15:35:01 +05:30
Kovid Goyal
97c317b735
Make screen_size handling in tui cleaner
Now screen size is fetched only for output_fd rather than sys.stdout
2018-06-06 11:20:55 +05:30
Kovid Goyal
dab57f3819
When receiving contiguous non-empty OSC 52 clipboard writes, combine them.
Max combined text is set at 1MB. Allows sending texts larger than the
escape code size limit.
2018-05-28 21:50:42 +05:30
Kovid Goyal
4b259dd719
diff kitten: Make the keyboard shortcuts configurable
Fixes #563
2018-05-23 13:10:32 +05:30
Kovid Goyal
d3edd2e73f
Add a kitten to get/set the clipboard via OSC 52 2018-05-21 23:24:27 +05:30
Kovid Goyal
70352ca722
kittens: Don't fail on systems that return invalid values for SC_IOV_MAX. Fixes #558 2018-05-21 12:22:46 +05:30
Kovid Goyal
fa3e173c18
diff kitten: Report errors converting images 2018-05-20 15:01:25 +05:30
Kovid Goyal
fb57653665
Make debugging kittens a little nicer
Now debug() writes to the stderr of the parent kitty process instead of
a temp file.
2018-05-19 16:32:08 +05:30
Kovid Goyal
8ea84c97d5
Use an overlay window for window resizing
Also implement a remote command to resize windows
2018-05-17 23:26:41 +05:30
Kovid Goyal
b8e9921f3d
Forgot this file in previous commit 2018-05-10 16:20:58 +05:30
Kovid Goyal
e0ce5d5629
tui: Cleanup unhandled exception processing
Also handler finalization should happen before term manager
finalization.
2018-05-10 16:20:33 +05:30
Kovid Goyal
ee3b052a50
tui: Preserve cursor position when placing images 2018-05-10 15:27:35 +05:30
Kovid Goyal
a6bce0b221
diff: More work on showing images 2018-05-10 14:33:09 +05:30
Kovid Goyal
d571ee0d01
diff: More work on displaying images 2018-05-10 11:50:46 +05:30
Kovid Goyal
5d7ed67316
diff: More work on displaying images 2018-05-10 10:36:50 +05:30
Kovid Goyal
2e313fbdd2
Better exception for image conversion failure 2018-05-09 20:50:56 +05:30
Kovid Goyal
5c3e4db05f
DRYer 2018-05-09 20:36:53 +05:30
Kovid Goyal
2be2f6aa0c
Make icat a kitten
The kittens framework did not exist when icat was first written.
2018-05-09 20:26:30 +05:30
Kovid Goyal
27feccba39
diff: More work on image support 2018-05-09 19:41:37 +05:30
Kovid Goyal
2e69b904da
diff: More work on images 2018-05-09 14:06:15 +05:30
Kovid Goyal
683e5a4754
DRYer 2018-05-09 11:32:09 +05:30
Kovid Goyal
d133ffac25
Make using tui.operations more convenient 2018-05-06 15:34:11 +05:30
Kovid Goyal
ffc6e65392
Implement scrolling for the diff kitten 2018-05-06 14:41:10 +05:30
Kovid Goyal
d61086907d
Add a global debug function to the kittens 2018-05-06 13:48:40 +05:30
Kovid Goyal
5c4b14468c
Apply default colors in diff kitten 2018-04-24 10:33:18 +05:30
Kovid Goyal
b5da109e7f
Wire up config infrastructure for diff kitten 2018-04-22 21:44:47 +05:30
Kovid Goyal
20c42ab519
tui: Allow handlers to finalize() as well as initialize() 2018-04-22 13:14:25 +05:30
Kovid Goyal
92bb6e293a
Add threaded job infrastructure to tui 2018-04-20 21:12:10 +05:30
Kovid Goyal
d5907a1bf9
More work on the diff kitten 2018-04-19 10:26:14 +05:30