[w3m-dev 03553] Undo/Redo
* fm.h (Buffer): add undo (BufferPos): added * funcname.tab (REDO): added (UNDO): added * main.c (save_buffer_position): added (main): save_buffer_position (resetPos): added (undoPos): added (redoPos): added * proto.h (undoPos): added (redoPos): added From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
1 parent
529b4cb63d
commit
4eb0a6fe3d
5 files changed
+105
-5
No files matched your search
@@ -1,3 +1,18 @@
|
|||||||
|
2002-12-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
|
||||||
|
|
||||||
|
* [w3m-dev 03553] Undo/Redo
|
||||||
|
* fm.h (Buffer): add undo
|
||||||
|
(BufferPos): added
|
||||||
|
* funcname.tab (REDO): added
|
||||||
|
(UNDO): added
|
||||||
|
* main.c (save_buffer_position): added
|
||||||
|
(main): save_buffer_position
|
||||||
|
(resetPos): added
|
||||||
|
(undoPos): added
|
||||||
|
(redoPos): added
|
||||||
|
* proto.h (undoPos): added
|
||||||
|
(redoPos): added
|
||||||
|
|
||||||
2002-12-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
|
2002-12-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
|
||||||
|
|
||||||
* [w3m-dev 03552] Re: link list
|
* [w3m-dev 03552] Re: link list
|
||||||
@@ -5687,4 +5702,4 @@ a * [w3m-dev 03276] compile error on EWS4800
|
|||||||
* release-0-2-1
|
* release-0-2-1
|
||||||
* import w3m-0.2.1
|
* import w3m-0.2.1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.608 2002/12/10 15:41:31 ukai Exp $
|
$Id: ChangeLog,v 1.609 2002/12/10 15:51:14 ukai Exp $
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: fm.h,v 1.94 2002/12/06 16:50:13 ukai Exp $ */
|
/* $Id: fm.h,v 1.95 2002/12/10 15:51:14 ukai Exp $ */
|
||||||
/*
|
/*
|
||||||
* w3m: WWW wo Miru utility
|
* w3m: WWW wo Miru utility
|
||||||
*
|
*
|
||||||
@@ -460,8 +460,18 @@ typedef struct _Buffer {
|
|||||||
char image_flag;
|
char image_flag;
|
||||||
char need_reshape;
|
char need_reshape;
|
||||||
Anchor *submit;
|
Anchor *submit;
|
||||||
|
struct _BufferPos *undo;
|
||||||
} Buffer;
|
} Buffer;
|
||||||
|
|
||||||
|
typedef struct _BufferPos {
|
||||||
|
long top_linenumber;
|
||||||
|
long cur_linenumber;
|
||||||
|
short currentColumn;
|
||||||
|
short pos;
|
||||||
|
struct _BufferPos *next;
|
||||||
|
struct _BufferPos *prev;
|
||||||
|
} BufferPos;
|
||||||
|
|
||||||
typedef struct _TabBuffer {
|
typedef struct _TabBuffer {
|
||||||
struct _TabBuffer *nextTab;
|
struct _TabBuffer *nextTab;
|
||||||
struct _TabBuffer *prevTab;
|
struct _TabBuffer *prevTab;
|
||||||
|
|||||||
+3
-1
@@ -1,4 +1,4 @@
|
|||||||
# $Id: funcname.tab,v 1.18 2002/12/09 15:51:08 ukai Exp $
|
# $Id: funcname.tab,v 1.19 2002/12/10 15:51:14 ukai Exp $
|
||||||
# macro name function name
|
# macro name function name
|
||||||
#----------------------------
|
#----------------------------
|
||||||
@@@ nulcmd
|
@@@ nulcmd
|
||||||
@@ -105,6 +105,7 @@ PREV_WORD movLW
|
|||||||
PRINT svBuf
|
PRINT svBuf
|
||||||
QUIT qquitfm
|
QUIT qquitfm
|
||||||
READ_SHELL readsh
|
READ_SHELL readsh
|
||||||
|
REDO redoPos
|
||||||
REDRAW rdrwSc
|
REDRAW rdrwSc
|
||||||
REG_MARK reMark
|
REG_MARK reMark
|
||||||
REINIT reinit
|
REINIT reinit
|
||||||
@@ -137,6 +138,7 @@ TAB_LINK tabA
|
|||||||
TAB_MENU tabMn
|
TAB_MENU tabMn
|
||||||
TAB_MOUSE tabMs
|
TAB_MOUSE tabMs
|
||||||
TAB_RIGHT tabR
|
TAB_RIGHT tabR
|
||||||
|
UNDO undoPos
|
||||||
UP lup1
|
UP lup1
|
||||||
VERSION dispVer
|
VERSION dispVer
|
||||||
VIEW vwSrc
|
VIEW vwSrc
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: main.c,v 1.164 2002/12/10 15:36:11 ukai Exp $ */
|
/* $Id: main.c,v 1.165 2002/12/10 15:51:15 ukai Exp $ */
|
||||||
#define MAINPROGRAM
|
#define MAINPROGRAM
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -98,6 +98,7 @@ int on_target = 1;
|
|||||||
static int add_download_list = FALSE;
|
static int add_download_list = FALSE;
|
||||||
|
|
||||||
void set_buffer_environ(Buffer *);
|
void set_buffer_environ(Buffer *);
|
||||||
|
static void save_buffer_position(Buffer *buf);
|
||||||
|
|
||||||
static void _followForm(int);
|
static void _followForm(int);
|
||||||
static void _goLine(char *);
|
static void _goLine(char *);
|
||||||
@@ -1066,6 +1067,7 @@ main(int argc, char **argv, char **envp)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
set_buffer_environ(Currentbuf);
|
set_buffer_environ(Currentbuf);
|
||||||
|
save_buffer_position(Currentbuf);
|
||||||
keyPressEventProc((int)c);
|
keyPressEventProc((int)c);
|
||||||
prec_num = 0;
|
prec_num = 0;
|
||||||
if (add_download_list) {
|
if (add_download_list) {
|
||||||
@@ -6367,3 +6369,72 @@ ldDL(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
save_buffer_position(Buffer *buf)
|
||||||
|
{
|
||||||
|
BufferPos *b = buf->undo;
|
||||||
|
|
||||||
|
if (!buf->firstLine)
|
||||||
|
return;
|
||||||
|
if (b && b->top_linenumber == TOP_LINENUMBER(buf) &&
|
||||||
|
b->cur_linenumber == CUR_LINENUMBER(buf) &&
|
||||||
|
b->currentColumn == buf->currentColumn &&
|
||||||
|
b->pos == buf->pos)
|
||||||
|
return;
|
||||||
|
b = New(BufferPos);
|
||||||
|
b->top_linenumber = TOP_LINENUMBER(buf);
|
||||||
|
b->cur_linenumber = CUR_LINENUMBER(buf);
|
||||||
|
b->currentColumn = buf->currentColumn;
|
||||||
|
b->pos = buf->pos;
|
||||||
|
b->next = NULL;
|
||||||
|
b->prev = buf->undo;
|
||||||
|
if (buf->undo)
|
||||||
|
buf->undo->next = b;
|
||||||
|
buf->undo = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
resetPos(BufferPos *b)
|
||||||
|
{
|
||||||
|
Buffer buf;
|
||||||
|
Line top, cur;
|
||||||
|
|
||||||
|
top.linenumber = b->top_linenumber;
|
||||||
|
cur.linenumber = b->cur_linenumber;
|
||||||
|
buf.topLine = ⊤
|
||||||
|
buf.currentLine = &cur;
|
||||||
|
buf.pos = b->pos;
|
||||||
|
buf.currentColumn = b->currentColumn;
|
||||||
|
restorePosition(Currentbuf, &buf);
|
||||||
|
Currentbuf->undo = b;
|
||||||
|
displayBuffer(Currentbuf, B_FORCE_REDRAW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
undoPos(void)
|
||||||
|
{
|
||||||
|
BufferPos *b = Currentbuf->undo;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!Currentbuf->firstLine)
|
||||||
|
return;
|
||||||
|
if (!b || !b->prev)
|
||||||
|
return;
|
||||||
|
for (i = 0; i < PREC_NUM && b->prev; i++, b = b->prev) ;
|
||||||
|
resetPos(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
redoPos(void)
|
||||||
|
{
|
||||||
|
BufferPos *b = Currentbuf->undo;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!Currentbuf->firstLine)
|
||||||
|
return;
|
||||||
|
if (!b || !b->next)
|
||||||
|
return;
|
||||||
|
for (i = 0; i < PREC_NUM && b->next; i++, b = b->next) ;
|
||||||
|
resetPos(b);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: proto.h,v 1.67 2002/12/09 15:51:09 ukai Exp $ */
|
/* $Id: proto.h,v 1.68 2002/12/10 15:51:15 ukai Exp $ */
|
||||||
/*
|
/*
|
||||||
* This file was automatically generated by version 1.7 of cextract.
|
* This file was automatically generated by version 1.7 of cextract.
|
||||||
* Manual editing not recommended.
|
* Manual editing not recommended.
|
||||||
@@ -146,6 +146,8 @@ extern Anchor *list_menu(Buffer *buf);
|
|||||||
#define listMn nulcmd
|
#define listMn nulcmd
|
||||||
#define movlistMn nulcmd
|
#define movlistMn nulcmd
|
||||||
#endif
|
#endif
|
||||||
|
extern void undoPos(void);
|
||||||
|
extern void redoPos(void);
|
||||||
|
|
||||||
extern int currentLn(Buffer *buf);
|
extern int currentLn(Buffer *buf);
|
||||||
extern void tmpClearBuffer(Buffer *buf);
|
extern void tmpClearBuffer(Buffer *buf);
|
||||||
|
|||||||
Reference in new issue
Block a user