From f845f7623501efab57768cbd81843e4c163fe412 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 17 Apr 2010 09:42:05 -0400 Subject: Remove initial 'Untitled' buffer when necessary. Thanks to Robert Gieseke. --- core/file_io.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'core/file_io.lua') diff --git a/core/file_io.lua b/core/file_io.lua index 14db3a7f..005d6042 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -377,3 +377,12 @@ local function update_modified_file() end textadept.events.add_handler('buffer_after_switch', update_modified_file) textadept.events.add_handler('view_after_switch', update_modified_file) + +textadept.events.add_handler('file_opened', + function(utf8_filename) -- close initial 'Untitled' buffer + local b = textadept.buffers[1] + if #textadept.buffers == 2 and not (b.filename or b._type or b.dirty) then + view:goto_buffer(1, true) + buffer:close() + end + end) -- cgit v1.2.3