summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/changelog.rst8
-rw-r--r--docs/index.rst4
-rw-r--r--glfw/xkb_glfw.c4
-rw-r--r--kitty/boss.py15
-rw-r--r--kitty/cmds.py16
-rw-r--r--kitty/config_data.py7
-rw-r--r--kitty/glfw.c2
-rw-r--r--kitty/tabs.py8
-rw-r--r--kitty/window.py4
9 files changed, 55 insertions, 13 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 8d817240..b4e849b5 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -21,6 +21,9 @@ Changelog
full-screen/maximized/minimized. This replaces the ``--start-in-fullscreen``
flag introduced in the previous release (:iss:`935`)
+- When mapping the ``new_tab`` action allow specifying that the tab should open
+ next to the current tab instead of at the end of the tabs list (:iss:`979`)
+
- macOS: Add a new :opt:`macos_thicken_font` to make text rendering
on macs thicker, which makes it similar to the result of
sub-pixel antialiasing (:pull:`950`)
@@ -34,6 +37,9 @@ Changelog
- Fix drag-scrolling not working when the mouse leaves the window confines
(:iss:`917`)
+- Workaround for broken editors like nano that cannot handle newlines in pasted text
+ (:iss:`994`)
+
- Linux: Ensure that the python embedded in the kitty binary build uses
UTF-8 mode to process command-line arguments (:iss:`924`)
@@ -58,6 +64,8 @@ Changelog
mouse cursor image that can be seen on both light and dark backgrounds
(:iss:`359`)
+- Remote control: Fix the ``focus_window`` command not focusing the
+ top-level OS window of the specified kitty window (:iss:`1003`)
0.12.1 [2018-09-08]
------------------------------
diff --git a/docs/index.rst b/docs/index.rst
index 7a6c0443..dd36d9ed 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -125,7 +125,7 @@ Action Shortcut
New tab :sc:`new_tab`
Close tab :sc:`close_tab`
Next tab :sc:`next_tab` (also :kbd:`control+tab` on macOS)
-Previous tab :sc:`previous_tab` or :sc:`prev_tab` (also :kbd:`control+shift+tab` on macOS)
+Previous tab :sc:`previous_tab` (also :kbd:`control+shift+tab` on macOS)
Next layout :sc:`next_layout`
Move tab forward :sc:`move_tab_forward`
Move tab backward :sc:`move_tab_backward`
@@ -143,7 +143,7 @@ New window :sc:`new_window`
New OS window :sc:`new_os_window` (also :kbd:`⌘+n` on macOS)
Close window :sc:`close_window`
Next window :sc:`next_window`
-Previous window :sc:`previous_window` or :sc:`prev_window`
+Previous window :sc:`previous_window`
Move window forward :sc:`move_window_forward`
Move window backward :sc:`move_window_backward`
Move window to top :sc:`move_window_to_top`
diff --git a/glfw/xkb_glfw.c b/glfw/xkb_glfw.c
index 5908bf4a..4cd5a9ad 100644
--- a/glfw/xkb_glfw.c
+++ b/glfw/xkb_glfw.c
@@ -440,9 +440,9 @@ glfw_xkb_key_from_ime(KeyEvent *ev, GLFWbool handled_by_ime, GLFWbool failed) {
debug("↳ to application: glfw_keycode: 0x%x (%s) keysym: 0x%x (%s) action: %s %s text: %s\n",
ev->glfw_keycode, _glfwGetKeyName(ev->glfw_keycode), ev->keysym, glfw_xkb_keysym_name(ev->keysym),
(ev->action == GLFW_RELEASE ? "RELEASE" : (ev->action == GLFW_PRESS ? "PRESS" : "REPEAT")),
- format_mods(ev->glfw_modifiers), key_event.text
+ format_mods(ev->glfw_modifiers), ev->text
);
- _glfwInputKeyboard(window, ev->glfw_keycode, ev->keysym, ev->action, ev->glfw_modifiers, key_event.text, 0);
+ _glfwInputKeyboard(window, ev->glfw_keycode, ev->keysym, ev->action, ev->glfw_modifiers, ev->text, 0);
} else debug("↳ discarded\n");
if (!is_release && handled_by_ime) last_handled_press_keycode = ev->keycode;
}
diff --git a/kitty/boss.py b/kitty/boss.py
index 36cc1e36..b0c71f3c 100644
--- a/kitty/boss.py
+++ b/kitty/boss.py
@@ -852,7 +852,7 @@ class Boss:
cmd.append(arg)
return SpecialWindow(cmd, stdin, cwd_from=cwd_from)
- def _new_tab(self, args, cwd_from=None):
+ def _new_tab(self, args, cwd_from=None, as_neighbor=False):
special_window = None
if args:
if isinstance(args, SpecialWindowInstance):
@@ -861,15 +861,22 @@ class Boss:
special_window = self.args_to_special_window(args, cwd_from=cwd_from)
tm = self.active_tab_manager
if tm is not None:
- return tm.new_tab(special_window=special_window, cwd_from=cwd_from)
+ return tm.new_tab(special_window=special_window, cwd_from=cwd_from, as_neighbor=as_neighbor)
+
+ def _create_tab(self, args, cwd_from=None):
+ as_neighbor = False
+ if args and args[0].startswith('!'):
+ as_neighbor = 'neighbor' in args[0][1:].split(',')
+ args = args[1:]
+ self._new_tab(args, as_neighbor=as_neighbor, cwd_from=cwd_from)
def new_tab(self, *args):
- self._new_tab(args)
+ self._create_tab(args)
def new_tab_with_cwd(self, *args):
w = self.active_window
cwd_from = w.child.pid if w is not None else None
- self._new_tab(args, cwd_from=cwd_from)
+ self._create_tab(args, cwd_from=cwd_from)
def _new_window(self, args, cwd_from=None):
tab = self.active_tab
diff --git a/kitty/cmds.py b/kitty/cmds.py
index fc5be82e..60af9917 100644
--- a/kitty/cmds.py
+++ b/kitty/cmds.py
@@ -573,7 +573,9 @@ def focus_window(boss, window, payload):
raise MatchError(match)
for window in windows:
if window:
- boss.set_active_window(window)
+ os_window_id = boss.set_active_window(window)
+ if os_window_id:
+ focus_os_window(os_window_id, True)
break
# }}}
@@ -582,10 +584,20 @@ def focus_window(boss, window, payload):
@cmd(
'Focus the specified tab',
'The active window in the specified tab will be focused.',
- options_spec=MATCH_TAB_OPTION,
+ options_spec=MATCH_TAB_OPTION + '''
+
+--no-response
+type=bool-set
+default=false
+Don't wait for a response indicating the success of the action. Note that
+using this option means that you will not be notified of failures.
+''',
argspec='',
+ no_response=True,
)
def cmd_focus_tab(global_opts, opts, args):
+ if opts.no_response:
+ global_opts.no_command_response = True
return {'match': opts.match}
diff --git a/kitty/config_data.py b/kitty/config_data.py
index 58832e1d..e37f79a1 100644
--- a/kitty/config_data.py
+++ b/kitty/config_data.py
@@ -146,7 +146,12 @@ You can also create shortcuts to go to specific tabs, with 1 being the first tab
map ctrl+alt+2 goto_tab 2
Just as with :code:`new_window` above, you can also pass the name of arbitrary
-commands to run when using new_tab and use :code:`new_tab_with_cwd`.
+commands to run when using new_tab and use :code:`new_tab_with_cwd`. Finally,
+if you want the new tab to open next to the current tab rather than at the
+end of the tabs list, use::
+
+ map ctrl+t new_tab !neighbor [optional cmd to run]
+
''')],
'shortcuts.layout': [
_('Layout management'), '',
diff --git a/kitty/glfw.c b/kitty/glfw.c
index 4c11f0bb..2e7b9fb7 100644
--- a/kitty/glfw.c
+++ b/kitty/glfw.c
@@ -339,7 +339,7 @@ static inline void
get_window_dpi(GLFWwindow *w, double *x, double *y) {
GLFWmonitor *monitor = NULL;
if (w) monitor = current_monitor(w);
- if (monitor == NULL) monitor = glfwGetPrimaryMonitor();
+ if (monitor == NULL) { PyErr_Print(); monitor = glfwGetPrimaryMonitor(); }
float xscale = 1, yscale = 1;
if (monitor) glfwGetMonitorContentScale(monitor, &xscale, &yscale);
#ifdef __APPLE__
diff --git a/kitty/tabs.py b/kitty/tabs.py
index 58bcecc1..24a280ac 100644
--- a/kitty/tabs.py
+++ b/kitty/tabs.py
@@ -466,10 +466,16 @@ class TabManager: # {{{
self._set_active_tab(nidx)
self.mark_tab_bar_dirty()
- def new_tab(self, special_window=None, cwd_from=None):
+ def new_tab(self, special_window=None, cwd_from=None, as_neighbor=False):
+ nidx = self.active_tab_idx + 1
idx = len(self.tabs)
self._add_tab(Tab(self, special_window=special_window, cwd_from=cwd_from))
self._set_active_tab(idx)
+ if len(self.tabs) > 2 and as_neighbor and idx != nidx:
+ self.tabs[idx], self.tabs[nidx] = self.tabs[nidx], self.tabs[idx]
+ swap_tabs(self.os_window_id, idx, nidx)
+ self._set_active_tab(nidx)
+ idx = nidx
self.mark_tab_bar_dirty()
return self.tabs[idx]
diff --git a/kitty/window.py b/kitty/window.py
index 92d2181d..3c96c2e5 100644
--- a/kitty/window.py
+++ b/kitty/window.py
@@ -478,6 +478,10 @@ class Window:
if len(text) == len(new_text):
break
text = new_text
+ else:
+ # Workaround for broken editors like nano that cannot handle
+ # newlines in pasted text see https://github.com/kovidgoyal/kitty/issues/994
+ text = b'\r'.join(text.splitlines())
self.screen.paste(text)
def copy_to_clipboard(self):