ide: Navigator cosmetics

This commit is contained in:
Mirek Fidler 2022-11-28 16:02:08 +01:00
parent 2f45699faf
commit 2f5c162efb
2 changed files with 16 additions and 16 deletions

View file

@ -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;

View file

@ -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);
}
}