stew3254 4 years ago
parent
commit
71aeaf6a90
  1. 17
      src/Buffer.cpp
  2. 9
      src/Buffer.h
  3. 6
      src/FileBrowser.cpp

17
src/Buffer.cpp

@ -100,3 +100,20 @@ bool Buffer::open(const string & new_file_name)
ix_top_line_ = 0;
return true;
}
bool go(int & link)
{
string f_name = v_links[link - 1];
if(!open(f_name))
return false;
else
return true;
}
void back()
{
}

9
src/Buffer.h

@ -17,6 +17,9 @@ public:
const std::string & file_name() const { return file_name_; }
void move_to_next_page();
void move_to_previous_page();
int max_links();
bool go(int & link);
back();
bool open(const std::string & file_name);
std::string* get_lines() const;
void set_window_height(int h) { window_height = h; }
@ -44,4 +47,10 @@ inline void Buffer::move_to_previous_page()
ix_top_line_ = 0;
}
inline int Buffer::max::links()
{
//return v_links.length();
return 1;
}
#endif

6
src/FileBrowser.cpp

@ -54,12 +54,14 @@ void FileBrowser::execute_command(char command, bool & done)
ss.str(temp);
ss >> link;
if (!ss) {
error_message_ = "Could not open " + temp;
error_message_ = temp + " is not a valid link";
}
if (link < 1 || link > buffer_.max_links()) {
error_message_ = "Could not open " + temp + " because the file is out of range";
}
buffer_.go(link);
if(!buffer_.go(link)){
error_message_ = "Could not open link " + link;
}
break;
}
*/

Loading…
Cancel
Save