xP/xW: fix buffer rename handling
Maintaining string pointers to the current/last buffer means that renames invalidate them.
This commit is contained in:
parent
c22dd67fc1
commit
34521e61c1
|
@ -344,6 +344,11 @@ rpcEventHandlers.set(Relay.Event.BufferStats, e => {
|
||||||
rpcEventHandlers.set(Relay.Event.BufferRename, e => {
|
rpcEventHandlers.set(Relay.Event.BufferRename, e => {
|
||||||
buffers.set(e.new, buffers.get(e.bufferName))
|
buffers.set(e.new, buffers.get(e.bufferName))
|
||||||
buffers.delete(e.bufferName)
|
buffers.delete(e.bufferName)
|
||||||
|
|
||||||
|
if (e.bufferName === bufferCurrent)
|
||||||
|
bufferCurrent = e.new
|
||||||
|
if (e.bufferName === bufferLast)
|
||||||
|
bufferLast = e.new
|
||||||
})
|
})
|
||||||
|
|
||||||
rpcEventHandlers.set(Relay.Event.BufferRemove, e => {
|
rpcEventHandlers.set(Relay.Event.BufferRemove, e => {
|
||||||
|
|
|
@ -914,11 +914,15 @@ relay_process_message(const Relay::EventMessage &m)
|
||||||
if (!b)
|
if (!b)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
b->buffer_name = data.buffer_name;
|
b->buffer_name = data.new_;
|
||||||
|
|
||||||
refresh_buffer_list();
|
refresh_buffer_list();
|
||||||
if (b->buffer_name == g.buffer_current)
|
if (data.buffer_name == g.buffer_current) {
|
||||||
|
g.buffer_current = data.new_;
|
||||||
refresh_status();
|
refresh_status();
|
||||||
|
}
|
||||||
|
if (data.buffer_name == g.buffer_last)
|
||||||
|
g.buffer_last = data.new_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Relay::Event::BUFFER_REMOVE:
|
case Relay::Event::BUFFER_REMOVE:
|
||||||
|
|
Loading…
Reference in New Issue