- commit
- afc134c73ed0ec8cabf0484bfd08a294a82a6be1
- parent
- 63cdbc9d23c7e779b5382e45499b4027ab6eb9bb
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2023-05-29 15:10
use correct buffer on events
Diffstat
M | python/pad/__init__.py | 17 | ++++++++++------- |
1 files changed, 10 insertions, 7 deletions
diff --git a/python/pad/__init__.py b/python/pad/__init__.py
@@ -94,27 +94,30 @@ class Pad: 94 94 vim.command('setl nomodified') 95 95 96 96 -1 97 def get_buffer(): -1 98 return int(vim.eval('expand("<abuf>")'), 10) -1 99 -1 100 97 101 def on_open():98 -1 pad = Pad(vim.current.buffer)99 -1 pads[vim.current.buffer] = pad-1 102 i = get_buffer() -1 103 pad = Pad(vim.buffers[i]) -1 104 pads[i] = pad 100 105 pad.start_listen() 101 106 print(f'Connected to {pad.url}') 102 107 103 108 104 109 def on_input():105 -1 pad = pads[vim.current.buffer]-1 110 pad = pads[get_buffer()] 106 111 pad.on_input() 107 112 108 113 109 114 def on_write():110 -1 pad = pads[vim.current.buffer]-1 115 pad = pads[get_buffer()] 111 116 pad.send_changes() 112 117 113 118 114 119 def on_close():115 -1 i = int(vim.eval('expand("<abuf>")'), 10)116 -1 buffer = vim.buffers[i]117 -1 pad = pads.pop(buffer)-1 120 pad = pads.pop(get_buffer()) 118 121 pad.stop_listen() 119 122 120 123