Fix interaction between shortcut handling and multiple undo.

pull/3/head
Jonathan Moore Liles 2008-04-28 03:29:59 -05:00
parent 21e8fab30f
commit 0eb8babb3e
2 changed files with 17 additions and 9 deletions

View File

@ -222,6 +222,10 @@ Loggable::do_this ( const char *s, bool reverse )
Log_Entry e( sa );
assert( _class_map[ string( classname ) ] );
/* if ( ! _class_map[ string( classname ) ] ) */
@ -236,6 +240,8 @@ Loggable::do_this ( const char *s, bool reverse )
}
}
return true;
}
void
@ -245,6 +251,8 @@ Loggable::undo ( void )
// fflush( _fp );
/* FIXME: handle more than the first block!!! */
fseek( _fp, 0, SEEK_END );
size_t len = ftell( _fp );
@ -254,7 +262,6 @@ Loggable::undo ( void )
char *s = buf + len - 1;
// FIXME: handle blocks
int i = 1;
/* move back _undo_index items from the end */
@ -334,11 +341,7 @@ Loggable::undo ( void )
block_end();
// FIXME: bogus... needs to account for multiple events.
_undo_index = ui + 1;
++_undo_index;
_undo_index = ui + 2;
delete buf;
}
@ -408,6 +411,8 @@ Loggable::log ( const char *fmt, ... )
void
Loggable::flush ( void )
{
if ( ! _fp )
{
// printf( "error: no log file open!\n" );
@ -423,6 +428,10 @@ Loggable::flush ( void )
int n = _transaction.size();
if ( n )
/* something done, reset undo index */
_undo_index = 1;
if ( n > 1 )
fprintf( _fp, "{\n" );
@ -443,6 +452,7 @@ Loggable::flush ( void )
if ( n > 1 )
fprintf( _fp, "}\n" );
fflush( _fp );
}
@ -510,8 +520,6 @@ Loggable::log_start ( void )
_old_state = e.sa();
}
++_nest;
_undo_index = 1;
}
void

View File

@ -387,7 +387,6 @@ Track::handle ( int m )
{
case FL_MOUSEWHEEL:
{
if ( ! Fl::event_shift() )
return 0;
@ -404,6 +403,7 @@ Track::handle ( int m )
}
case FL_PUSH:
{
int X = Fl::event_x();
int Y = Fl::event_y();