Browse Source

Fixed issues when merging Sarah's and Cameron's code

cameron
stew3254 4 years ago
parent
commit
8fe0702b6c
  1. 2
      src/Buffer.cpp
  2. 6
      src/Buffer.h
  3. 2
      src/FileBrowser.cpp
  4. 10
      test.txt

2
src/Buffer.cpp

@ -21,7 +21,7 @@ string* Buffer::get_lines() const
string* lines = new string[window_height];
int line_num = 0;
while (line_num < window_height && line_num + ix_top_line_ < v_lines_.size()) {
lines[line_num - ix_top_line_] = v_lines_[line_num];
lines[line_num] = v_lines_[line_num + ix_top_line_];
//cout << v_lines_[line_num] << endl;
++line_num;
}

6
src/Buffer.h

@ -18,8 +18,8 @@ public:
void move_to_next_page();
void move_to_previous_page();
int max_links();
bool go(int & link);
back();
bool go(int link);
void back();
bool open(const std::string & file_name);
std::string* get_lines() const;
void set_window_height(int h) { window_height = h; }
@ -47,7 +47,7 @@ inline void Buffer::move_to_previous_page()
ix_top_line_ = 0;
}
inline int Buffer::max::links()
inline int Buffer::max_links()
{
//return v_links.length();
return 1;

2
src/FileBrowser.cpp

@ -26,7 +26,7 @@ void FileBrowser::display()
//Display the lines
auto lines = buffer_.get_lines();
for (int i = 0; i < buffer_.window_height; ++i)
cout << lines[i] << endl;
cout << std::setw(4) << i+1 << " " << lines[i] << endl;
delete[] lines;
//buffer_.display();

10
test.txt

@ -5,31 +5,31 @@
<p>This line con<br>tains some<br > problematic< p> tags.
Derp. Derp. Derp. Derp. Derp.
<p>This is the first line in the file.
<p>This is the second <br> and third line of the file.
<p>This is the second <br> and eighth line of the file.
<p>This line has a link to the <a docs/specification.txt specification> file.
<p>This line is split into <p>two paragraph tags.
<p>This line con<br>tains some<br > problematic< p> tags.
Derp. Derp. Derp. Derp. Derp.
<p>This is the first line in the file.
<p>This is the second <br> and third line of the file.
<p>This is the second <br> and fourteenth line of the file.
<p>This line has a link to the <a docs/specification.txt specification> file.
<p>This line is split into <p>two paragraph tags.
<p>This line con<br>tains some<br > problematic< p> tags.
Derp. Derp. Derp. Derp. Derp.
<p>This is the first line in the file.
<p>This is the second <br> and third line of the file.
<p>This is the second <br> and twentieth line of the file.
<p>This line has a link to the <a docs/specification.txt specification> file.
<p>This line is split into <p>two paragraph tags.
<p>This line con<br>tains some<br > problematic< p> tags.
Derp. Derp. Derp. Derp. Derp.
<p>This is the first line in the file.
<p>This is the second <br> and third line of the file.
<p>This is the second <br> and twenty sixth line of the file.
<p>This line has a link to the <a docs/specification.txt specification> file.
<p>This line is split into <p>two paragraph tags.
<p>This line con<br>tains some<br > problematic< p> tags.
Derp. Derp. Derp. Derp. Derp.
<p>This is the first line in the file.
<p>This is the second <br> and third line of the file.
<p>This is the second <br> and thirty second line of the file.
<p>This line has a link to the <a docs/specification.txt specification> file.
<p>This line is split into <p>two paragraph tags.
<p>This line con<br>tains some<br > problematic< p> tags.

Loading…
Cancel
Save