diff options
| Commit | bbf74136641a70150fa8e09b69b99bbce99ffeaf (patch) | |
|---|---|---|
| Author | 2022-05-29 09:09:11 +0300 | |
| Committer | 2022-05-29 09:09:11 +0300 | |
| Files | 90c6cc4c58f6bd954c6642c48f6f4fc4df3bb180 | |
| FMI-OOP-P2_Tables-bbf74136641a70150fa8e09b69b99bbce99ffeaf.tar FMI-OOP-P2_Tables-bbf74136641a70150fa8e09b69b99bbce99ffeaf.tar.gz FMI-OOP-P2_Tables-bbf74136641a70150fa8e09b69b99bbce99ffeaf.zip | ||
| Parent | 8fe5955772e0c10f22a8f6e40616ce79b2e88491 (diff) | |
Autocommit at 29.05.2022 @ 09:09
3 files changed, 10 insertions, 1 deletions
| -rw-r--r-- | src/Generic/ConsoleInterface/Toolbox.cpp | 2 | ||||
| -rw-r--r-- | src/Models/Table.cpp | 2 | ||||
| -rw-r--r-- | src/UserInterface/UserInterface.cpp | 7 |
diff --git a/src/Generic/ConsoleInterface/Toolbox.cpp b/src/Generic/ConsoleInterface/Toolbox.cpp index 64649e9..ca739f0 100644 --- a/src/Generic/ConsoleInterface/Toolbox.cpp +++ b/src/Generic/ConsoleInterface/Toolbox.cpp @@ -79,7 +79,7 @@ void printTable(const List<String>& items, unsigned columns) { __printPadded(items[i], colWidths[i % columns]); if (i % columns == columns - 1) printLine(""); - else if (i % columns > 0) + else print("|"); } diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index edaccf7..7e4a7ac 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -39,6 +39,8 @@ void Table::putCell(unsigned row, unsigned col, const char* rawValue) { ? (Cell*)new CellFormula(rawValue, &cells) : (Cell*)new CellString(rawValue); } + if (cells[row][col] != nullptr) + delete cells[row][col]; cells[row][col] = newCell; } diff --git a/src/UserInterface/UserInterface.cpp b/src/UserInterface/UserInterface.cpp index 5e9ef00..4036840 100644 --- a/src/UserInterface/UserInterface.cpp +++ b/src/UserInterface/UserInterface.cpp @@ -15,6 +15,13 @@ void UserInterface::com_print(const char* params) { void UserInterface::com_edit(const char* params) { while (*params == ' ') params++; + + unsigned row = atoi(++params); + while (*params != 'C') params++; + unsigned col = atoi(++params); + while (*params != ' ') params++; + + table->putCell(row, col, params); } /* Public */ |
