summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-01-09 13:52:21 +0100
committertomsmeding <tom.smeding@gmail.com>2017-01-09 13:57:30 +0100
commitde013a7b1e16f021b3bc97818a5d7007ea0a92e9 (patch)
treefa109052097869cc608ea09051afca851f77d243
parent6ea066b983b627e12ab5b8e8ed08aa5b339bb9f0 (diff)
Newlines
-rw-r--r--buffer.cpp6
-rw-r--r--config.cpp3
2 files changed, 8 insertions, 1 deletions
diff --git a/buffer.cpp b/buffer.cpp
index 2123de1..f213e2f 100644
--- a/buffer.cpp
+++ b/buffer.cpp
@@ -35,6 +35,12 @@ void Buffer::receive(const Command &cmd){
}
//TODO: optimise this
renewLayout(screen[0].line,screen[0].part,lastWidth,lastHeight);
+ } else if(cmd[0]=="insert_newline"){
+ tb.insert(cursor.line,cursor.x,'\n');
+ cursor.x=0;
+ cursor.line++;
+ //TODO: optimise this
+ renewLayout(screen[0].line,screen[0].part,lastWidth,lastHeight);
} else {
THROW("Unknown command");
}
diff --git a/config.cpp b/config.cpp
index c2c12b7..0f57f3a 100644
--- a/config.cpp
+++ b/config.cpp
@@ -7,7 +7,8 @@ using namespace std;
Keybindings global_keybindings={
- {KEY_CTRL+'Q',{"quit_app"}}
+ {KEY_CTRL+'Q',{"quit_app"}},
+ {'\n',{"insert_newline"}},
};
class Init{public: Init(){