Browse Source

Find Documentation now works on OS X.

merge-requests/365/head
eidheim 10 years ago
parent
commit
e9f26db92c
  1. 1
      README.md
  2. 6
      src/entrybox.cc
  3. 2
      src/entrybox.h
  4. 2
      src/files.h
  5. 32
      src/source.cc

1
README.md

@ -17,6 +17,7 @@ towards libclang with speed and ease of use in mind.
* Tooltips showing type information and doxygen documentation
* Refactoring across files
* Highlighting of similar types
* Documentation search
* Spell checking depending on file context
* Run shell commands within JuCi++, even on Windows
* Regex search and replace

6
src/entrybox.cc

@ -16,8 +16,9 @@ namespace sigc {
std::unordered_map<std::string, std::vector<std::string> > EntryBox::entry_histories;
EntryBox::Entry::Entry(const std::string& content, std::function<void(const std::string& content)> on_activate, unsigned length) : Gtk::Entry(), on_activate(on_activate) {
set_max_length(length);
EntryBox::Entry::Entry(const std::string& content, std::function<void(const std::string& content)> on_activate, unsigned width_chars) : Gtk::Entry(), on_activate(on_activate) {
set_max_length(0);
set_width_chars(width_chars);
set_text(content);
selected_history=0;
signal_activate().connect([this](){
@ -92,7 +93,6 @@ void EntryBox::clear() {
void EntryBox::show() {
std::vector<Gtk::Widget*> focus_chain;
for(auto& entry: entries) {
entry.set_max_length(0);
lower_box.pack_start(entry, Gtk::PACK_SHRINK);
focus_chain.emplace_back(&entry);
}

2
src/entrybox.h

@ -12,7 +12,7 @@ class EntryBox : public Gtk::Box {
public:
class Entry : public Gtk::Entry {
public:
Entry(const std::string& content="", std::function<void(const std::string& content)> on_activate=nullptr, unsigned length=50);
Entry(const std::string& content="", std::function<void(const std::string& content)> on_activate=nullptr, unsigned width_chars=-1);
std::function<void(const std::string& content)> on_activate;
private:
size_t selected_history;

2
src/files.h

@ -97,7 +97,7 @@ const std::string configjson =
" \"clang\": {\n"
" \"separator\": \"::\",\n"
" \"queries\": {\n"
" \"@empty\": \"https://www.google.com/search?btnI&q=site:http://www.cplusplus.com/reference/+\",\n"
" \"@empty\": \"https://www.google.com/search?btnI&q=c%2B%2B+\",\n"
" \"std\": \"https://www.google.com/search?btnI&q=site:http://www.cplusplus.com/reference/+\",\n"
" \"boost\": \"https://www.google.com/search?btnI&q=site:http://www.boost.org/doc/libs/1_59_0/+\",\n"
" \"Gtk\": \"https://www.google.com/search?btnI&q=site:https://developer.gnome.org/gtkmm/stable/+\",\n"

32
src/source.cc

@ -2369,27 +2369,35 @@ Source::ClangViewAutocomplete(file_path, project_path, language) {
auto referenced=cursor.get_referenced();
if(referenced) {
auto usr=referenced.get_usr();
boost::filesystem::path referenced_path=referenced.get_source_location().get_path();
//Return empty if referenced is within project
if(referenced_path.generic_string().substr(0, this->project_path.generic_string().size()+1)==this->project_path.generic_string()+'/')
return data;
data.emplace_back("clang");
//namespace - not working
size_t pos1=usr.find("@N@");
size_t pos2;
std::string first_namespace;
while(pos1!=std::string::npos) {
size_t pos1=0, pos2;
while((pos1=usr.find('@', pos1))!=std::string::npos && pos1+1<usr.size() && usr[pos1+1]=='N') {
pos1+=3;
pos2=find_non_word_char(usr, pos1);
if(pos1!=std::string::npos && pos2!=std::string::npos) {
if(pos2!=std::string::npos) {
auto ns=usr.substr(pos1, pos2-pos1);
if(first_namespace.size()==0)
first_namespace=ns;
else if(ns==first_namespace || ns=="std")
if(ns=="__1")
break;
data.emplace_back(ns);
pos1=usr.find("@N@", pos2);
pos1=pos2;
}
else
pos1=std::string::npos;
break;
}
if(data.size()==1)
data.emplace_back("");
//function
pos1=usr.find("@F@");
size_t function_pos=pos1;
//type
pos1=usr.find("@T@");
@ -2399,7 +2407,7 @@ Source::ClangViewAutocomplete(file_path, project_path, language) {
pos1+=3;
pos2=find_non_word_char(usr, pos1);
}
if(pos1!=std::string::npos) {
if(pos1!=std::string::npos && pos1<function_pos) {
if(pos2!=std::string::npos)
data.emplace_back(usr.substr(pos1, pos2-pos1));
else
@ -2407,7 +2415,7 @@ Source::ClangViewAutocomplete(file_path, project_path, language) {
}
//function
pos1=usr.find("@F@");
pos1=function_pos;
if(pos1!=std::string::npos) {
pos1+=3;
pos2=find_non_word_char(usr, pos1);

Loading…
Cancel
Save