OSDN Git Service

初回Tabファイル保存時にエラーメッセージが出るのを修正
[gikonavigoeson/gikonavi.git] / ItemDownload.pas
index 9338717..fe0fb18 100644 (file)
@@ -156,9 +156,7 @@ var
        Idx: Integer;
        ATitle: string;
        DownloadResult: Boolean;
-       foundPos: Integer;
        boardPlugIn     : TBoardPlugIn;
-       listContent     : string;
        lastContent             : string;
        logFile                         : TFileStream;
        adjustMargin    : Integer;
@@ -1186,11 +1184,11 @@ var
        NewRes: Integer;
        finish : Boolean;
        loopCnt : Integer;
-       KokoTxt : string;
-       KokoIdx : Integer;
-       NewTxt  : string;
-       NewIdx  : Integer;
-       LastTxt : string;
+//     KokoTxt : string;
+//     KokoIdx : Integer;
+//     NewTxt  : string;
+//     NewIdx  : Integer;
+//     LastTxt : string;
        LastIdx : Integer;
 begin
        FileName := ThreadItem.GetThreadFileName;
@@ -1251,7 +1249,8 @@ begin
 
                                                Body.Text := Content;
                                                if (ThreadItem.Kokomade > 0) and (ThreadItem.Kokomade <= oldBody.Count) then begin
-                                                       ThreadItem.Kokomade := Body.IndexOf(oldBody.Strings[ ThreadItem.Kokomade - 1 ]) + 1;
+                                                       ThreadItem.Kokomade := Body.IndexOf(oldBody.Strings[ ThreadItem.Kokomade - 1 ]);
+                                                       if ThreadItem.Kokomade <> -1 then ThreadItem.Kokomade := ThreadItem.Kokomade + 1;
                                                end;
 
                                                LastIdx := oldBody.Count;
@@ -1260,8 +1259,10 @@ begin
                                                        OldCnt := Body.IndexOf(oldBody.Strings[ LastIdx ]) + 1;
                                                until ( OldCnt <> 0 ) or (LastIdx = 0);
 
+                                               if OldCnt >= Body.Count then OldCnt := Body.Count - 1;
                                                NewRes := Body.Count - OldCnt;
 
+
                                        finally
                                                oldBody.Free;
                                        end;
@@ -1298,8 +1299,10 @@ begin
        ThreadItem.AllResCount := ThreadItem.Count;
        ThreadItem.IsLogFile := True;
        ThreadItem.RoundDate := Now;
-       ThreadItem.UnRead := True;
-       ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead + 1;
+       if not ThreadItem.UnRead then begin
+               ThreadItem.UnRead := True;
+               ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead + 1;
+       end;
 //     if ThreadItem.RoundNo = 6 then
 //             ThreadItem.RoundNo := 0;