Browse Source

Merge pull request #1 from zalox/j

Removal of using namespace
merge-requests/365/head
Josh Wright 9 years ago committed by GitHub
parent
commit
e4b3c2affb
  1. 8
      src/source.cc
  2. 18
      src/window.cc

8
src/source.cc

@ -886,10 +886,9 @@ void Source::View::paste() {
get_buffer()->get_selection_bounds(start, end); get_buffer()->get_selection_bounds(start, end);
get_buffer()->erase(start, end); get_buffer()->erase(start, end);
} }
auto line=get_line_before(); auto iter=get_buffer()->get_insert()->get_iter();
std::string prefix_tabs;
auto tabs_end_iter=get_tabs_end_iter(); auto tabs_end_iter=get_tabs_end_iter();
prefix_tabs=get_line_before(tabs_end_iter); auto prefix_tabs=get_line_before(iter<tabs_end_iter?iter:tabs_end_iter);
size_t start_line=0; size_t start_line=0;
size_t end_line=0; size_t end_line=0;
@ -974,6 +973,9 @@ void Source::View::paste() {
paste_line=false; paste_line=false;
} }
} }
// add final newline if present in text
if(text.size()>0 && text.back()=='\n')
get_buffer()->insert_at_cursor('\n'+prefix_tabs);
get_buffer()->place_cursor(get_buffer()->get_insert()->get_iter()); get_buffer()->place_cursor(get_buffer()->get_insert()->get_iter());
get_buffer()->end_user_action(); get_buffer()->end_user_action();
scroll_to_cursor_delayed(this, false, false); scroll_to_cursor_delayed(this, false, false);

18
src/window.cc

@ -657,9 +657,8 @@ void Window::set_menu_actions() {
}); });
menu.add_action("source_find_file", [this]() { menu.add_action("source_find_file", [this]() {
using namespace boost::filesystem;
auto view = Notebook::get().get_current_view(); auto view = Notebook::get().get_current_view();
auto project_path = canonical(Directories::get().path); auto project_path = boost::filesystem::canonical(Directories::get().path);
if(view) { if(view) {
auto dialog_iter=view->get_iter_for_dialog(); auto dialog_iter=view->get_iter_for_dialog();
@ -670,29 +669,28 @@ void Window::set_menu_actions() {
} }
// std::vector<std::string> excludes; // std::vector<std::string> excludes;
path build_default_path, build_debug_path; boost::filesystem::path build_default_path, build_debug_path;
auto build = Project::Build::create(project_path); auto build = Project::Build::create(project_path);
if(!project_path.empty()) { if(!project_path.empty()) {
if (is_directory(build->get_default_path())) { if (is_directory(build->get_default_path())) {
build_default_path = canonical(build->get_default_path()); build_default_path = boost::filesystem::canonical(build->get_default_path());
} }
if (is_directory(build->get_debug_path())) { if (is_directory(build->get_debug_path())) {
build_debug_path = canonical(build->get_debug_path()); build_debug_path = boost::filesystem::canonical(build->get_debug_path());
} }
} }
// populate with all files in project // populate with all files in project
for (recursive_directory_iterator iter(project_path), end; iter != end; iter++) { for (boost::filesystem::recursive_directory_iterator iter(project_path), end; iter != end; iter++) {
auto path = canonical(iter->path()); auto path = boost::filesystem::canonical(iter->path());
// ignore folders, but not everything in them // ignore folders, but not everything in them
if (!is_regular_file(path)) { if (!boost::filesystem::is_regular_file(path)) {
continue; continue;
} }
// ignore build directory, and everything in it // ignore build directory, and everything in it
if ((filesystem::file_in_path(path, build_default_path) && build_default_path != "") || if ((filesystem::file_in_path(path, build_default_path) && build_default_path != "") ||
(filesystem::file_in_path(path, build_debug_path) && build_debug_path != "")) { (filesystem::file_in_path(path, build_debug_path) && build_debug_path != "")) {
std::cout << path << std::endl;
iter.pop(); iter.pop();
continue; continue;
} }
@ -704,7 +702,7 @@ void Window::set_menu_actions() {
} }
SelectionDialog::get()->on_select=[this, project_path](const std::string &selected, bool hide_window) { SelectionDialog::get()->on_select=[this, project_path](const std::string &selected, bool hide_window) {
auto full_path = canonical(selected); auto full_path = boost::filesystem::canonical(selected);
Notebook::get().open(full_path); Notebook::get().open(full_path);
auto view=Notebook::get().get_current_view(); auto view=Notebook::get().get_current_view();
view->hide_tooltips(); view->hide_tooltips();

Loading…
Cancel
Save