lib/textbringer/commands/misc.rb in textbringer-1.0.9 vs lib/textbringer/commands/misc.rb in textbringer-1.1.0

- old
+ new

@@ -4,10 +4,15 @@ message("Textbringer #{Textbringer::VERSION} "\ "(ruby #{RUBY_VERSION} [#{RUBY_PLATFORM}])") end define_command(:exit_textbringer) do |status = 0| - if Buffer.any? { |buffer| /\A\*/ !~ buffer.name && buffer.modified? } + unsaved_buffers = Buffer.filter { |buffer| + /\A\*/ !~ buffer.name && buffer.modified? + } + if !unsaved_buffers.empty? + list_buffers(unsaved_buffers) + Window.redisplay return unless yes_or_no?("Unsaved buffers exist; exit anyway?") end exit(status) end