summaryrefslogtreecommitdiffstats
path: root/sinksh/repl/repl.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-23 16:49:49 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-23 16:52:00 +0200
commit426392f71d5f45aad8c57969643fd6c365ce2362 (patch)
tree3e5b6ddfc395e26f1a931f9a97516ede9b7c68d3 /sinksh/repl/repl.cpp
parent1ec240e3df3e9c8571c0df174b9f239b451dbf3a (diff)
downloadsink-426392f71d5f45aad8c57969643fd6c365ce2362.tar.gz
sink-426392f71d5f45aad8c57969643fd6c365ce2362.zip
Replaced readline with cpp-linenoise
... a single header readline replacement that works on all linux, osx and windows (or so they claim). Besides cleaning up the code considerably, it should help us build sinksh on windows where readline is not really (there are some ancient broken readline ports) available. cpp-readline comes from here: https://github.com/yhirose/cpp-linenoise
Diffstat (limited to 'sinksh/repl/repl.cpp')
-rw-r--r--sinksh/repl/repl.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/sinksh/repl/repl.cpp b/sinksh/repl/repl.cpp
index 21209fc..32932cb 100644
--- a/sinksh/repl/repl.cpp
+++ b/sinksh/repl/repl.cpp
@@ -19,8 +19,6 @@
19 19
20#include "repl.h" 20#include "repl.h"
21 21
22#include <readline/history.h>
23
24#include <QDir> 22#include <QDir>
25#include <QFile> 23#include <QFile>
26#include <QFinalState> 24#include <QFinalState>
@@ -29,13 +27,12 @@
29 27
30#include "replStates.h" 28#include "replStates.h"
31#include "syntaxtree.h" 29#include "syntaxtree.h"
30#include "linenoise.hpp"
32 31
33Repl::Repl(QObject *parent) 32Repl::Repl(QObject *parent)
34 : QStateMachine(parent) 33 : QStateMachine(parent)
35{ 34{
36 // readline history setup 35 linenoise::LoadHistory(commandHistoryPath().toLocal8Bit());
37 using_history();
38 read_history(commandHistoryPath().toLocal8Bit());
39 36
40 // create all states 37 // create all states
41 ReadState *read = new ReadState(this); 38 ReadState *read = new ReadState(this);
@@ -64,8 +61,7 @@ Repl::Repl(QObject *parent)
64 61
65Repl::~Repl() 62Repl::~Repl()
66{ 63{
67 // readline history writing 64 linenoise::SaveHistory(commandHistoryPath().toLocal8Bit());
68 write_history(commandHistoryPath().toLocal8Bit());
69} 65}
70 66
71void Repl::printWelcomeBanner() 67void Repl::printWelcomeBanner()