Bug 116351

Summary: Saving the history of konsole sometimes results in a history file, which is incomplete
Product: [Applications] konsole Reporter: Richard Hartmann <rick4711>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: major CC: jburgess777
Priority: NOR    
Version: 1.4.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Incomplete saved history file of konsole
Complete saved history file of konsole
Incomplete saved history file of konsole

Description Richard Hartmann 2005-11-14 15:41:40 UTC
Version:           1.4.2 (using KDE 3.3.2, Gentoo)
Compiler:          gcc version 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)
OS:                Linux (i686) release 2.6.13-gentoo-r3

Hi,

it has happened now several times, that when I save my konsole history, the saved file is incomplete and contains only partial the data.

Konsole historysize is limited to 1000 lines.

Unfortunately I can't reproduce the error.
Comment 1 Richard Hartmann 2005-11-14 15:43:02 UTC
I added the saved history file and the one that originally had to be saved.
Comment 2 Richard Hartmann 2005-11-14 15:44:02 UTC
Created attachment 13446 [details]
Incomplete saved history file of konsole
Comment 3 Richard Hartmann 2005-11-14 15:45:28 UTC
Created attachment 13447 [details]
Complete saved history file of konsole
Comment 4 Kurt Hindenburg 2005-11-14 20:30:37 UTC
There's not much difference between your 2 files...

> diff -Naur history1-incorrect.txt history1-correct.txt 
--- history1-incorrect.txt      2005-11-14 14:36:11.000000000 -0500
+++ history1-correct.txt        2005-11-14 14:35:38.000000000 -0500
@@ -862,5 +862,3 @@
 ************************************************************
 /usr/libexec/mozilla-launcher: line 116: 15075 Speicherzugriffsfehler  "$mozbin" "$@"
 firefox-bin exited with non-zero status (139)
-rick4711@xkiste ~ $
-rick4711@xkiste ~ $
Comment 5 Richard Hartmann 2005-11-15 06:32:57 UTC
Created attachment 13461 [details]
Incomplete saved history file of konsole


This is the right file, Sorry, that was my mistake.
Comment 6 Jon Burgess 2005-11-20 17:59:37 UTC
I think I know how to reproduce this, i've seen it several times.

The problem (for me) occurs when I do a "Save Histroy" after having scrolled the window back to the top of the history. What seems to happen is that konsole only saves the history from the last line of output of the currently displayed output back to the start. All the output off the bottom othe konsole window doesn't make it into the history file.

Here is a more concrete example...

Open a new window and use seq to generate some output
[jburgess@shark kde]$ seq 1 100 
1
2
... [ lines deleted ]
100
[jburgess@shark ~]$

Save the history now and it will be complete.
Now use the scroll bar to look right back to the top of the output.
Save the history again. Now the history file only contains the first 20 or so lines of output, cutting of the ones which have scrolled off the bottom of the window.

I'm currently using 3.4.92 from RedHat Fedora rawhide RPMS.
Comment 7 Richard Hartmann 2005-11-20 20:49:17 UTC
I have tested this with konsole 1.6 (kde 3.4.92) on a Gentoo Live-CD and could reproduce this bug easily, following the above example.
Comment 8 Stephan Binner 2006-02-07 14:10:53 UTC
SVN commit 506665 by binner:

Fix "Saving history sometimes results in incomplete file"
BUG: 116351


 M  +2 -1      TEScreen.cpp  


--- branches/KDE/3.5/kdebase/konsole/konsole/TEScreen.cpp #506664:506665
@@ -1469,8 +1469,9 @@
   sel_begin = 0;
   sel_BR = sel_begin;
   sel_TL = sel_begin;
-  setSelExtentXY(columns-1,lines-1);
+  setSelExtentXY(columns-1,lines-1+hist->getLines()-histCursor);
   getSelText(true, stream);
+  clearSelection();
 }
 
 QString TEScreen::getHistoryLine(int no)