fix #83, new line insterted after reloading doc

This commit is contained in:
Basile Burg 2016-07-03 06:42:35 +02:00
parent 3b6b3c4d65
commit 6d70c3e597
2 changed files with 13 additions and 9 deletions

View File

@ -6,8 +6,9 @@ interface
uses uses
Classes, SysUtils, FileUtil, RTTIGrids, Forms, Controls, Graphics, ExtCtrls, Classes, SysUtils, FileUtil, RTTIGrids, Forms, Controls, Graphics, ExtCtrls,
Menus, Buttons, process, ce_widget, ce_interfaces, ce_observer, ce_synmemo, Menus, Buttons, process, SynEditKeyCmds, ce_widget, ce_interfaces, ce_observer,
ce_writableComponent, ce_common, ce_sharedres, PropEdits, ObjectInspector; ce_synmemo, ce_writableComponent, ce_common, ce_sharedres, PropEdits,
ObjectInspector;
type type
@ -301,12 +302,15 @@ begin
inp := fDoc.Lines.Text; inp := fDoc.Lines.Text;
prc.Input.Write(inp[1], inp.length); prc.Input.Write(inp[1], inp.length);
prc.CloseInput; prc.CloseInput;
while prc.Running do (*!*); while prc.Running do
sleep(1);
try try
str := TStringList.Create; str := TStringList.Create;
processOutputToStrings(prc,str); processOutputToStrings(prc,str);
fDoc.SelectAll; fDoc.ClearAll;
fDoc.SelText:= str.Text; fDoc.InsertTextAtCaret(str.Text);
fDoc.SelStart:= high(integer);
fDoc.ExecuteCommand(ecDeleteLastChar, #0, nil);
except except
fDoc.Lines.Assign(fBackup); fDoc.Lines.Assign(fBackup);
end; end;

View File

@ -1783,10 +1783,10 @@ begin
str := TStringList.Create; str := TStringList.Create;
try try
str.LoadFromFile(fFilename); str.LoadFromFile(fFilename);
SelectAll; ClearAll;
SelText:= str.Text; InsertTextAtCaret(str.Text);
SelStart:=0; SelStart:= high(integer);
SelEnd:=0; ExecuteCommand(ecDeleteLastChar, #0, nil);
fModified := true; fModified := true;
finally finally
str.Free; str.Free;