diff --git a/ide/fpconst.pas b/ide/fpconst.pas
index d2b2a9fdd6..45c428bd74 100644
--- a/ide/fpconst.pas
+++ b/ide/fpconst.pas
@@ -140,6 +140,7 @@ const
      hidRunDir            = 209;
      hidBreakpointDialogCond = 210;
      hidPrinterDevice      = 211;
+     hidEvaluate           = 212;
 
      { Command constants }
      cmShowClipboard     = 201;
diff --git a/ide/fpevalw.pas b/ide/fpevalw.pas
index d6892c83b4..92c46113ea 100644
--- a/ide/fpevalw.pas
+++ b/ide/fpevalw.pas
@@ -35,6 +35,9 @@ begin
   new(expr_input,init(r,255));
   insert(expr_input);
 
+  r.assign(size.x-20,3,size.x-18,4);
+  insert(new(Phistory,init(r,expr_input,hidEvaluate)));
+
   r.assign(2,2,size.x-20,3);
   new(l,init(r,'E~x~pression:',expr_input));
   insert(l);
diff --git a/ide/weditor.pas b/ide/weditor.pas
index 6ea5738ac7..3573c340d7 100644
--- a/ide/weditor.pas
+++ b/ide/weditor.pas
@@ -5927,6 +5927,10 @@ begin
   begin
     LineNo:='1';
     Lines:=GetLineCount;
+    {Linecount can be 0, but in that case there still is a cursor blinking in top
+     of the window, which will become line 1 as soon as sometype hits a key.}
+    if lines=0 then
+      lines:=1;
     if EditorDialog(edGotoLine, @GotoRec) <> cmCancel then
     begin
       Lock;