Recent

Author Topic: SynEdit produces an error on save file (and fix)  (Read 780 times)

aducom

  • Full Member
  • ***
  • Posts: 130
    • http://www.aducom.com
SynEdit produces an error on save file (and fix)
« on: May 26, 2019, 09:02:09 am »
I have made a bug report that explains that under some circumstances a

Code: Pascal  [Select][+][-]
  1. mySynEdit.Lines.SaveToFile

Generates an error. I traced this down to

Code: Pascal  [Select][+][-]
  1. procedure TCustomSynEdit.MarkTextAsSaved;
  2. begin
  3.   TSynEditStringList(fLines).MarkSaved;
  4.   if FLeftGutter.Visible and FLeftGutter.ChangesPart(0).Visible then  ...
  5.  

The FLeftGutter.Changespart can be nil under certain circumstances causing an error if you access .visible. I don't know if this situation should occur or is caused by some mishap in my code or somewhere else, but this fix solved it for me:

Code: Pascal  [Select][+][-]
  1. procedure TCustomSynEdit.MarkTextAsSaved;
  2. begin
  3.   TSynEditStringList(fLines).MarkSaved;
  4.   if FLeftGutter.ChangesPart=nil then exit;
  5.   if FLeftGutter.Visible and FLeftGutter.ChangesPart(0).Visible then    
  6.  

lucamar

  • Hero Member
  • *****
  • Posts: 3074
Re: SynEdit produces an error on save file (and fix)
« Reply #1 on: May 26, 2019, 09:31:38 am »
A link to the bug report  would be nice ... O:-)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

aducom

  • Full Member
  • ***
  • Posts: 130
    • http://www.aducom.com

jamie

  • Hero Member
  • *****
  • Posts: 3637
Re: SynEdit produces an error on save file (and fix)
« Reply #3 on: May 26, 2019, 07:55:50 pm »
It works fine for me when dropping an SynEdit in the form via OI. All parts are there.
are you doing something to remove these parts?
The only true wisdom is knowing you know nothing

aducom

  • Full Member
  • ***
  • Posts: 130
    • http://www.aducom.com
Re: SynEdit produces an error on save file (and fix)
« Reply #4 on: May 27, 2019, 10:03:54 pm »
No, but I ported my code from 32 to 64 bits and upgraded lazarus. I think something must have gone wrong. I managed by adding the missing parts in the lfm file. However, there is an issue because you can remove a part, but you are not able to add it again because you can only add line number part. But that's another issue ;-) A tiny bit of hacking and the issue was solved.

 

TinyPortal © 2005-2018