Code complete only input coming from tty as reported by Reader.
This commit is contained in:
parent
e43f5dbaa5
commit
0a895426d2
@ -20,6 +20,7 @@
|
|||||||
#include "textinput/Callbacks.h"
|
#include "textinput/Callbacks.h"
|
||||||
#include "textinput/History.h"
|
#include "textinput/History.h"
|
||||||
#include "textinput/KeyBinding.h"
|
#include "textinput/KeyBinding.h"
|
||||||
|
#include "textinput/StreamReaderUnix.h"
|
||||||
#include "textinput/TextInput.h"
|
#include "textinput/TextInput.h"
|
||||||
#include "textinput/TextInputContext.h"
|
#include "textinput/TextInputContext.h"
|
||||||
|
|
||||||
@ -449,6 +450,9 @@ namespace textinput {
|
|||||||
ProcessMove(kMoveEnd, R);
|
ProcessMove(kMoveEnd, R);
|
||||||
std::vector<std::string> completions;
|
std::vector<std::string> completions;
|
||||||
TabCompletion* tc = fContext->GetCompletion();
|
TabCompletion* tc = fContext->GetCompletion();
|
||||||
|
Reader* reader = fContext->GetReaders()[0];
|
||||||
|
StreamReaderUnix* streamReader = (StreamReaderUnix*)(reader);
|
||||||
|
if (!streamReader->IsFromTTY()) return kPRSuccess;
|
||||||
if (tc) {
|
if (tc) {
|
||||||
bool ret = tc->Complete(Line, Cursor, R, completions);
|
bool ret = tc->Complete(Line, Cursor, R, completions);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -38,6 +38,8 @@ namespace textinput {
|
|||||||
virtual bool HavePendingInput(bool wait) = 0;
|
virtual bool HavePendingInput(bool wait) = 0;
|
||||||
virtual bool HaveBufferedInput() const { return false; }
|
virtual bool HaveBufferedInput() const { return false; }
|
||||||
virtual bool ReadInput(size_t& nRead, InputData& in) = 0;
|
virtual bool ReadInput(size_t& nRead, InputData& in) = 0;
|
||||||
|
|
||||||
|
virtual bool IsFromTTY() = 0;
|
||||||
private:
|
private:
|
||||||
TextInputContext* fContext; // Context object
|
TextInputContext* fContext; // Context object
|
||||||
};
|
};
|
||||||
|
@ -36,6 +36,7 @@ namespace textinput {
|
|||||||
bool HaveBufferedInput() const { return !fReadAheadBuffer.empty(); }
|
bool HaveBufferedInput() const { return !fReadAheadBuffer.empty(); }
|
||||||
bool ReadInput(size_t& nRead, InputData& in);
|
bool ReadInput(size_t& nRead, InputData& in);
|
||||||
|
|
||||||
|
bool IsFromTTY() override { return fIsTTY; }
|
||||||
private:
|
private:
|
||||||
int ReadRawCharacter();
|
int ReadRawCharacter();
|
||||||
bool ProcessCSI(InputData& in);
|
bool ProcessCSI(InputData& in);
|
||||||
|
@ -31,6 +31,8 @@ namespace textinput {
|
|||||||
bool HavePendingInput(bool wait);
|
bool HavePendingInput(bool wait);
|
||||||
bool ReadInput(size_t& nRead, InputData& in);
|
bool ReadInput(size_t& nRead, InputData& in);
|
||||||
|
|
||||||
|
bool IsFromTTY() override { return fIsConsole; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void HandleError(const char* Where) const;
|
void HandleError(const char* Where) const;
|
||||||
void HandleKeyEvent(unsigned char C, InputData& in);
|
void HandleKeyEvent(unsigned char C, InputData& in);
|
||||||
|
Loading…
Reference in New Issue
Block a user