View Issue Details

IDProjectCategoryView StatusLast Update
0023957FPCTextmode IDEpublic2014-03-04 17:02
ReporterAlexLAssigned ToPierre Muller 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86_64 onlyOSlinuxOS Versionall
Product Version2.6.2Product Build 
Target Version2.7.1Fixed in Version2.6.4 
Summary0023957: Incorrect procedure TIndicator.Draw for x86_64
Descriptionprocedure TIndicator.Draw for x86_64 shows incorrect counter for position of cursor.
Patch is in attachment.
Tagspatch
Fixed in Revision25016
FPCOldBugId
FPCTarget
Attached Files
  • b369bfd0d2ac.png (64,988 bytes)
    b369bfd0d2ac.png (64,988 bytes)
  • indicator_draw_x86_64.patch (687 bytes)
    --- ./ide/wcedit.pas.orig	2008-07-21 01:37:48.000000000 +0400
    +++ ./ide/wcedit.pas	2013-02-26 09:47:48.426075567 +0400
    @@ -777,6 +777,7 @@
       L: array[0..1] of Longint;
       S: String[15];
       B: TDrawBuffer;
    +  K: String;
     begin
       if assigned(CodeOwner) and
          (CodeOwner^.ELockFlag>0) then
    @@ -812,7 +813,13 @@
     {$endif debug}
          L[0] := Location.Y + 1;
          L[1] := Location.X + 1;
    -     FormatStr(S, ' %d:%d ', L);
    +//     FormatStr(S, ' %d:%d ', L);
    +     Str(L[0],S);
    +     if Length(S)<6 then S:=' '+S;
    +     S:=S+':';
    +     Str(L[1],K);
    +     if Length(K)<3 then K:=K+' ';
    +     S:=S+K;
          MoveStr(B[8 - Pos(':', S)], S, Color);
        end;
       WriteBuf(0, 0, Size.X, 1, B);
    
  • tindicator_draw-x86_64.patch (597 bytes)
    --- a/ide/wcedit.pas	2013-02-26 11:34:42.000196261 +0400
    +++ b/ide/wcedit.pas	2013-02-26 11:35:26.355006175 +0400
    @@ -774,7 +774,7 @@
     var
       Color: Byte;
       Frame: Char;
    -  L: array[0..1] of Longint;
    +  L: array[0..1] of Pointer;
       S: String[15];
       B: TDrawBuffer;
     begin
    @@ -810,8 +810,8 @@
          if UseTabs then
            WordRec(B[3]).lo := ord('T');
     {$endif debug}
    -     L[0] := Location.Y + 1;
    -     L[1] := Location.X + 1;
    +     L[0] := Pointer(Location.Y + 1);
    +     L[1] := Pointer(Location.X + 1);
          FormatStr(S, ' %d:%d ', L);
          MoveStr(B[8 - Pos(':', S)], S, Color);
        end;
    
  • tindicator_draw-x86_64-2.patch (594 bytes)
    --- a/ide/wcedit.pas	2013-02-26 11:34:42.000196261 +0400
    +++ b/ide/wcedit.pas	2013-02-26 12:59:01.948875133 +0400
    @@ -774,7 +774,7 @@
     var
       Color: Byte;
       Frame: Char;
    -  L: array[0..1] of Longint;
    +  L: array[0..1] of PtrInt;
       S: String[15];
       B: TDrawBuffer;
     begin
    @@ -810,8 +810,8 @@
          if UseTabs then
            WordRec(B[3]).lo := ord('T');
     {$endif debug}
    -     L[0] := Location.Y + 1;
    -     L[1] := Location.X + 1;
    +     L[0] := PtrInt(Location.Y + 1);
    +     L[1] := PtrInt(Location.X + 1);
          FormatStr(S, ' %d:%d ', L);
          MoveStr(B[8 - Pos(':', S)], S, Color);
        end;
    

Relationships

has duplicate 0023956 closedMarco van de Voort Incorrect display of the cursor in the window edit code. 

Activities

AlexL

2013-02-26 07:05

reporter  

b369bfd0d2ac.png (64,988 bytes)
b369bfd0d2ac.png (64,988 bytes)

AlexL

2013-02-26 07:05

reporter  

indicator_draw_x86_64.patch (687 bytes)
--- ./ide/wcedit.pas.orig	2008-07-21 01:37:48.000000000 +0400
+++ ./ide/wcedit.pas	2013-02-26 09:47:48.426075567 +0400
@@ -777,6 +777,7 @@
   L: array[0..1] of Longint;
   S: String[15];
   B: TDrawBuffer;
+  K: String;
 begin
   if assigned(CodeOwner) and
      (CodeOwner^.ELockFlag>0) then
@@ -812,7 +813,13 @@
 {$endif debug}
      L[0] := Location.Y + 1;
      L[1] := Location.X + 1;
-     FormatStr(S, ' %d:%d ', L);
+//     FormatStr(S, ' %d:%d ', L);
+     Str(L[0],S);
+     if Length(S)<6 then S:=' '+S;
+     S:=S+':';
+     Str(L[1],K);
+     if Length(K)<3 then K:=K+' ';
+     S:=S+K;
      MoveStr(B[8 - Pos(':', S)], S, Color);
    end;
   WriteBuf(0, 0, Size.X, 1, B);

Serg Bormant

2013-02-26 08:39

reporter  

tindicator_draw-x86_64.patch (597 bytes)
--- a/ide/wcedit.pas	2013-02-26 11:34:42.000196261 +0400
+++ b/ide/wcedit.pas	2013-02-26 11:35:26.355006175 +0400
@@ -774,7 +774,7 @@
 var
   Color: Byte;
   Frame: Char;
-  L: array[0..1] of Longint;
+  L: array[0..1] of Pointer;
   S: String[15];
   B: TDrawBuffer;
 begin
@@ -810,8 +810,8 @@
      if UseTabs then
        WordRec(B[3]).lo := ord('T');
 {$endif debug}
-     L[0] := Location.Y + 1;
-     L[1] := Location.X + 1;
+     L[0] := Pointer(Location.Y + 1);
+     L[1] := Pointer(Location.X + 1);
      FormatStr(S, ' %d:%d ', L);
      MoveStr(B[8 - Pos(':', S)], S, Color);
    end;

Serg Bormant

2013-02-26 08:41

reporter   ~0065890

Last edited: 2013-02-26 08:42

View 3 revisions

IMHO, using Ponter type with Pointer(...) typecast is more simple in this case.
See tindicator_draw-x86_64.patch.

Serg Bormant

2013-02-26 10:07

reporter   ~0065892

Last edited: 2013-02-26 10:13

View 3 revisions

Hm, as I can see PtrInt type is more accurate replacement for LongInt as

procedure FormatStr (Var Result: String; CONST Format: String; Var Params);

from packages/fv/src/drivers.pas accesses Params parameter with typecast to array of PtrInt_s via TLongArray(Params)[I] where

TLongArray = Array[0..0] Of PtrInt;


So, I upload tindicator_draw-x86_64-2.patch.

Serg Bormant

2013-02-26 10:08

reporter  

tindicator_draw-x86_64-2.patch (594 bytes)
--- a/ide/wcedit.pas	2013-02-26 11:34:42.000196261 +0400
+++ b/ide/wcedit.pas	2013-02-26 12:59:01.948875133 +0400
@@ -774,7 +774,7 @@
 var
   Color: Byte;
   Frame: Char;
-  L: array[0..1] of Longint;
+  L: array[0..1] of PtrInt;
   S: String[15];
   B: TDrawBuffer;
 begin
@@ -810,8 +810,8 @@
      if UseTabs then
        WordRec(B[3]).lo := ord('T');
 {$endif debug}
-     L[0] := Location.Y + 1;
-     L[1] := Location.X + 1;
+     L[0] := PtrInt(Location.Y + 1);
+     L[1] := PtrInt(Location.X + 1);
      FormatStr(S, ' %d:%d ', L);
      MoveStr(B[8 - Pos(':', S)], S, Color);
    end;

Serg Bormant

2013-02-27 10:44

reporter   ~0065920

0023956 http://mantis.freepascal.org/view.php?id=23956
is the same as indicator_draw_x86_64.patch

Pierre Muller

2013-03-07 14:57

developer   ~0066091

 Could you confirm that commit rev 23704
fixes the problem?
If so, you may close the bug report.


Thanks in advance.

Pierre Muller

Marco van de Voort

2013-03-07 21:52

manager   ~0066103

Tested with my freebsd/x86_64, seems resolved.

Issue History

Date Modified Username Field Change
2013-02-26 07:05 AlexL New Issue
2013-02-26 07:05 AlexL File Added: b369bfd0d2ac.png
2013-02-26 07:05 AlexL File Added: indicator_draw_x86_64.patch
2013-02-26 08:39 Serg Bormant File Added: tindicator_draw-x86_64.patch
2013-02-26 08:41 Serg Bormant Note Added: 0065890
2013-02-26 08:42 Serg Bormant Note Edited: 0065890 View Revisions
2013-02-26 08:42 Serg Bormant Note Edited: 0065890 View Revisions
2013-02-26 10:07 Serg Bormant Note Added: 0065892
2013-02-26 10:08 Serg Bormant File Added: tindicator_draw-x86_64-2.patch
2013-02-26 10:12 Serg Bormant Note Edited: 0065892 View Revisions
2013-02-26 10:13 Serg Bormant Note Edited: 0065892 View Revisions
2013-02-27 10:44 Serg Bormant Note Added: 0065920
2013-02-27 11:41 Reinier Olislagers Relationship added has duplicate 0023956
2013-03-01 12:03 Serg Bormant Tag Attached: patch
2013-03-07 14:57 Pierre Muller Note Added: 0066091
2013-03-07 14:57 Pierre Muller Assigned To => Pierre Muller
2013-03-07 14:57 Pierre Muller Status new => feedback
2013-03-07 14:57 Pierre Muller Target Version => 2.7.1
2013-03-07 21:52 Marco van de Voort Fixed in Revision => 23704
2013-03-07 21:52 Marco van de Voort Note Added: 0066103
2013-03-07 21:52 Marco van de Voort Status feedback => resolved
2013-03-07 21:52 Marco van de Voort Resolution open => fixed
2014-03-04 17:02 Jonas Maebe Fixed in Revision 23704 => 25016
2014-03-04 17:02 Jonas Maebe Fixed in Version => 2.6.4