diff --git a/uppsrc/ide/Navigator.cpp b/uppsrc/ide/Navigator.cpp index 4bdecbb37..32a3f1632 100644 --- a/uppsrc/ide/Navigator.cpp +++ b/uppsrc/ide/Navigator.cpp @@ -169,7 +169,6 @@ void Navigator::Navigate() Search(); navigating = false; } - SyncCursor(); } else if(m.kind == KIND_SRCFILE) { @@ -182,6 +181,7 @@ void Navigator::Navigate() } } navigating = false; + SyncCursor(); } void Navigator::NavigatorClick() @@ -227,21 +227,6 @@ void Ide::SearchCode() } } -void Ide::SwitchHeader() -{ - int c = filelist.GetCursor(); - if(c < 0) return; - String currfile = filelist[c]; - const char *ext = GetFileExtPos(currfile); - if(!stricmp(ext, ".h") || !stricmp(ext, ".hpp") - || !stricmp(ext, ".lay") || !stricmp(ext, ".iml")) { - int f = filelist.Find(ForceExt(currfile, ".cpp")); - if(f < 0) f = filelist.Find(ForceExt(currfile, ".c")); - if(f < 0) f = filelist.Find(ForceExt(currfile, ".cc")); - if(f >= 0) filelist.SetCursor(f); - } -} - void Navigator::NavigatorDisplay::PaintBackground(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { int ii = q; diff --git a/uppsrc/ide/Swaps.cpp b/uppsrc/ide/Swaps.cpp index e3a24a711..f8e48ac32 100644 --- a/uppsrc/ide/Swaps.cpp +++ b/uppsrc/ide/Swaps.cpp @@ -67,3 +67,18 @@ void Ide::Cycle(const AnnotationItem& cm, int liney, bool navigate) q = q < 0 ? 0 : (q + 1) % list.GetCount(); GotoPos(list[q].path, list[q].pos); } + +void Ide::SwitchHeader() +{ + int c = filelist.GetCursor(); + if(c < 0) return; + String currfile = filelist[c]; + const char *ext = GetFileExtPos(currfile); + if(!stricmp(ext, ".h") || !stricmp(ext, ".hpp") + || !stricmp(ext, ".lay") || !stricmp(ext, ".iml")) { + int f = filelist.Find(ForceExt(currfile, ".cpp")); + if(f < 0) f = filelist.Find(ForceExt(currfile, ".c")); + if(f < 0) f = filelist.Find(ForceExt(currfile, ".cc")); + if(f >= 0) filelist.SetCursor(f); + } +}