|
|
@ -31,7 +31,7 @@ bool Buffer::open(const string & new_file_name) |
|
|
|
// Remove any newlines that are in the file.
|
|
|
|
for(auto char_loc = line.find_first_of('\n'); char_loc != -1; char_loc = line.find_first_of('\n')) |
|
|
|
line.erase(char_loc, 1); |
|
|
|
|
|
|
|
|
|
|
|
// Replace break tags with newlines.
|
|
|
|
for(auto char_loc = line.find("<br>"); char_loc != -1; char_loc = line.find("<br>")) |
|
|
|
line.replace(char_loc, 4, "\n"); |
|
|
@ -49,7 +49,7 @@ bool Buffer::open(const string & new_file_name) |
|
|
|
std::string link_name = link_tag.substr(second_space_loc + 1); |
|
|
|
|
|
|
|
v_links_.push_back({file_name, link_name}); |
|
|
|
|
|
|
|
|
|
|
|
line.replace(tag_loc, tag_len + 1, "<" + link_name + ">[" + to_string(curr_link) + "]"); |
|
|
|
} |
|
|
|
|
|
|
@ -63,7 +63,7 @@ bool Buffer::open(const string & new_file_name) |
|
|
|
|
|
|
|
// However, if the paragraph is empty, then it shouldn't be added.
|
|
|
|
if(curr_p != "") |
|
|
|
{ |
|
|
|
{ |
|
|
|
v_lines_.push_back(curr_p); |
|
|
|
curr_p = ""; |
|
|
|
} |
|
|
@ -79,22 +79,33 @@ bool Buffer::open(const string & new_file_name) |
|
|
|
|
|
|
|
file_name_ = new_file_name; |
|
|
|
ix_top_line_ = 0; |
|
|
|
v_hist_.push_back(file_name); |
|
|
|
curr_link_itr = v_hist_.end() - 1; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
bool go(int & link) |
|
|
|
{ |
|
|
|
string f_name = v_links[link - 1]; |
|
|
|
|
|
|
|
string f_name = v_links[link].first; |
|
|
|
|
|
|
|
if(!open(f_name)) |
|
|
|
return false; |
|
|
|
else |
|
|
|
v_hist_.push_back(f_name); |
|
|
|
curr_link_itr = v_hist_.end() - 1; |
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void back() |
|
|
|
bool back() |
|
|
|
{ |
|
|
|
|
|
|
|
v_hist_.erase(curr_link_itr); |
|
|
|
|
|
|
|
if(v_hist_.size() == 0) |
|
|
|
return false; |
|
|
|
|
|
|
|
curr_link_itr = prev(curr_link_itr); |
|
|
|
open(*current_link_itr); |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|