Installed workaround for history related crash.

The whole history stuff is not satisfying both
from a programmers and a users point of view.

The central reason is that the history slows down
scrolling significantly, and the algorithm does
not permit limiting the history size.

There are minor flaws also related to indication
of history termination in case of disk overrun.

I schedule a rework of the history stuff to
konsole2.

svn path=/trunk/kdebase/konsole/; revision=63157
wilder-portage
Lars Doelle 26 years ago
parent 7a54e58472
commit ca42a46089
  1. 32
      src/TEHistory.C
  2. 2
      src/TEScreen.C

@ -37,15 +37,33 @@
FIXME: some complain about the history buffer comsuming the
memory of their machines. This problem is critical
since the history does not behave gracefully in cases
where the memory is used up completely. I have some
problems to reproduce this event in my installation.
where the memory is used up completely.
I put in a workaround that should handle it problem
now gracefully. I'm not satisfied with the solution.
FIXME: Terminating the history is not properly indicated
in the menu. We should throw a signal.
FIXME: There is noticable decrease in speed, also. Perhaps,
there whole feature needs to be revisited therefore.
Disadvantage of a more elaborated say block-oriented
Disadvantage of a more elaborated, say block-oriented
scheme with wrap around would be it's complexity.
*/
//FIXME: tempory replacement for tmpfile
// this is here one for debugging purpose.
//#define tmpfile xTmpFile
FILE* xTmpFile()
{
static int fid = 0;
char fname[80];
sprintf(fname,"TmpFile.%d",fid++);
return fopen(fname,"w");
}
// History Buffer ///////////////////////////////////////////
@ -93,8 +111,8 @@ bool HistoryBuffer::hasScroll()
void HistoryBuffer::add(const unsigned char* bytes, int len)
{ int rc;
assert(hasScroll());
rc = lseek(ion,length,SEEK_SET); if (rc < 0) perror("HistoryBuffer::add.seek");
rc = write(ion,bytes,len); if (rc < 0) perror("HistoryBuffer::add.write");
rc = lseek(ion,length,SEEK_SET); if (rc < 0) { perror("HistoryBuffer::add.seek"); setScroll(FALSE); return; }
rc = write(ion,bytes,len); if (rc < 0) { perror("HistoryBuffer::add.write"); setScroll(FALSE); return; }
length += rc;
}
@ -103,8 +121,8 @@ void HistoryBuffer::get(unsigned char* bytes, int len, int loc)
assert(hasScroll());
if (loc < 0 || len < 0 || loc + len > length)
fprintf(stderr,"getHist(...,%d,%d): invalid args.\n",len,loc);
rc = lseek(ion,loc,SEEK_SET); if (rc < 0) perror("HistoryBuffer::get.seek");
rc = read(ion,bytes,len); if (rc < 0) perror("HistoryBuffer::get.read");
rc = lseek(ion,loc,SEEK_SET); if (rc < 0) { perror("HistoryBuffer::get.seek"); setScroll(FALSE); return; }
rc = read(ion,bytes,len); if (rc < 0) { perror("HistoryBuffer::get.read"); setScroll(FALSE); return; }
}
int HistoryBuffer::len()

@ -1107,6 +1107,8 @@ void TEScreen::addHistLine()
sel_begin += columns;
}
}
if (!hasScroll()) histCursor = 0; //FIXME: a poor workaround
}
void TEScreen::setHistCursor(int cursor)

Loading…
Cancel
Save