View Issue Details

IDProjectCategoryView StatusLast Update
0025280FPCTextmode IDEpublic2019-02-11 15:17
ReporterAlexL Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
PlatformLinuxOSMageia 2 
Product Version2.6.2 
Summary0025280: Ide breaks when zooming
DescriptionIf to decrease size of IDE less than on picture, then IDE generates a signal 8 and breaks.
It's critical bug, because users can lose all changes.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

has duplicate 0030922 resolvedFlorian IDE crash when terminal height is one line 

Activities

AlexL

2013-11-03 20:03

reporter  

fp-ide0.png (8,182 bytes)   
fp-ide0.png (8,182 bytes)   

AlexL

2013-11-03 20:03

reporter  

fp-ide1.png (10,349 bytes)   
fp-ide1.png (10,349 bytes)   

AlexL

2013-11-07 15:53

reporter   ~0071190

gnome-terminal -e fp
The IDE can not run, because there is this bug.
Command:
gnome-terminal --maximize -e fp
works only.

AlexL

2014-01-29 22:49

reporter   ~0072776

Will you fix this important bug?

Thaddy de Koning

2014-02-02 15:00

reporter   ~0072805

I can not reproduce this on:
- Raspbian ARM linux
- Linux mint 16 64 bit
- Debian wheezy x86_64 linux
- Windows 7 (os 64) i386

Can you try another terminal emulation? (maybe lxterminal?)
The bug may very well be in Mageia

AlexL

2014-02-02 21:53

reporter   ~0072818

No, it's for all distros, I tested Fedora, Alt Linux, Mageia and for all terminals and lxterminal also.
You must reduce the size of terminal less than on the picture and IDE generates a signal 8 and breaks.

Marco van de Voort

2014-02-03 14:25

manager   ~0072831

Why is resizing a terminal to crazy sizes so important btw?

AlexL

2014-02-03 15:08

reporter   ~0072832

gnome-terminal -e fp is minimal size and no start.
If edit any file and don't save, then all changes will be lost.
Any bug if user can lose changes is important.

Thaddy de Koning

2014-02-03 21:01

reporter   ~0072837

If you really, really, really push it beyond what looks sensible, this bug is confirmed on all platforms I mentioned above.
You have to go well below about 20X20 chars.
So it should be fixed, because fp simply bombs, like AlexL wrote.
This is also true for fixes and trunk, btw.

Thaddy de Koning

2014-02-03 21:16

reporter   ~0072838

And Alex: it is while resizing, not when zooming.

AlexL

2014-02-03 23:08

reporter   ~0072842

Thank's for confirm this bug.
> it is while resizing, not when zooming.
I'm sorry for my English, but I don't speak English, I can read and write only.

AlexL

2014-02-21 21:17

reporter  

fix_min_size.patch (7,066 bytes)   
--- ./packages/fv/src/views.pas.orig	2009-11-04 19:45:26.000000000 +0300
+++ ./packages/fv/src/views.pas	2014-02-21 22:51:40.000000000 +0400
@@ -1897,9 +1897,16 @@
    END;
 
    PROCEDURE GrowI (Var I: Sw_Integer);
+   VAR
+   Z: Sw_Integer;
    BEGIN
      If (GrowMode AND gfGrowRel = 0) Then Inc(I, D)
-       Else I := (I * S + (S - D) SHR 1) DIV (S - D); { Calc grow value }
+       Else BEGIN  { Calc grow value }
+            I := (I * S + (S - D) SHR 1); 
+            Z := (S - D);
+            If Z < 1 THEN Z := 1;
+            I :=I DIV Z;
+            END;
    END;
 
 BEGIN
@@ -3128,6 +3135,7 @@
 {---------------------------------------------------------------------------}
 PROCEDURE TScrollBar.HandleEvent (Var Event: TEvent);
 VAR Tracking: Boolean; I, P, S, ClickPart, Iv: Sw_Integer;
+    Z: LONGINT;
     Mouse: TPoint; Extent: TRect;
 
    FUNCTION GetPartCode: Sw_Integer;
@@ -3230,14 +3238,18 @@
                If (I > S) Then I := S;                { Check overflow }
              End Else I := GetPos;                    { Get position }
              If (I <> P) Then Begin
+               Z := S + Min;
+               IF Z = 0 Then Z := 1;
                SetValue(LongInt((LongInt(I)*(Max-Min))
-                 +(S SHR 1)) DIV S + Min);            { Set new value }
+                 +(S SHR 1)) DIV Z);                  { Set new value }
                P := I;                                { Hold new position }
              End;
            Until NOT MouseEvent(Event, evMouseMove);  { Until not moving }
+           Z := S + Min;
+           IF Z = 0 THEN Z := 1;
            If Tracking AND (S > 0) Then               { Tracking mouse }
              SetValue(LongInt((LongInt(P)*(Max-Min))+
-               (S SHR 1)) DIV S + Min);               { Set new value }
+               (S SHR 1)) DIV Z);                     { Set new value }
            If (Iv <> Value) Then Clicked;             { Scroll has moved }
          End;
          ClearEvent(Event);                           { Clear the event }
@@ -3434,6 +3446,7 @@
 CONSTRUCTOR TListViewer.Init (Var Bounds: TRect; ANumCols: Sw_Word; AHScrollBar,
   AVScrollBar: PScrollBar);
 VAR ArStep, PgStep: Sw_Integer;
+Z: LONGINT;
 BEGIN
    Inherited Init(Bounds);                            { Call ancestor }
    Options := Options OR (ofFirstClick+ofSelectable); { Set options }
@@ -3449,8 +3462,10 @@
      End;
      AVScrollBar^.SetStep(PgStep, ArStep);            { Set scroll values }
    End;
+   Z := NumCols;
+   If Z = 0 Then Z := 1;
    If (AHScrollBar <> Nil) Then
-     AHScrollBar^.SetStep(Size.X DIV NumCols, 1);     { Set step size }
+     AHScrollBar^.SetStep(Size.X DIV Z, 1);           { Set step size }
    HScrollBar := AHScrollBar;                         { Horz scrollbar held }
    VScrollBar := AVScrollBar;                         { Vert scrollbar held }
 END;
@@ -3503,8 +3518,11 @@
 VAR  I, J, ColWidth, Item, Indent, CurCol: Sw_Integer;
      Color: Word; SCOff: Byte;
      Text: String; B: TDrawBuffer;
+     Z: LongInt;
 BEGIN
-   ColWidth := Size.X DIV NumCols + 1;                { Calc column width }
+   Z := NumCols;
+   IF Z = 0 Then Z := 1;
+   ColWidth := Size.X DIV Z + 1;                      { Calc column width }
    If (HScrollBar = Nil) Then Indent := 0 Else        { Set indent to zero }
      Indent := HScrollBar^.Value;                     { Fetch any indent }
    For I := 0 To Size.Y - 1 Do Begin                  { For each line }
@@ -3549,16 +3567,20 @@
 {  FocusItem -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Jul99 LdB         }
 {---------------------------------------------------------------------------}
 PROCEDURE TListViewer.FocusItem (Item: Sw_Integer);
+VAR
+YY: LongInt;
 BEGIN
+   YY := Size.Y;
+   If YY = 0 Then YY := 1;
    Focused := Item;                                   { Set focus to item }
    If (VScrollBar <> Nil) Then
      VScrollBar^.SetValue(Item);                      { Scrollbar to value }
    If (Item < TopItem) Then                           { Item above top item }
      If (NumCols = 1) Then TopItem := Item            { Set top item }
-       Else TopItem := Item - Item MOD Size.Y         { Set top item }
+       Else TopItem := Item - Item MOD YY             { Set top item }
    Else If (Item >= TopItem + (Size.Y*NumCols)) Then  { Item below bottom }
      If (NumCols = 1) Then TopItem := Item-Size.Y+1   { Set new top item }
-     Else TopItem := Item - Item MOD Size.Y -
+     Else TopItem := Item - Item MOD YY -
        (Size.Y*(NumCols-1));                          { Set new top item }
 END;
 
@@ -3635,6 +3657,7 @@
 PROCEDURE TListViewer.HandleEvent (Var Event: TEvent);
 CONST MouseAutosToSkip = 4;
 VAR Oi, Ni: Sw_Integer; Ct, Cw: Word; Mouse: TPoint;
+Z, YY: LongInt;
 
    PROCEDURE MoveFocus (Req: Sw_Integer);
    BEGIN
@@ -3683,7 +3706,11 @@
          End;
      End;
      evMouseDown: Begin                               { Mouse down event }
-       Cw := Size.X DIV NumCols + 1;                  { Column width }
+       Z := NumCols;
+    
+       IF Z = 0 Then Z := 1;
+       Cw := Size.X DIV Z + 1;                        { Column width }
+       IF Cw = 0 Then Cw := 1;
        Oi := Focused;                                 { Hold focused item }
        MakeLocal(Event.Where, Mouse);                 { Localize mouse }
        If MouseInView(Event.Where) Then Ni := Mouse.Y
@@ -3709,11 +3736,13 @@
                  Ni := Focused-Size.Y;                { Move down 1 column }
                If (Mouse.X >= Size.X) Then            { Mouse x above width }
                  Ni := Focused+Size.Y;                { Move up 1 column }
+               YY := Size.Y;
+               If YY = 0 Then YY := 1;
                If (Mouse.Y < 0) Then                  { Mouse y below zero }
-                 Ni := Focused-Focused MOD Size.Y;    { Move up one item }
+                 Ni := Focused-Focused MOD YY;        { Move up one item }
                If (Mouse.Y > Size.Y) Then             { Mouse y above height }
                  Ni := Focused-Focused MOD
-                   Size.Y+Size.Y-1;                   { Move down one item }
+                   YY+Size.Y-1;                       { Move down one item }
              End;
            End;
          End Else Ni := Mouse.Y + (Size.Y*(Mouse.X
@@ -3732,10 +3761,14 @@
 {  ChangeBounds -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Jul99 LdB      }
 {---------------------------------------------------------------------------}
 PROCEDURE TListViewer.ChangeBounds (Var Bounds: TRect);
+VAR
+Z: LongInt;
 BEGIN
+   Z := NumCols;
+   IF Z = 0 Then Z := 1;
    Inherited ChangeBounds(Bounds);                    { Call ancestor }
    If (HScrollBar <> Nil) Then                        { Valid horz scrollbar }
-     HScrollBar^.SetStep(Size.X DIV NumCols,
+     HScrollBar^.SetStep(Size.X DIV Z,
        HScrollBar^.ArStep);                           { Update horz bar }
    If (VScrollBar <> Nil) Then                        { Valid vert scrollbar }
      VScrollBar^.SetStep(Size.Y * NumCols,
fix_min_size.patch (7,066 bytes)   

AlexL

2014-02-21 21:17

reporter   ~0073199

Patch is in attachment.

Florian

2019-01-02 00:55

administrator   ~0113080

Seems to be fixed meanwhile, at least I cannot crash the IDE by resizing the terminal window.

Issue History

Date Modified Username Field Change
2013-11-03 20:03 AlexL New Issue
2013-11-03 20:03 AlexL File Added: fp-ide0.png
2013-11-03 20:03 AlexL File Added: fp-ide1.png
2013-11-07 15:53 AlexL Note Added: 0071190
2014-01-29 22:49 AlexL Note Added: 0072776
2014-02-02 15:00 Thaddy de Koning Note Added: 0072805
2014-02-02 21:53 AlexL Note Added: 0072818
2014-02-03 14:25 Marco van de Voort Note Added: 0072831
2014-02-03 15:08 AlexL Note Added: 0072832
2014-02-03 21:01 Thaddy de Koning Note Added: 0072837
2014-02-03 21:16 Thaddy de Koning Note Added: 0072838
2014-02-03 23:08 AlexL Note Added: 0072842
2014-02-21 21:17 AlexL File Added: fix_min_size.patch
2014-02-21 21:17 AlexL Note Added: 0073199
2018-12-19 22:44 Marco van de Voort Relationship added has duplicate 0030922
2019-01-02 00:55 Florian Note Added: 0113080
2019-01-02 00:55 Florian Status new => resolved
2019-01-02 00:55 Florian Resolution open => no change required
2019-01-02 00:55 Florian Assigned To => Florian