Re: Question about File > Open and the "Untitled" buffer

From: Robert <ro....at.web.de>
Date: Sun, 11 Apr 2010 12:08:52 -0700 (PDT)

On Apr 10, 9:21 am, Brian Schott <briancsch....at.gmail.com> wrote:
...
> and they were utterly vanquished.

Ugh. There is a problem... When you close all buffers, and only one
Untitled buffer remains it becomes quite easy to crash Textadept. When
you have a look at the side pane view of the buffer list in 2.1 it can
be seen how once you close the Untitled buffer immediately another
appears. With the new "new buffer" event this seems to become a
problem.
A quick fix could be something like this (Don't close if there is only
one clean Untitled buffer):
--- a/core/file_io.lua Sun Apr 11 12:09:10 2010 +0200
+++ b/core/file_io.lua Sun Apr 11 20:58:15 2010 +0200
@@ -322,6 +322,10 @@
 -- @usage buffer:close()
 function close(buffer)
   textadept.check_focused_buffer(buffer)
+ local b = textadept.buffers[1]
+ if #textadept.buffers == 1 and not (b.dirty or b._type or
b.filename) then
+ return false
+ end
   if buffer.dirty and
      textadept.dialog('msgbox',

However, it's still not possible to open more than one Untitled
buffer... maybe the "new buffer" event needs to be changed.

Robert
Received on Sun 11 Apr 2010 - 15:08:52 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:42:59 EST