Compare commits

...

29 Commits

Author SHA1 Message Date
Kovid Goyal
fbccfb9d0d version 0.13.3 2019-01-19 14:06:53 +05:30
Kovid Goyal
9fdd8e4ae4 macOS: Fix some kittens causing 100% CPU usage 2019-01-19 14:01:36 +05:30
Kovid Goyal
6b6dea5190 ... 2019-01-19 13:51:18 +05:30
Kovid Goyal
5af551c96d macOS: Fix detection of differ
There can be a wrapper git on macOS that complains about command line
tools installation, so check that passing --help to it actually works.
2019-01-19 12:36:34 +05:30
Kovid Goyal
6761fdca1a ... 2019-01-19 12:16:44 +05:30
Kovid Goyal
725da39ecb macOS: Add aliases for lose window and new tab actions that conform to common Apple shortcuts for these actions
Fixes #1313
2019-01-19 09:18:25 +05:30
Kovid Goyal
9005fc359d Merge branch 'unjam' of https://github.com/jacwah/kitty
Fixes #1312
2019-01-18 22:23:12 +05:30
Jacob Wahlgren
33e4a44008 Unjam event loop when adding pending cocoa action
Fixes the problem reported in
https://github.com/kovidgoyal/kitty/issues/1312.
2019-01-18 17:32:22 +01:00
Kovid Goyal
3bddb9d95b Fix an exception when chaging diff context on very small diffs 2019-01-16 21:24:34 +05:30
Kovid Goyal
fa01e0b76f icat kitten: Add a --stdin option to control if image data is read from stdin
See #1308
2019-01-16 16:35:53 +05:30
Kovid Goyal
f8f188ecff Merge branch 'travis-osx' of https://github.com/stephengroat/kitty 2019-01-16 06:26:02 +05:30
Stephen G
07935d9bd3 Use brew for osx 2019-01-15 15:00:29 -08:00
Kovid Goyal
a827f4190c Merge branch 'fix_white_background_transparency' of https://github.com/Luflosi/kitty 2019-01-14 13:10:15 +05:30
Kovid Goyal
18c108ed03 macOS: Fix a regression that broke mapping of ctrl+tab
Fixes #1304
2019-01-14 10:53:31 +05:30
Kovid Goyal
2d70059f47 Document fix for #1299
Fix #1299
2019-01-14 10:12:05 +05:30
Kovid Goyal
63ff3cfb9f Merge branch 'negative_scroll_alternate_mode' of https://github.com/Luflosi/kitty 2019-01-14 10:10:22 +05:30
Kovid Goyal
ca70f22d46 Add a list of user-created kittens to the docs 2019-01-14 10:03:28 +05:30
Kovid Goyal
c247a6c0cc macOS: Ensure that when running from a bundle, the bundle kitty exe is preferred over any kitty in PATH
Fix #1280
2019-01-14 09:32:49 +05:30
Luflosi
7421a0b9e3 Apply negative scroll multiplier in alternate screen mode
Fixes kovidgoyal/kitty#1299
2019-01-14 00:11:19 +01:00
Kovid Goyal
30b5e8bf8f Merge branch 'patch-1' of https://github.com/robbyoconnor/kitty 2019-01-13 09:50:25 +05:30
Robby O'Connor
96475ce3ee Switch travis to Xenial 2019-01-11 20:53:43 -05:00
Kovid Goyal
24669fb6af Port a couple of fixes from upstream
72c3908e14
cde0aaaab1
2019-01-11 14:20:26 +05:30
Kovid Goyal
851885568f macOS: Fix dragging kitty window tabs in traditional full screen mode causing crashes
Fixes #1296
Apparently, macOS reports NaN DPI values in this scenario.

I dont know enough about cocoa internals to understand why, or
what is actually supposed to happen in this scenario, but at least we
should not crash.
2019-01-11 11:09:34 +05:30
Kovid Goyal
8efbc479e1 Remove unused code 2019-01-09 10:13:43 +05:30
Luflosi
2167bfd5b5 Fix #1221 in a different way 2019-01-08 16:14:41 +01:00
Luflosi
490d4455af Fix white background color not allowing transparency 2019-01-08 16:14:01 +01:00
Kovid Goyal
c94e06ccd2 hints kitten: Start hints numbering at one instead of zero by default. Added an option `--hints-offset` to control it.
Fixes #1289
Fixes #1290
2019-01-08 07:31:54 +05:30
Kovid Goyal
ea37799fb0 Fix linking happening even when not needed 2019-01-06 10:25:37 +05:30
Kovid Goyal
d00fbd73fc Fix a regression in the previous release that broke using `background for cursor_text_color`
Fixes #1288
2019-01-06 10:23:33 +05:30
24 changed files with 162 additions and 55 deletions

View File

@@ -4,7 +4,7 @@ matrix:
fast_finish: true fast_finish: true
include: include:
- os: linux - os: linux
dist: trusty dist: xenial
group: beta group: beta
language: python language: python
sudo: false sudo: false
@@ -12,6 +12,7 @@ matrix:
addons: addons:
apt: apt:
packages: packages:
- libgl1-mesa-dev
- libxi-dev - libxi-dev
- libxrandr-dev - libxrandr-dev
- libxinerama-dev - libxinerama-dev
@@ -20,7 +21,7 @@ matrix:
- libdbus-1-dev - libdbus-1-dev
- os: linux - os: linux
dist: trusty dist: xenial
group: beta group: beta
sudo: false sudo: false
env: env:
@@ -30,6 +31,7 @@ matrix:
addons: addons:
apt: apt:
packages: packages:
- libgl1-mesa-dev
- libfontconfig1-dev - libfontconfig1-dev
- libharfbuzz-dev - libharfbuzz-dev
- libxi-dev - libxi-dev
@@ -42,7 +44,7 @@ matrix:
- python3-pil - python3-pil
- os: linux - os: linux
dist: trusty dist: xenial
group: beta group: beta
sudo: false sudo: false
env: env:
@@ -52,6 +54,7 @@ matrix:
addons: addons:
apt: apt:
packages: packages:
- libgl1-mesa-dev
- libfontconfig1-dev - libfontconfig1-dev
- libharfbuzz-dev - libharfbuzz-dev
- libxi-dev - libxi-dev
@@ -64,7 +67,7 @@ matrix:
- python3-pil - python3-pil
- os: linux - os: linux
dist: trusty dist: xenial
group: beta group: beta
sudo: false sudo: false
env: env:
@@ -74,6 +77,7 @@ matrix:
addons: addons:
apt: apt:
packages: packages:
- libgl1-mesa-dev
- libfontconfig1-dev - libfontconfig1-dev
- libharfbuzz-dev - libharfbuzz-dev
- libxi-dev - libxi-dev
@@ -89,10 +93,13 @@ matrix:
language: generic language: generic
env: SWBASE=/Users/Shared/buildbot/sw SW=$SWBASE/sw PATH=$SW/bin:$PATH env: SWBASE=/Users/Shared/buildbot/sw SW=$SWBASE/sw PATH=$SW/bin:$PATH
# Disabled because harfbuzz is currently broken in brew - os: osx
# - os: osx language: generic
# language: generic addons:
# env: USE_BREW=1 BUILD_PKG=osx-bundle homebrew:
update: true
brewfile: true
env: USE_BREW=1 BUILD_PKG=osx-bundle
env: env:
global: global:
@@ -106,12 +113,6 @@ install: |
if [[ "$RUN_FLAKE" == "1" ]]; then pip install flake8; fi if [[ "$RUN_FLAKE" == "1" ]]; then pip install flake8; fi
if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then
if [[ "$USE_BREW" == "1" ]]; then if [[ "$USE_BREW" == "1" ]]; then
brew update;
# brew upgrade python;
brew install harfbuzz --without-graphite2 --without-icu4c --without-freetype;
brew install imagemagick
brew install optipng
brew install librsvg
logo/make.py logo/make.py
else else
mkdir -p $SW; mkdir -p $SW;

5
Brewfile Normal file
View File

@@ -0,0 +1,5 @@
brew 'imagemagick'
brew 'optipng'
brew 'librsvg'
brew 'harfbuzz'
brew 'python'

View File

@@ -3,6 +3,44 @@ Changelog
|kitty| is a feature full, cross-platform, *fast*, GPU based terminal emulator. |kitty| is a feature full, cross-platform, *fast*, GPU based terminal emulator.
0.13.3 [2019-01-19]
------------------------------
- icat kitten: Add a ``--stdin`` option to control if image data is read from
STDIN (:iss:`1308`)
- hints kitten: Start hints numbering at one instead of zero by default. Added
an option ``--hints-offset`` to control it. (:iss:`1289`)
- Fix a regression in the previous release that broke using ``background`` for
:opt:`cursor_text_color` (:iss:`1288`)
- macOS: Fix dragging kitty window tabs in traditional full screen mode causing
crashes (:iss:`1296`)
- macOS: Ensure that when running from a bundle, the bundle kitty exe is
preferred over any kitty in PATH (:iss:`1280`)
- macOS: Fix a regression that broke mapping of :kbd:`ctrl+tab` (:iss:`1304`)
- Add a list of user-created kittens to the docs
- Fix a regression that broke changing mouse wheel scroll direction with
negative :opt:`wheel_scroll_multiplier` values in full-screen applications
like vim (:iss:`1299`)
- Fix :opt:`background_opacity` not working with pure white backgrounds
(:iss:`1285`)
- macOS: Fix "New OS Window" dock action not working when kitty is not focused
(:iss:`1312`)
- macOS: Add aliases for close window and new tab actions that conform to common
Apple shortcuts for these actions (:iss:`1313`)
- macOS: Fix some kittens causing 100% CPU usage
0.13.2 [2019-01-04] 0.13.2 [2019-01-04]
------------------------------ ------------------------------

View File

@@ -122,7 +122,7 @@ Tabs
======================== ======================= ======================== =======================
Action Shortcut Action Shortcut
======================== ======================= ======================== =======================
New tab :sc:`new_tab` New tab :sc:`new_tab` (also :kbd:`⌘+t` on macOS)
Close tab :sc:`close_tab` Close tab :sc:`close_tab`
Next tab :sc:`next_tab` (also :kbd:`control+tab` on macOS) Next tab :sc:`next_tab` (also :kbd:`control+tab` on macOS)
Previous tab :sc:`previous_tab` (also :kbd:`control+shift+tab` on macOS) Previous tab :sc:`previous_tab` (also :kbd:`control+shift+tab` on macOS)
@@ -141,7 +141,7 @@ Action Shortcut
======================== ======================= ======================== =======================
New window :sc:`new_window` New window :sc:`new_window`
New OS window :sc:`new_os_window` (also :kbd:`⌘+n` on macOS) New OS window :sc:`new_os_window` (also :kbd:`⌘+n` on macOS)
Close window :sc:`close_window` Close window :sc:`close_window` (also :kbd:`⌘+w` on macOS)
Next window :sc:`next_window` Next window :sc:`next_window`
Previous window :sc:`previous_window` Previous window :sc:`previous_window`
Move window forward :sc:`move_window_forward` Move window forward :sc:`move_window_forward`

View File

@@ -43,6 +43,8 @@ Now in :file:`kitty.conf` add the lines::
Start kitty and press :kbd:`ctrl+k` and you should see the kitten running. Start kitty and press :kbd:`ctrl+k` and you should see the kitten running.
The best way to develop your own kittens is to modify one of the built in The best way to develop your own kittens is to modify one of the built in
kittens. Look in the kittens sub-directory of the kitty source code for those. kittens. Look in the kittens sub-directory of the kitty source code for those.
Or see below for a list of :ref:`third-party kittens <external_kittens>`,
that other kitty users have created.
Passing arguments to kittens Passing arguments to kittens
@@ -127,3 +129,18 @@ layout, by simply adding the line::
to the ``handle_result()`` function, above. to the ``handle_result()`` function, above.
.. _external_kittens:
Kittens created by kitty users
---------------------------------------------
`vim-kitty-navigator <https://github.com/knubie/vim-kitty-navigator>`_
Allows you to navigate seamlessly between vim and kitty splits using a consistent set of hotkeys.
`smart-scroll <https://github.com/yurikhan/kitty-smart-scroll>`_
Makes the kitty scroll bindings work in full screen applications
`insert password <https://github.com/kovidgoyal/kitty/issues/1222>`_
Insert a password from a CLI password manager, taking care to only do it at
a password prompt.

View File

@@ -299,6 +299,14 @@ static GLFWbool initializeTIS(void)
////// GLFW platform API ////// ////// GLFW platform API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
static inline bool
is_ctrl_tab(NSEvent *event) {
NSEventModifierFlags modifierFlags = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask;
return event.keyCode == kVK_Tab && (modifierFlags == NSEventModifierFlagControl || modifierFlags == (
NSEventModifierFlagControl | NSEventModifierFlagShift));
}
int _glfwPlatformInit(void) int _glfwPlatformInit(void)
{ {
_glfw.ns.autoreleasePool = [[NSAutoreleasePool alloc] init]; _glfw.ns.autoreleasePool = [[NSAutoreleasePool alloc] init];
@@ -312,8 +320,7 @@ int _glfwPlatformInit(void)
NSEvent* (^keydown_block)(NSEvent*) = ^ NSEvent* (NSEvent* event) NSEvent* (^keydown_block)(NSEvent*) = ^ NSEvent* (NSEvent* event)
{ {
NSEventModifierFlags modifierFlags = [event modifierFlags]; if (is_ctrl_tab(event)) {
if (event.keyCode == kVK_Tab && (modifierFlags == NSEventModifierFlagControl || modifierFlags == (NSEventModifierFlagControl | NSEventModifierFlagShift))) {
// Cocoa swallows Ctrl+Tab to cycle between views // Cocoa swallows Ctrl+Tab to cycle between views
[[NSApp keyWindow].contentView keyDown:event]; [[NSApp keyWindow].contentView keyDown:event];
} }
@@ -323,14 +330,13 @@ int _glfwPlatformInit(void)
NSEvent* (^keyup_block)(NSEvent*) = ^ NSEvent* (NSEvent* event) NSEvent* (^keyup_block)(NSEvent*) = ^ NSEvent* (NSEvent* event)
{ {
NSEventModifierFlags modifierFlags = [event modifierFlags];
if ([event modifierFlags] & NSEventModifierFlagCommand) { if ([event modifierFlags] & NSEventModifierFlagCommand) {
// From http://cocoadev.com/index.pl?GameKeyboardHandlingAlmost // From http://cocoadev.com/index.pl?GameKeyboardHandlingAlmost
// This works around an AppKit bug, where key up events while holding // This works around an AppKit bug, where key up events while holding
// down the command key don't get sent to the key window. // down the command key don't get sent to the key window.
[[NSApp keyWindow] sendEvent:event]; [[NSApp keyWindow] sendEvent:event];
} }
if (event.keyCode == kVK_Tab && (modifierFlags == NSEventModifierFlagControl || modifierFlags == (NSEventModifierFlagControl | NSEventModifierFlagShift))) { if (is_ctrl_tab(event)) {
// Cocoa swallows Ctrl+Tab to cycle between views // Cocoa swallows Ctrl+Tab to cycle between views
[[NSApp keyWindow].contentView keyUp:event]; [[NSApp keyWindow].contentView keyUp:event];
} }

3
glfw/x11_platform.h vendored
View File

@@ -198,9 +198,6 @@ typedef struct _GLFWwindowX11
// The last position the cursor was warped to by GLFW // The last position the cursor was warped to by GLFW
int warpCursorPosX, warpCursorPosY; int warpCursorPosX, warpCursorPosY;
// The time of the last KeyPress event
Time lastKeyTime;
} _GLFWwindowX11; } _GLFWwindowX11;
// X11-specific global data // X11-specific global data

4
glfw/x11_window.c vendored
View File

@@ -2244,10 +2244,14 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
} }
else else
{ {
if (!window->resizable)
updateNormalHints(window, width, height);
XMoveResizeWindow(_glfw.x11.display, window->x11.handle, XMoveResizeWindow(_glfw.x11.display, window->x11.handle,
xpos, ypos, width, height); xpos, ypos, width, height);
} }
XFlush(_glfw.x11.display);
return; return;
} }

View File

@@ -208,7 +208,7 @@ class DiffHandler(Handler):
break break
if num is not None: if num is not None:
self.scroll_pos = min(num, self.max_scroll_pos) self.scroll_pos = max(0, min(num, self.max_scroll_pos))
@property @property
def num_lines(self): def num_lines(self):

View File

@@ -18,7 +18,7 @@ worker_processes = []
def find_differ(): def find_differ():
if shutil.which('git'): if shutil.which('git') and subprocess.Popen(['git', '--help'], stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL).wait() == 0:
return GIT_DIFF return GIT_DIFF
if shutil.which('diff'): if shutil.which('diff'):
return DIFF_DIFF return DIFF_DIFF

View File

@@ -315,8 +315,9 @@ def run(args, text):
return return
largest_index = all_marks[-1].index largest_index = all_marks[-1].index
offset = max(0, args.hints_offset)
for m in all_marks: for m in all_marks:
m.index = largest_index - m.index m.index = largest_index - m.index + offset
index_map = {m.index: m for m in all_marks} index_map = {m.index: m for m in all_marks}
except Exception: except Exception:
import traceback import traceback
@@ -378,6 +379,13 @@ default=auto
choices=auto,always,never choices=auto,always,never
Add trailing space after matched text. Defaults to auto, which adds the space Add trailing space after matched text. Defaults to auto, which adds the space
when used together with --multiple. when used together with --multiple.
--hints-offset
default=1
type=int
The offset (from zero) at which to start hint numbering. Note that only numbers
greater than zero are respected.
'''.format(','.join(sorted(URL_PREFIXES))).format '''.format(','.join(sorted(URL_PREFIXES))).format
help_text = 'Select text from the screen using the keyboard. Defaults to searching for URLs.' help_text = 'Select text from the screen using the keyboard. Defaults to searching for URLs.'
usage = '' usage = ''

View File

@@ -81,6 +81,14 @@ type=bool-set
Print out the window size as :italic:`widthxheight` (in pixels) and quit. This is a Print out the window size as :italic:`widthxheight` (in pixels) and quit. This is a
convenience method to query the window size if using kitty icat from a convenience method to query the window size if using kitty icat from a
scripting language that cannot make termios calls. scripting language that cannot make termios calls.
--stdin
type=choices
choices=detect,yes,no
default=detect
Read image data from stdin. The default is to do it automatically, when STDIN is not a terminal,
but you can turn it off or on explicitly, if needed.
''' '''
@@ -269,9 +277,10 @@ def main(args=sys.argv):
if not sys.stdout.isatty(): if not sys.stdout.isatty():
sys.stdout = open(os.ctermid(), 'w') sys.stdout = open(os.ctermid(), 'w')
stdin_data = None stdin_data = None
if not sys.stdin.isatty(): if args.stdin == 'yes' or (not sys.stdin.isatty() and args.stdin == 'detect'):
stdin_data = sys.stdin.buffer.read() stdin_data = sys.stdin.buffer.read()
items.insert(0, stdin_data) if stdin_data:
items.insert(0, stdin_data)
sys.stdin.close() sys.stdin.close()
sys.stdin = open(os.ctermid(), 'r') sys.stdin = open(os.ctermid(), 'r')
@@ -307,7 +316,7 @@ def main(args=sys.argv):
raise SystemExit('You must specify at least one file to cat') raise SystemExit('You must specify at least one file to cat')
if args.place: if args.place:
if len(items) > 1 or (isinstance(items[0], str) and os.path.isdir(items[0])): if len(items) > 1 or (isinstance(items[0], str) and os.path.isdir(items[0])):
raise SystemExit('The --place option can only be used with a single image') raise SystemExit(f'The --place option can only be used with a single image, not {items}')
sys.stdout.buffer.write(b'\0337') # save cursor sys.stdout.buffer.write(b'\0337') # save cursor
for item in items: for item in items:
is_tempfile = False is_tempfile = False

View File

@@ -153,8 +153,9 @@ class Loop:
def __init__(self, def __init__(self,
sanitize_bracketed_paste='[\x03\x04\x0e\x0f\r\x07\x7f\x8d\x8e\x8f\x90\x9b\x9d\x9e\x9f]'): sanitize_bracketed_paste='[\x03\x04\x0e\x0f\r\x07\x7f\x8d\x8e\x8f\x90\x9b\x9d\x9e\x9f]'):
if is_macos: if is_macos:
# On macOS PTY devices are not supported by the KqueueSelector # On macOS PTY devices are not supported by the KqueueSelector and
self.asycio_loop = asyncio.SelectorEventLoop(selectors.PollSelector()) # the PollSelector is broken, causes 100% CPU usage
self.asycio_loop = asyncio.SelectorEventLoop(selectors.SelectSelector())
asyncio.set_event_loop(self.asycio_loop) asyncio.set_event_loop(self.asycio_loop)
else: else:
self.asycio_loop = asyncio.get_event_loop() self.asycio_loop = asyncio.get_event_loop()

View File

@@ -4,5 +4,5 @@ in vec3 color;
out vec4 final_color; out vec4 final_color;
void main() { void main() {
final_color = vec4(color, background_opacity); final_color = vec4(color * background_opacity, background_opacity);
} }

View File

@@ -72,7 +72,11 @@ vec4 calculate_foreground() {
void main() { void main() {
#ifdef BACKGROUND #ifdef BACKGROUND
#ifdef TRANSPARENT #ifdef TRANSPARENT
final_color = vec4(background.rgb * bg_alpha, bg_alpha); // bg_alpha is doubled to match rendering in the SIMPLE case
// and also rendering of the margin/padding, see https://github.com/kovidgoyal/kitty/pull/1291
// to test use background_opacity, window_margin_width and icat to display
// an image.
final_color = vec4(background.rgb * bg_alpha * bg_alpha, bg_alpha);
#else #else
final_color = vec4(background.rgb, 1.0f); final_color = vec4(background.rgb, 1.0f);
#endif #endif
@@ -101,7 +105,7 @@ void main() {
#else #else
// SIMPLE // SIMPLE
#ifdef TRANSPARENT #ifdef TRANSPARENT
final_color = alpha_blend_premul(fg.rgb, fg.a, background, bg_alpha); final_color = alpha_blend_premul(fg.rgb, fg.a, background * bg_alpha, bg_alpha);
final_color = vec4(final_color.rgb, final_color.a); final_color = vec4(final_color.rgb, final_color.a);
#else #else
// since background alpha is 1.0, it is effectively pre-multiplied // since background alpha is 1.0, it is effectively pre-multiplied

View File

@@ -771,6 +771,9 @@ static unsigned int cocoa_pending_actions = 0;
void void
set_cocoa_pending_action(CocoaPendingAction action) { set_cocoa_pending_action(CocoaPendingAction action) {
cocoa_pending_actions |= action; cocoa_pending_actions |= action;
// The main loop may be blocking on the event queue, if e.g. unfocused.
// Unjam it so the pending action is processed right now.
unjam_event_loop();
} }
#endif #endif

View File

@@ -915,6 +915,8 @@ if is_macos:
k('new_os_window', 'cmd+n', 'new_os_window', _('New OS window')) k('new_os_window', 'cmd+n', 'new_os_window', _('New OS window'))
k('new_os_window', 'kitty_mod+n', 'new_os_window', _('New OS window')) k('new_os_window', 'kitty_mod+n', 'new_os_window', _('New OS window'))
k('close_window', 'kitty_mod+w', 'close_window', _('Close window')) k('close_window', 'kitty_mod+w', 'close_window', _('Close window'))
if is_macos:
k('close_window', 'cmd+w', 'close_window', _('Close window'), add_to_docs=False)
k('next_window', 'kitty_mod+]', 'next_window', _('Next window')) k('next_window', 'kitty_mod+]', 'next_window', _('Next window'))
k('previous_window', 'kitty_mod+[', 'previous_window', _('Previous window')) k('previous_window', 'kitty_mod+[', 'previous_window', _('Previous window'))
k('move_window_forward', 'kitty_mod+f', 'move_window_forward', _('Move window forward')) k('move_window_forward', 'kitty_mod+f', 'move_window_forward', _('Move window forward'))
@@ -935,12 +937,14 @@ k('tenth_window', 'kitty_mod+0', 'tenth_window', _('Tenth window'))
g('shortcuts.tab') # {{{ g('shortcuts.tab') # {{{
if is_macos: if is_macos:
k('next_tab', 'ctrl+tab', 'next_tab', _('Next tab')) k('next_tab', 'ctrl+tab', 'next_tab', _('Next tab'), add_to_docs=False)
k('next_tab', 'kitty_mod+right', 'next_tab', _('Next tab')) k('next_tab', 'kitty_mod+right', 'next_tab', _('Next tab'))
if is_macos: if is_macos:
k('previous_tab', 'ctrl+shift+tab', 'previous_tab', _('Previous tab')) k('previous_tab', 'ctrl+shift+tab', 'previous_tab', _('Previous tab'), add_to_docs=False)
k('previous_tab', 'kitty_mod+left', 'previous_tab', _('Previous tab')) k('previous_tab', 'kitty_mod+left', 'previous_tab', _('Previous tab'))
k('new_tab', 'kitty_mod+t', 'new_tab', _('New tab')) k('new_tab', 'kitty_mod+t', 'new_tab', _('New tab'))
if is_macos:
k('new_tab', 'cmd+t', 'new_tab', _('New tab'), add_to_docs=False)
k('close_tab', 'kitty_mod+q', 'close_tab', _('Close tab')) k('close_tab', 'kitty_mod+q', 'close_tab', _('Close tab'))
k('move_tab_forward', 'kitty_mod+.', 'move_tab_forward', _('Move tab forward')) k('move_tab_forward', 'kitty_mod+.', 'move_tab_forward', _('Move tab forward'))
k('move_tab_backward', 'kitty_mod+,', 'move_tab_backward', _('Move tab backward')) k('move_tab_backward', 'kitty_mod+,', 'move_tab_backward', _('Move tab backward'))

View File

@@ -8,7 +8,7 @@ import sys
from collections import namedtuple from collections import namedtuple
appname = 'kitty' appname = 'kitty'
version = (0, 13, 2) version = (0, 13, 3)
str_version = '.'.join(map(str, version)) str_version = '.'.join(map(str, version))
_plat = sys.platform.lower() _plat = sys.platform.lower()
is_macos = 'darwin' in _plat is_macos = 'darwin' in _plat

View File

@@ -35,8 +35,8 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) {
} }
window->viewport_width = fw; window->viewport_height = fh; window->viewport_width = fw; window->viewport_height = fh;
double xr = window->viewport_x_ratio, yr = window->viewport_y_ratio; double xr = window->viewport_x_ratio, yr = window->viewport_y_ratio;
window->viewport_x_ratio = (double)window->viewport_width / (double)w; window->viewport_x_ratio = w > 0 ? (double)window->viewport_width / (double)w : xr;
window->viewport_y_ratio = (double)window->viewport_height / (double)h; window->viewport_y_ratio = h > 0 ? (double)window->viewport_height / (double)h : yr;
double xdpi = window->logical_dpi_x, ydpi = window->logical_dpi_y; double xdpi = window->logical_dpi_x, ydpi = window->logical_dpi_y;
set_os_window_dpi(window); set_os_window_dpi(window);
bool dpi_changed = (xr != 0.0 && xr != window->viewport_x_ratio) || (yr != 0.0 && yr != window->viewport_y_ratio) || (xdpi != window->logical_dpi_x) || (ydpi != window->logical_dpi_y); bool dpi_changed = (xr != 0.0 && xr != window->viewport_x_ratio) || (yr != 0.0 && yr != window->viewport_y_ratio) || (xdpi != window->logical_dpi_x) || (ydpi != window->logical_dpi_y);
@@ -57,6 +57,19 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) {
} }
} }
// On Cocoa, glfwWaitEvents() can block indefinitely because of the way Cocoa
// works. See https://github.com/glfw/glfw/issues/1251. I have noticed this
// happening in particular with window resize events, when waiting with no
// timeout. See https://github.com/kovidgoyal/kitty/issues/458
// So we use an unlovely hack to workaround that case
void
unjam_event_loop() {
#ifdef __APPLE__
if (event_loop_blocking_with_no_timeout)
wakeup_main_loop();
#endif
}
// callbacks {{{ // callbacks {{{
@@ -98,16 +111,6 @@ show_mouse_cursor(GLFWwindow *w) {
} }
static int min_width = 100, min_height = 100; static int min_width = 100, min_height = 100;
// On Cocoa, glfwWaitEvents() can block indefinitely because of the way Cocoa
// works. See https://github.com/glfw/glfw/issues/1251. I have noticed this
// happening in particular with window resize events, when waiting with no
// timeout. See https://github.com/kovidgoyal/kitty/issues/458
// So we use an unlovely hack to workaround that case
#ifdef __APPLE__
#define unjam_event_loop() { if (event_loop_blocking_with_no_timeout) wakeup_main_loop(); }
#else
#define unjam_event_loop()
#endif
static void static void
framebuffer_size_callback(GLFWwindow *w, int width, int height) { framebuffer_size_callback(GLFWwindow *w, int width, int height) {
@@ -352,8 +355,9 @@ get_window_dpi(GLFWwindow *w, double *x, double *y) {
float xscale = 1, yscale = 1; float xscale = 1, yscale = 1;
if (w) glfwGetWindowContentScale(w, &xscale, &yscale); if (w) glfwGetWindowContentScale(w, &xscale, &yscale);
else glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &xscale, &yscale); else glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &xscale, &yscale);
if (!xscale) xscale = 1.0; // check for zero or NaN values of xscale/yscale
if (!yscale) yscale = 1.0; if (!xscale || xscale != xscale) xscale = 1.0;
if (!yscale || yscale != yscale) yscale = 1.0;
#ifdef __APPLE__ #ifdef __APPLE__
double factor = 72.0; double factor = 72.0;
#else #else

View File

@@ -231,7 +231,7 @@ def _main():
rpath = os.path.dirname(kitty_exe()) rpath = os.path.dirname(kitty_exe())
items = frozenset(os.environ['PATH'].split(os.pathsep)) items = frozenset(os.environ['PATH'].split(os.pathsep))
if rpath and rpath not in items: if rpath and rpath not in items:
os.environ['PATH'] += os.pathsep + rpath os.environ['PATH'] = rpath + os.pathsep + os.environ.get('PATH', '')
args = sys.argv[1:] args = sys.argv[1:]
if is_macos and os.environ.pop('KITTY_LAUNCHED_BY_LAUNCH_SERVICES', None) == '1': if is_macos and os.environ.pop('KITTY_LAUNCHED_BY_LAUNCH_SERVICES', None) == '1':

View File

@@ -615,6 +615,10 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) {
// Only use wheel_scroll_multiplier if we are scrolling kitty scrollback or in mouse // Only use wheel_scroll_multiplier if we are scrolling kitty scrollback or in mouse
// tracking mode, where the application is responsible for interpreting scroll events // tracking mode, where the application is responsible for interpreting scroll events
yoffset *= OPT(wheel_scroll_multiplier); yoffset *= OPT(wheel_scroll_multiplier);
} else if (OPT(wheel_scroll_multiplier) < 0) {
// ensure that changing scroll direction still works, even though
// we are not using wheel_scroll_multiplier
yoffset *= -1;
} }
s = (int) round(yoffset); s = (int) round(yoffset);
// apparently on cocoa some mice generate really small yoffset values // apparently on cocoa some mice generate really small yoffset values

View File

@@ -172,6 +172,7 @@ void make_os_window_context_current(OSWindow *w);
void update_os_window_references(); void update_os_window_references();
void mark_os_window_for_close(OSWindow* w, bool yes); void mark_os_window_for_close(OSWindow* w, bool yes);
void update_os_window_viewport(OSWindow *window, bool); void update_os_window_viewport(OSWindow *window, bool);
void unjam_event_loop();
bool should_os_window_close(OSWindow* w); bool should_os_window_close(OSWindow* w);
bool should_os_window_be_rendered(OSWindow* w); bool should_os_window_be_rendered(OSWindow* w);
void wakeup_main_loop(); void wakeup_main_loop();

View File

@@ -93,7 +93,7 @@ def load_shader_programs(semi_transparent=0):
def setup_colors(screen, opts): def setup_colors(screen, opts):
screen.color_profile.update_ansi_color_table(build_ansi_color_table(opts)) screen.color_profile.update_ansi_color_table(build_ansi_color_table(opts))
cursor_text_color = opts.cursor_text_color or (12, 12, 12) cursor_text_color = opts.cursor_text_color or (12, 12, 12)
cursor_text_color_as_bg = 3 if cursor_text_color is None else 1 cursor_text_color_as_bg = 3 if opts.cursor_text_color is None else 1
screen.color_profile.set_configured_colors(*map(color_as_int, ( screen.color_profile.set_configured_colors(*map(color_as_int, (
opts.foreground, opts.background, opts.cursor, opts.foreground, opts.background, opts.cursor,
cursor_text_color, (0, 0, cursor_text_color_as_bg), cursor_text_color, (0, 0, cursor_text_color_as_bg),

View File

@@ -394,7 +394,8 @@ def compile_c_extension(kenv, module, incremental, compilation_database, all_key
if todo: if todo:
parallel_run(todo) parallel_run(todo)
dest = os.path.join(base, module + '.temp.so') dest = os.path.join(base, module + '.temp.so')
if not incremental or newer(dest, *objects): real_dest = dest[:-len('.temp.so')] + '.so'
if not incremental or newer(real_dest, *objects):
# Old versions of clang don't like -pthread being passed to the linker # Old versions of clang don't like -pthread being passed to the linker
# Don't treat linker warnings as errors (linker generates spurious # Don't treat linker warnings as errors (linker generates spurious
# warnings on some old systems) # warnings on some old systems)
@@ -408,7 +409,7 @@ def compile_c_extension(kenv, module, incremental, compilation_database, all_key
except EnvironmentError: except EnvironmentError:
pass pass
else: else:
os.rename(dest, dest[:-len('.temp.so')] + '.so') os.rename(dest, real_dest)
def find_c_files(): def find_c_files():