From 7329af23f0420a1b5a26367a89d36157be39fcf8 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 23 Sep 2015 03:48:15 +0200 Subject: [PATCH] update tab caption --- src/ce_editor.pas | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ce_editor.pas b/src/ce_editor.pas index 5d6fb62a..ec95ce98 100644 --- a/src/ce_editor.pas +++ b/src/ce_editor.pas @@ -372,8 +372,8 @@ end; procedure TCEEditorWidget.updateImperative; const modstr: array[boolean] of string = ('...', 'MODIFIED'); -//var - //md: string; +var + md: string; begin if fDoc = nil then begin editorStatus.Panels[0].Text := ''; @@ -383,19 +383,19 @@ begin editorStatus.Panels[0].Text := format('%d : %d | %d', [fDoc.CaretY, fDoc.CaretX, fDoc.SelEnd - fDoc.SelStart]); editorStatus.Panels[1].Text := modstr[fDoc.modified]; editorStatus.Panels[2].Text := fDoc.fileName; - // TODO-cEditor: set tab caption directly (e.g one start, if reload last docs) - //if Visible then if pageControl.ActivePage <> nil then - //if pageControl.ActivePage.Caption = '' then - //begin - // if fDoc.isDSource then - // begin - // lex(fDoc.Lines.Text, fTokList, @lexFindToken); - // md := getModuleName(fTokList); - // fTokList.Clear; - // end; - // if md = '' then md := extractFileName(fDoc.fileName); - // pageControl.ActivePage.Caption := md; - //end; + if Visible and (pageControl.ActivePage <> nil) and ((pageControl.ActivePage.Caption = '') or + (pageControl.ActivePage.Caption = '')) then + begin + if fDoc.isDSource then + begin + fErrList.Clear; + fTokList.Clear; + lex(fDoc.Lines.Text, fTokList, @lexFindToken); + md := getModuleName(fTokList); + end; + if md = '' then md := extractFileName(fDoc.fileName); + pageControl.ActivePage.Caption := md; + end; end; end; @@ -426,20 +426,20 @@ begin if fDoc.isDSource then begin fTokList.Clear; + fErrList.Clear; lex(fDoc.Lines.Text, fTokList, @lexFindToken); md := getModuleName(fTokList); end; if md = '' then md := extractFileName(fDoc.fileName); pageControl.ActivePage.Caption := md; - // - fTokList.Clear; - fErrList.Clear; + + // note: not true anymore vecause cesyms use send the doc in stdin // when a widget saves a temp file & syncro mode is on: // - editor is saved // - gutter is updated (green bar indicating a saved block) // - syncroedit icon is hidden - if fDoc.syncroEdit.Active then - fDoc.Refresh; + //if fDoc.syncroEdit.Active then + //fDoc.Refresh; end; {$ENDREGION}