80x24 improvements, buffer improvements, ideas
--HG-- branch : pmacs2
This commit is contained in:
parent
05e72dc483
commit
1e6fc685c5
5
IDEAS
5
IDEAS
|
@ -1,3 +1,8 @@
|
|||
2008/04/02:
|
||||
|
||||
fix read-only warnings to seem less junky (e.g. catch the buffer.ReadOnlyError
|
||||
exception and write a graceful message everywhere applicable).
|
||||
|
||||
2008/03/18:
|
||||
|
||||
tie cvs/svn comands into method/shell.py for code reuse
|
||||
|
|
30
buffer.py
30
buffer.py
|
@ -8,6 +8,9 @@ ACT_UNDO = 1
|
|||
ACT_REDO = 2
|
||||
STACK_LIMIT = 1024
|
||||
|
||||
class ReadOnlyError(Exception):
|
||||
pass
|
||||
|
||||
# used for multiple text additions/deletions
|
||||
class GroupMove(object):
|
||||
def __init__(self, buffer, p, moves):
|
||||
|
@ -260,8 +263,8 @@ class Buffer(object):
|
|||
# raise Exception, "damn"
|
||||
llen = len(lines)
|
||||
assert llen > 0
|
||||
if not force:
|
||||
assert not self.readonly(), "insert_string: buffer is read-only"
|
||||
if not force and self.readonly():
|
||||
raise ReadOnlyError, "buffer is read-only"
|
||||
p2 = p.vadd(len(lines[-1]), llen - 1)
|
||||
if llen > 1:
|
||||
self.lines.insert(p.y + 1, [])
|
||||
|
@ -280,8 +283,8 @@ class Buffer(object):
|
|||
# deletion from buffer
|
||||
def delete(self, p1, p2, act=ACT_NORM, force=False):
|
||||
"""delete characters from p1 up to p2 from the buffer"""
|
||||
if not force:
|
||||
assert not self.readonly(), "delete_string: buffer is read-only"
|
||||
if not force and self.readonly():
|
||||
raise ReadOnlyError, "buffer is read-only"
|
||||
self._validate_point(p1)
|
||||
self._validate_point(p2)
|
||||
if p1 == p2:
|
||||
|
@ -466,7 +469,7 @@ class FileBuffer(Buffer):
|
|||
return self.checksum.digest() != m.digest()
|
||||
def save(self, force=False):
|
||||
if self.readonly():
|
||||
raise Exception, "can't save a read-only file"
|
||||
raise ReadOnlyError, "can't save read-only file"
|
||||
|
||||
if self.checksum is not None and force is False:
|
||||
# the file already existed and we took a checksum so make sure it's
|
||||
|
@ -694,23 +697,24 @@ class ColorDataBuffer(DataBuffer):
|
|||
self.highlights['Colortext'].highlight(lines)
|
||||
|
||||
ABOUT_DATA = '''
|
||||
[r:d:*]================================================================================
|
||||
[r:d:*]===============================================================================
|
||||
|
||||
[y:d:*]************ ********** ****** ****** **** ******** *********
|
||||
[y:d:*]************** ****************** ************* ********** ***********
|
||||
[y:d:*]******* ***** ****** ***** **** **** ****** **** **** ***** ****
|
||||
[y:d:*]******* ***** ****** ***** **** **** ****** **** **** ***** ***
|
||||
[y:d:*] *** *** *** *** *** **** **** **** *******
|
||||
[y:d:*] *** *** *** *** *** **** **** **** *******
|
||||
[y:d:*] ***** ***** ***** ***** **** **** ****** **** **** **** *****
|
||||
[y:d:*] ************ ***** ***** **** ************* ********** ***********
|
||||
[y:d:*] ********** ***** ***** **** ****** **** ******** *********
|
||||
[y:d:*] *** *** *** *** *** **** **** **** ******
|
||||
[y:d:*] ***** ***** ***** ***** **** **** ****** **** **** **** ****
|
||||
[y:d:*] ************ ***** ***** **** ************* ********** **********
|
||||
[y:d:*] ********** ***** ***** **** ****** **** ******** ********
|
||||
[y:d:*] ***
|
||||
[y:d:*] *** [c:d:*]pmacs[d:d:*] is a python-based text editor by [c:d:*]Erik Osheim[d:d:*], [b:d:*](c) 2005-2008
|
||||
[y:d:*]***** [c:d:*]pmacs[d:d:*] is available to you under the [c:d:*]GNU General Public License v2
|
||||
[y:d:*]*****
|
||||
[y:d:*]***** [d:d:*]to see all available commands use: [c:d:*]C-c M-h [b:d:*](show-bindings-buffer)
|
||||
[y:d:*]***** [d:d:*]to view available commands use [c:d:*]C-c M-h [b:d:*](show-bindings-buffer)
|
||||
[d:d:*] [d:d:*]open files with [c:d:*]C-x C-f[d:d:*]; save with [c:d:*]C-x C-s[d:d:*]; quit with [c:d:*]C-x C-c
|
||||
|
||||
[r:d:*]================================================================================
|
||||
[r:d:*]===============================================================================
|
||||
'''
|
||||
class AboutBuffer(ColorDataBuffer):
|
||||
def __init__(self):
|
||||
|
|
|
@ -172,7 +172,10 @@ class InsertString(Method):
|
|||
self.help = "Insert %r into the current buffer." % s
|
||||
self.string = s
|
||||
def _execute(self, w, **vargs):
|
||||
try:
|
||||
w.insert_string_at_cursor(self.string)
|
||||
except buffer.ReadOnlyError:
|
||||
w.set_error('Buffer is read-only')
|
||||
class OverwriteChar(Method):
|
||||
_is_method = False
|
||||
def __init__(self, c):
|
||||
|
|
Loading…
Reference in New Issue