lib/textbringer/commands/windows.rb in textbringer-0.2.1 vs lib/textbringer/commands/windows.rb in textbringer-0.2.2

- old
+ new

@@ -98,20 +98,26 @@ EOD switch_to_buffer(Buffer.last) end define_command(:kill_buffer, doc: "Kill buffer.") do - |buffer = read_buffer("Kill buffer: ", default: Buffer.current.name)| + |buffer = read_buffer("Kill buffer: ", default: Buffer.current.name), + force: false| if buffer.is_a?(String) buffer = Buffer[buffer] end - if buffer.modified? + if !force && buffer.modified? next unless yes_or_no?("The last change is not saved; kill anyway?") message("Arioch! Arioch! Blood and souls for my Lord Arioch!") end buffer.kill if Buffer.current.nil? switch_to_buffer(Buffer.other) + end + Window.list(include_echo_area: true).each do |window| + if window.buffer == buffer + window.buffer = Buffer.current + end end end end end