Browse Source

Minor cleanup of Find Ctags and Find File

merge-requests/365/head
eidheim 9 years ago
parent
commit
7b98877731
  1. 5
      src/ctags.cc
  2. 12
      src/window.cc

5
src/ctags.cc

@ -3,7 +3,6 @@
#include "terminal.h" #include "terminal.h"
#include "project_build.h" #include "project_build.h"
#include "filesystem.h" #include "filesystem.h"
#include "directories.h"
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <regex> #include <regex>
@ -22,12 +21,8 @@ std::pair<boost::filesystem::path, std::unique_ptr<std::stringstream> > Ctags::g
if(!relative_debug_path.empty()) if(!relative_debug_path.empty())
exclude+=" --exclude="+relative_debug_path.string(); exclude+=" --exclude="+relative_debug_path.string();
} }
else {
if(!Directories::get().path.empty())
run_path=Directories::get().path;
else else
run_path=path; run_path=path;
}
std::stringstream stdin_stream; std::stringstream stdin_stream;
//TODO: when debian stable gets newer g++ version that supports move on streams, remove unique_ptr below //TODO: when debian stable gets newer g++ version that supports move on streams, remove unique_ptr below

12
src/window.cc

@ -596,20 +596,20 @@ void Window::set_menu_actions() {
menu.add_action("source_find_symbol_ctags", [this]() { menu.add_action("source_find_symbol_ctags", [this]() {
auto view=Notebook::get().get_current_view(); auto view=Notebook::get().get_current_view();
boost::filesystem::path ctags_path; boost::filesystem::path search_path;
if(view) if(view)
ctags_path=view->file_path.parent_path(); search_path=view->file_path.parent_path();
else if(!Directories::get().path.empty()) else if(!Directories::get().path.empty())
ctags_path=Directories::get().path; search_path=Directories::get().path;
else { else {
boost::system::error_code ec; boost::system::error_code ec;
ctags_path=boost::filesystem::current_path(ec); search_path=boost::filesystem::current_path(ec);
if(ec) { if(ec) {
Terminal::get().print("Error: could not find current path\n", true); Terminal::get().print("Error: could not find current path\n", true);
return; return;
} }
} }
auto pair=Ctags::get_result(ctags_path); auto pair=Ctags::get_result(search_path);
auto path=std::move(pair.first); auto path=std::move(pair.first);
auto stream=std::move(pair.second); auto stream=std::move(pair.second);
@ -680,8 +680,6 @@ void Window::set_menu_actions() {
default_path = build->get_default_path(); default_path = build->get_default_path();
debug_path = build->get_debug_path(); debug_path = build->get_debug_path();
} }
else if (!Directories::get().path.empty())
search_path=Directories::get().path;
if(view) { if(view) {
auto dialog_iter=view->get_iter_for_dialog(); auto dialog_iter=view->get_iter_for_dialog();

Loading…
Cancel
Save