|
|
|
@ -9,7 +9,7 @@ namespace groove { |
|
|
|
|
Editor::Editor(std::string filename) : x(0), y(0), |
|
|
|
|
buffer(std::make_unique<Buffer>()), mode_(Mode::EDIT), |
|
|
|
|
filename(filename), offset(0), voffset(0), lineMode(LineMode::RELATIVE), |
|
|
|
|
history(History()) { |
|
|
|
|
history(History()), inComment(false) { |
|
|
|
|
this->modes.emplace(Mode::INSERT, std::make_unique<modes::Insert>(*this)); |
|
|
|
|
this->modes.emplace(Mode::EDIT, std::make_unique<modes::Edit>(*this)); |
|
|
|
|
this->modes.emplace(Mode::QUIT, std::make_unique<modes::Quit>(*this)); |
|
|
|
@ -95,6 +95,10 @@ namespace groove { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (auto& car : line) { |
|
|
|
|
if (car == '*' && this->lastChar == '/') |
|
|
|
|
this->inComment = true; |
|
|
|
|
if (car == '/' && this->lastChar == '*') |
|
|
|
|
this->inComment = false; |
|
|
|
|
if (hilist.find(x - this->vspace) != hilist.end()) { |
|
|
|
|
found = x - this->vspace; |
|
|
|
|
len = hilist.at(x - this->vspace).first; |
|
|
|
@ -108,8 +112,11 @@ namespace groove { |
|
|
|
|
len = -1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (inComment) |
|
|
|
|
attron(COLOR_PAIR(ncurses::Colors::ORANGE)); |
|
|
|
|
mvaddch(i - this->offset, x , car); |
|
|
|
|
attron(COLOR_PAIR(ncurses::Colors::MAIN)); |
|
|
|
|
this->lastChar = car; |
|
|
|
|
x++; |
|
|
|
|
} |
|
|
|
|
//mvprintw(i - this->offset, 0, line.c_str());
|
|
|
|
|