-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
47 lines (33 loc) · 1.22 KB
/
main.cpp
File metadata and controls
47 lines (33 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "texteditorcore.hpp"
#include<fstream>
#include<iostream>
#include "position.hpp"
/*---------------------------------------------------------------------------*/
void
inserter( TextEditorCore& _t, const position& _from, const std::string& _text) {
static size_t counter{};
++counter;
std::cout << "Test #" << counter << std::endl;
_t.setCursor( _from );
_t.insert( _text );
std::cout << _t.getCursorPosition();
std::cout << " ==========================================================" << std::endl;
} // inserter
/*---------------------------------------------------------------------------*/
void
deleter(TextEditorCore& _t, const position& _from, const position& _to ) {
static size_t counter{1};
++counter;
std::cout << "Test #" << counter << std::endl;
_t.setCursor( _from ).startSelection().setCursor( _to );
_t.removeSelectedText();
std::cout << _t.getCursorPosition();
std::cout << " ==========================================================" << std::endl;
} // deleter
/*---------------------------------------------------------------------------*/
int main() {
TextEditorCore t;
const std::string text = "Just some text";
inserter( t, t.getCursorPosition(), text);
deleter( t, {0,0}, {2,1} );
}