"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/editup.cpp" between
bed-3.0.3.src.tar.xz and bed-3.1.0.src.tar.xz

About: bed is an adjustable data format binary editor.

editup.cpp  (bed-3.0.3.src.tar.xz):editup.cpp  (bed-3.1.0.src.tar.xz)
skipping to change at line 41 skipping to change at line 41
#include "main.h" #include "main.h"
#include "system.h" #include "system.h"
#include "marks.h" #include "marks.h"
#include "inout.h" #include "inout.h"
#ifdef USETHREADS #ifdef USETHREADS
#define __GNU_VISIBLE 1 #define __GNU_VISIBLE 1
#include <pthread.h> #include <pthread.h>
#endif #endif
#include "readconfig.h" #include "readconfig.h"
#include "keyproc.h" #include "keyproc.h"
/*
#define editerase() \
if(TEXTATTR ==0)\
werase(editscreen);\
else\
#define editerase() \
{ normaal(editscreen); for(int y=0;y<Screenheight;y++) \
{\
\
wmove(editscreen,y,0);\
for(int x=0;x<Screenwidth;x++) \
{ waddch(editscreen,' ');}\
};}
*/
//#define editerase() wbkgdset(editscreen,' '| TEXTATTR ); werase(editscreen)//
SLow
#define editerase() werase(editscreen) #define editerase() werase(editscreen)
/*
#define editerase() \
{ normaal(editscreen); for(int y=0;y<Screenheight;y++) \
{\
\
wmove(editscreen,y,0);\
for(int x=0;x<Screenwidth;x++) \
{ waddch(editscreen,' ');}\
};}
*/
inline int Editor::printchar(int pos) { inline int Editor::printchar(int pos) {
if(shouldreinit) if(shouldreinit)
return -1; return -1;
for(int i=0;i<nrparts;i++) parts[i]->unittoscreen(pos); for(int i=0;i<nrparts;i++) parts[i]->unittoscreen(pos);
return 0; return 0;
} }
Editor::~Editor() { Editor::~Editor() {
if(editpos>=0) { if(editpos>=0) {
INCDEST(); INCDEST();
#ifdef USETHREADS #ifdef USETHREADS
if(backgroundsearch) { if(backgroundsearch) {
stopthread(); stopthread();
} }
sem_destroy(&sema); sem_destroy(&sema);
#endif #endif
// endedit(); // endedit();
// dosave(); // dosave();
//view.free();
/*
if(viewbuf)
myfree(viewbuf);
*/
for(int i=0;i<nrparts;i++) for(int i=0;i<nrparts;i++)
delete parts[i]; delete parts[i];
myfree(parts); myfree(parts);
if(replacestr) if(replacestr)
myfree(replacestr); myfree(replacestr);
#ifdef USE_RE2 #ifdef USE_RE2
if(re2replacestr) if(re2replacestr)
free(re2replacestr); free(re2replacestr);
#endif #endif
if(searchdataname) if(searchdataname)
myfree(searchdataname); myfree(searchdataname);
delundo(); delundo();
windel(); windel();
delete marksptr;
if(searchpart) if(searchpart)
delete searchpart; delete searchpart;
myfree(previouspos); myfree(previouspos);
DECDEST(); DECDEST();
} }
delete marksptr;
} }
void Editor::splitpos(OFFTYPE pos) { void Editor::splitpos(OFFTYPE pos) {
editpos=(pos%mem.blocksize())%screenmax(); editpos=(pos%mem.blocksize())%screenmax();
filepos=pos-editpos; filepos=pos-editpos;
}; };
extern int makevisible(ScreenPart *part,int editpos); extern int makevisible(ScreenPart *part,int editpos);
int Editor::reinit(void) { int Editor::reinit(void) {
Screenheight=allheight-(!nomessage); Screenheight=allheight-(!nomessage);
#ifndef SETSCRREGBUG #ifndef SETSCRREGBUG
wsetscrreg(editscreen,0,Screenheight-1); wsetscrreg(editscreen,0,Screenheight-1);
#endif #endif
memorize(); memorize();
for(int i=0;i<nrparts;i++) for(int i=0;i<nrparts;i++)
parts[i]->calcsizes(); parts[i]->calcsizes();
//view.free();
/*
if(viewbuf)
myfree(viewbuf);
*/
OFFTYPE pos=editpos+filepos; OFFTYPE pos=editpos+filepos;
int lines=editpos/cols(); int lines=editpos/cols();
while(distribute()<0|| (!( view.setshown(screenmax())))) { while(distribute()<0|| (!( view.setshown(screenmax())))) {
// while(distribute()<0|| (shownbufsize=screenmax(),!( viewbuf=myallocar(cha
r ,shownbufsize)))) {
// while(distribute()<0|| (shownbufsize=screenmax(),!( viewbuf=myallocar(cha
r ,((shownbufsize/2048)+20)*2048)))) {
if(nrparts>1) if(nrparts>1)
delete parts[--nrparts]; delete parts[--nrparts];
else { else {
if(nrparts==1 &&parts[0]->getbytes()!=1) { if(nrparts==1 &&parts[0]->getbytes()!=1) {
delete parts[0]; delete parts[0];
parts[0]= new Ascii(this) ; parts[0]= new Ascii(this) ;
nrparts=1; nrparts=1;
} }
else { else {
skipping to change at line 252 skipping to change at line 215
#endif #endif
#if defined(SPACEBETWEEN) || defined(LINESBETWEEN) #if defined(SPACEBETWEEN) || defined(LINESBETWEEN)
for(int i=0;i<spaceafternum;i++) for(int i=0;i<spaceafternum;i++)
waddch(editscreen,' '); waddch(editscreen,' ');
#endif #endif
#ifdef LINESBETWEEN #ifdef LINESBETWEEN
NORMAAL; NORMAAL;
#endif #endif
} }
} }
/*
extern int textsameback;
*/
int Editor::writebuf(void) { int Editor::writebuf(void) {
makevisible(parts[mode],editpos); makevisible(parts[mode],editpos);
editerase(); editerase();
int co=cols(); int co=cols();
#ifdef SPACEBETWEEN #ifdef SPACEBETWEEN
const int endy=minnum(((view.getshown()+co-1)/co)+1,rows()); const int endy=minnum(((view.getshown()+co-1)/co)+1,rows());
#endif #endif
#ifdef NOBACKGROUND #ifdef NOBACKGROUND
int starty=(view.getshown()/co); int starty=(view.getshown()/co);
normaal(editscreen); normaal(editscreen);
skipping to change at line 591 skipping to change at line 551
#endif #endif
#ifdef USE_HYPERSCAN #ifdef USE_HYPERSCAN
,hyperdata(NULL) ,hyperdata(NULL)
,hyperscratch (NULL) ,hyperscratch (NULL)
#endif #endif
{ {
editscreen=NULL; editscreen=NULL;
if(!mem.error()) { if(!mem.error()) {
searchpart=NULL; searchpart=NULL;
marksptr=new keylookup;
#ifdef USETHREADS #ifdef USETHREADS
backgroundsearch=0; backgroundsearch=0;
found=0; found=0;
sem_init(&sema,0,1); sem_init(&sema,0,1);
#endif #endif
justopened=1; justopened=1;
replacestr=NULL; replacestr=NULL;
replacestrlen=0; replacestrlen=0;
indatatype=0; indatatype=0;
commandmode=0; commandmode=0;
 End of changes. 9 change blocks. 
45 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)