From 573c0646f4656b3531be8430ee1c5ca03ffc213c Mon Sep 17 00:00:00 2001 From: cosven Date: Thu, 11 Oct 2018 04:10:26 +0800 Subject: [PATCH 1/2] Fix Editor.current_editor buffer (for prompt_toolkit 2.0). Return application current buffer as editor current_buffer. --- pyvim/editor.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pyvim/editor.py b/pyvim/editor.py index 0fd748f..78c5bff 100644 --- a/pyvim/editor.py +++ b/pyvim/editor.py @@ -191,13 +191,7 @@ def current_editor_buffer(self): """ Return the `EditorBuffer` that is currently active. """ - # For each buffer name on the focus stack. - for current_buffer_name in self.application.buffers.focus_stack: - if current_buffer_name is not None: - # Find/return the EditorBuffer with this name. - for b in self.window_arrangement.editor_buffers: - if b.buffer_name == current_buffer_name: - return b + return self.application.current_buffer @property def add_key_binding(self): From 1928ad2efc5e0c4ad8d18a5a84bcf42774dd6b6f Mon Sep 17 00:00:00 2001 From: Jonathan Slenders Date: Wed, 10 Oct 2018 22:50:24 +0200 Subject: [PATCH 2/2] Revert "Fix Editor.current_editor buffer (for prompt_toolkit 2.0)." This reverts commit 573c0646f4656b3531be8430ee1c5ca03ffc213c. --- pyvim/editor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyvim/editor.py b/pyvim/editor.py index 78c5bff..0fd748f 100644 --- a/pyvim/editor.py +++ b/pyvim/editor.py @@ -191,7 +191,13 @@ def current_editor_buffer(self): """ Return the `EditorBuffer` that is currently active. """ - return self.application.current_buffer + # For each buffer name on the focus stack. + for current_buffer_name in self.application.buffers.focus_stack: + if current_buffer_name is not None: + # Find/return the EditorBuffer with this name. + for b in self.window_arrangement.editor_buffers: + if b.buffer_name == current_buffer_name: + return b @property def add_key_binding(self):