Skip to content

Commit

Permalink
Fixed: debugger 'Output' tab 'Clear' button does not work
Browse files Browse the repository at this point in the history
eranif committed Jul 22, 2018
1 parent 052e78f commit 376f2b7
Showing 4 changed files with 17 additions and 39 deletions.
4 changes: 2 additions & 2 deletions LiteEditor.workspace
Original file line number Diff line number Diff line change
@@ -137,7 +137,7 @@
<Project Name="SampleWorksapce" ConfigName="Debug"/>
<Project Name="SmartCompletion" ConfigName="Win_x64_Debug"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="CMake_Release" Selected="yes">
<WorkspaceConfiguration Name="CMake_Release" Selected="no">
<Environment/>
<Project Name="ZoomNavigator" ConfigName="DebugUnicode"/>
<Project Name="wxsqlite3" ConfigName="Win_x86_Release"/>
@@ -372,7 +372,7 @@
<Project Name="SampleWorksapce" ConfigName="Debug"/>
<Project Name="SmartCompletion" ConfigName="Win_x64_Debug"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="Win_x64_Release" Selected="no">
<WorkspaceConfiguration Name="Win_x64_Release" Selected="yes">
<Environment/>
<Project Name="AutoSave" ConfigName="Win_x64_Release"/>
<Project Name="CCTest" ConfigName="Debug"/>
2 changes: 1 addition & 1 deletion LiteEditor/LiteEditor.project
Original file line number Diff line number Diff line change
@@ -2056,7 +2056,7 @@ resources.cpp: resources.xrc
<Library Value="libclang64.dll"/>
</Linker>
<ResourceCompiler Options="$(shell wx-config --rcflags)" Required="yes"/>
<General OutputFile="$(IntermediateDirectory)/codelite-dbg.exe" IntermediateDirectory="$(ConfigurationName)" Command=".\codelite-dbg.exe" CommandArguments="-b . " UseSeparateDebugArgs="no" DebugArguments="-b . --no-plugins" WorkingDirectory="../Runtime" PauseExecWhenProcTerminates="no" IsGUIProgram="no" IsEnabled="yes"/>
<General OutputFile="$(IntermediateDirectory)/codelite-dbg.exe" IntermediateDirectory="$(ConfigurationName)" Command=".\codelite-dbg.exe" CommandArguments="-b . " UseSeparateDebugArgs="yes" DebugArguments="-b . --no-plugins" WorkingDirectory="../Runtime" PauseExecWhenProcTerminates="no" IsGUIProgram="no" IsEnabled="yes"/>
<BuildSystem Name="Default"/>
<Environment EnvVarSetName="Default" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[PATH=../sdk/clang/lib;$(WXWIN)\lib\gcc_dll;$(PATH)]]>
42 changes: 12 additions & 30 deletions Plugin/wxterminal.cpp
Original file line number Diff line number Diff line change
@@ -125,9 +125,7 @@ void wxTerminal::OnEnter()
{
if(m_interactive) {
wxString lineText = GetCommandText();
if(lineText.IsEmpty()) {
return;
}
if(lineText.IsEmpty()) { return; }
clCommandEvent event(wxEVT_TERMINAL_EXECUTE_COMMAND);
event.SetEventObject(this);
event.SetString(lineText);
@@ -226,7 +224,9 @@ bool wxTerminal::IsRunning() { return m_process != NULL; }

void wxTerminal::Clear()
{
m_textCtrl->SetReadOnly(false);
m_textCtrl->ClearAll();
m_textCtrl->SetReadOnly(true);
CaretToEnd();
}

@@ -236,9 +236,7 @@ wxString wxTerminal::StartTTY()
m_process = NULL;
// Open the master side of a pseudo terminal
int master = ::posix_openpt(O_RDWR | O_NOCTTY);
if(master < 0) {
return "";
}
if(master < 0) { return ""; }

// Grant access to the slave pseudo terminal
if(::grantpt(master) < 0) {
@@ -290,9 +288,7 @@ void wxTerminal::DoFlushOutputBuffer()
{
if(!m_outputBuffer.IsEmpty()) {
CaretToEnd();
if(!m_outputBuffer.EndsWith("\n")) {
m_outputBuffer << "\n";
}
if(!m_outputBuffer.EndsWith("\n")) { m_outputBuffer << "\n"; }
AddTextRaw(m_outputBuffer);
m_outputBuffer.Clear();
}
@@ -304,9 +300,7 @@ void wxTerminal::OnCopy(wxCommandEvent& event)
event.Skip();
return;
}
if(m_textCtrl->CanCopy()) {
m_textCtrl->Copy();
}
if(m_textCtrl->CanCopy()) { m_textCtrl->Copy(); }
}

void wxTerminal::OnCut(wxCommandEvent& event)
@@ -315,9 +309,7 @@ void wxTerminal::OnCut(wxCommandEvent& event)
event.Skip();
return;
}
if(m_textCtrl->CanCut()) {
m_textCtrl->Cut();
}
if(m_textCtrl->CanCut()) { m_textCtrl->Cut(); }
}

void wxTerminal::OnSelectAll(wxCommandEvent& event)
@@ -339,24 +331,18 @@ void wxTerminal::OnDown(wxKeyEvent& event)
void wxTerminal::OnLeft(wxKeyEvent& event)
{
// Don't allow moving LEFT when at the begin of a line
if(m_textCtrl->GetColumn(m_textCtrl->GetCurrentPos()) == 0) {
return;
}
if(m_textCtrl->GetColumn(m_textCtrl->GetCurrentPos()) == 0) { return; }

// Right / Left movement is allowed only on the last line
int curline = m_textCtrl->GetCurrentLine();
if(curline == (m_textCtrl->GetLineCount() - 1)) {
event.Skip();
}
if(curline == (m_textCtrl->GetLineCount() - 1)) { event.Skip(); }
}

void wxTerminal::OnRight(wxKeyEvent& event)
{
// Right / Left movement is allowed only on the last line
int curline = m_textCtrl->GetCurrentLine();
if(curline == (m_textCtrl->GetLineCount() - 1)) {
event.Skip();
}
if(curline == (m_textCtrl->GetLineCount() - 1)) { event.Skip(); }
}

void wxTerminal::InsertCommandText(const wxString& command)
@@ -400,12 +386,8 @@ void wxTerminal::AddTextWithEOL(const wxString& text)
{
wxString textToAdd = text;
textToAdd.Trim().Trim(false);
if(textToAdd.IsEmpty()) {
return;
}
if(!textToAdd.EndsWith("\n")) {
textToAdd << "\n";
}
if(textToAdd.IsEmpty()) { return; }
if(!textToAdd.EndsWith("\n")) { textToAdd << "\n"; }
m_textCtrl->SetReadOnly(false);
m_textCtrl->AppendText(textToAdd);
m_textCtrl->GotoPos(m_textCtrl->GetLastPosition());
8 changes: 2 additions & 6 deletions Plugin/wxterminalbase.cpp
Original file line number Diff line number Diff line change
@@ -53,9 +53,7 @@ wxTerminalBase::wxTerminalBase(wxWindow* parent, wxWindowID id, const wxPoint& p
m_textCtrl->MarkerAdd(0, MARKER_ID);

LexerConf::Ptr_t lexer = ColoursAndFontsManager::Get().GetLexer("text");
if(lexer) {
lexer->Apply(m_textCtrl);
}
if(lexer) { lexer->Apply(m_textCtrl); }
mainSizer->Add(m_textCtrl, 1, wxEXPAND, 0);
this->SetSizer(mainSizer);
this->Layout();
@@ -65,9 +63,7 @@ wxTerminalBase::wxTerminalBase(wxWindow* parent, wxWindowID id, const wxPoint& p
m_textCtrl->Bind(wxEVT_KEY_DOWN, &wxTerminalBase::OnKey, this);
m_textCtrl->Bind(wxEVT_STC_CHARADDED, &wxTerminalBase::OnCharAdded, this);
m_textCtrl->Bind(wxEVT_LEFT_UP, [&](wxMouseEvent& event) {
if(m_textCtrl->GetSelectedText().IsEmpty()) {
this->CallAfter(&wxTerminalBase::CaretToEnd);
}
if(m_textCtrl->GetSelectedText().IsEmpty()) { this->CallAfter(&wxTerminalBase::CaretToEnd); }
event.Skip();
});
m_textCtrl->SetReadOnly(true);

0 comments on commit 376f2b7

Please sign in to comment.