Skip to content

Commit

Permalink
Fix: Don't add "SetSelection" before SelectXXX
Browse files Browse the repository at this point in the history
  • Loading branch information
gli-spirent committed Apr 8, 2019
1 parent c710e48 commit 6bca6ef
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 34 deletions.
8 changes: 5 additions & 3 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
10.Fix: Mouse event issue in handling file changed externally
11.Fix: Rollback the change of active line marker width #276
12.Update wxWidgets to 3.1.2
13.Update python to 2.7.16
14.Update Greek translation(https://github.com/nikoss)
15.Update Chinese translations(ZhTw2013)
13.Fix: Don't add "SetSelection" before SelectXXX
14.Update wxWidgets to 3.1.2
15.Update python to 2.7.16
16.Update Greek translation(https://github.com/nikoss)
17.Update Chinese translations(ZhTw2013))

2018-11-29 Minggang Li <minggang.li@gmail.com>
1.New: Use input file ext as SaveAs file type filter
Expand Down
9 changes: 5 additions & 4 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Mod v0.4.16
10.Fix: Mouse event issue in handling file changed externally
11.Fix: Rollback the change of active line marker width #276
12.Fix: MadPython script recording bug(SelectAll, Cut)
13.Update wxWidgets to 3.1.2
14.Update python to 2.7.16
15.Update Greek translation(https://github.com/nikoss)
16.Update Chinese translations(ZhTw2013)
13.Fix: Don't add "SetSelection" before SelectXXX
14.Update wxWidgets to 3.1.2
15.Update python to 2.7.16
16.Update Greek translation(https://github.com/nikoss)
17.Update Chinese translations(ZhTw2013)
9 changes: 5 additions & 4 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ Mod v0.4.16
10.Fix: Mouse event issue in handling file changed externally
11.Fix: Rollback the change of active line marker width #276
12.Fix: MadPython script recording bug(SelectAll, Cut)
13.Update wxWidgets to 3.1.2
14.Update python to 2.7.16
15.Update Greek translation(https://github.com/nikoss)
16.Update Chinese translations(ZhTw2013)
13.Fix: Don't add "SetSelection" before SelectXXX
14.Update wxWidgets to 3.1.2
15.Update python to 2.7.16
16.Update Greek translation(https://github.com/nikoss)
17.Update Chinese translations(ZhTw2013)

Mod v0.4.15
1.New: Use input file ext as SaveAs file type filter
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Mod v0.4.16
* Fix: Mouse event issue in handling file changed externally
* Fix: Rollback the change of active line marker width #276
* Fix: MadPython script recording bug(SelectAll, Cut)
* Fix: Don't add "SetSelection" before SelectXXX
* Update wxWidgets to 3.1.2
* Update python to 2.7.16
* Update Greek translation(https://github.com/nikoss)
Expand Down
9 changes: 5 additions & 4 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ Mod v0.4.16
10.Fix: Mouse event issue in handling file changed externally
11.Fix: Rollback the change of active line marker width #276
12.Fix: MadPython script recording bug(SelectAll, Cut)
13.Update wxWidgets to 3.1.2
14.Update python to 2.7.16
15.Update Greek translation(https://github.com/nikoss)
16.Update Chinese translations(ZhTw2013)
13.Fix: Don't add "SetSelection" before SelectXXX
14.Update wxWidgets to 3.1.2
15.Update python to 2.7.16
16.Update Greek translation(https://github.com/nikoss)
17.Update Chinese translations(ZhTw2013)

Mod v0.4.15
1.New: Use input file ext as SaveAs file type filter
Expand Down
9 changes: 5 additions & 4 deletions packaging/debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ madedit-mod (0.4.16-1) stable; urgency=low
10.Fix: Mouse event issue in handling file changed externally
11.Fix: Rollback the change of active line marker width #276
12.Fix: MadPython script recording bug(SelectAll, Cut)
13.Update wxWidgets to 3.1.2
14.Update python to 2.7.16
15.Update Greek translation(https://github.com/nikoss)
16.Update Chinese translations(ZhTw2013)
13.Fix: Don't add "SetSelection" before SelectXXX
14.Update wxWidgets to 3.1.2
15.Update python to 2.7.16
16.Update Greek translation(https://github.com/nikoss)
17.Update Chinese translations(ZhTw2013)

-- Minggang Li <liminggang@gmail.com> Mon, 8 Apr 2019 17:07:40 +0800

Expand Down
12 changes: 12 additions & 0 deletions src/MadEditFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10582,6 +10582,18 @@ bool MadEditFrame::RestoreAuiPanel(wxWindow * toolbar, wxString& toolbar_status,
return m_AuiManager.AddPane( toolbar, pane_info );
}

void MadEditFrame::AddMacroScript( const wxString & script, /*wxFileOffset caretPos = 0,*/ wxFileOffset selBeg/* = -1*/, wxFileOffset selEnd/* = -1*/ ) {
if( ( ( selBeg != -1 ) && ( selEnd != -1 ) ) && ( selBeg != m_LastSelBeg || selEnd != m_LastSelEnd ) ) {
m_LastSelBeg = selBeg;
m_LastSelEnd = selEnd;
wxString strPrefix = script.Left(6);
if( strPrefix != wxT( "Select" ) )
m_MadMacroScripts.Add( wxString::Format( wxT( "SetSelection(%s, %s, True)" ), ( wxLongLong( m_LastSelBeg ).ToString() ).c_str(), ( wxLongLong( m_LastSelEnd ).ToString() ).c_str() ) );
}

m_MadMacroScripts.Add( script );
}

MadTreeCtrl::MadTreeCtrl( wxWindow *parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style )
Expand Down
10 changes: 1 addition & 9 deletions src/MadEditFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -856,15 +856,7 @@ class MadEditFrame : public wxFrame
void SetMacroRunning() {m_MadMacroStatus = emMacroRunning;}
void SetMacroRecording() {m_MadMacroStatus = emMacroRecoding;}
void SetMacroStopped() {m_MadMacroStatus = emMacroStopped;}
void AddMacroScript( const wxString & script, /*wxFileOffset caretPos = 0,*/ wxFileOffset selBeg = -1, wxFileOffset selEnd = -1 ) {
if( ( ( selBeg != -1 ) && ( selEnd != -1 ) ) && ( selBeg != m_LastSelBeg || selEnd != m_LastSelEnd ) ) {
m_LastSelBeg = selBeg;
m_LastSelEnd = selEnd;
m_MadMacroScripts.Add( wxString::Format( wxT( "SetSelection(%s, %s, True)" ), ( wxLongLong( m_LastSelBeg ).ToString() ).c_str(), ( wxLongLong( m_LastSelEnd ).ToString() ).c_str() ) );
}

m_MadMacroScripts.Add( script );
}
void AddMacroScript(const wxString & script, /*wxFileOffset caretPos = 0,*/ wxFileOffset selBeg = -1, wxFileOffset selEnd = -1);
bool HasRecordedScript() {return ( m_MadMacroScripts.GetCount() > 0 );}
wxArrayString& GetRecordedScripts() {return m_MadMacroScripts;}

Expand Down
7 changes: 1 addition & 6 deletions src/MadPython.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1404,12 +1404,7 @@ namespace mad_python {
if(madedit == nullptr)
madedit = g_ActiveMadEdit;
if( madedit )
{
long fsize = ( long )g_ActiveMadEdit->GetFileSize();
if( endpos == fsize )
endpos = -1;
madedit->SetSelection( ( wxFileOffset )beginpos, ( wxFileOffset )endpos, bCaretAtBeginPos );
}
{ madedit->SetSelection( ( wxFileOffset )beginpos, ( wxFileOffset )endpos, bCaretAtBeginPos ); }
}

void SelectWholeLine() {
Expand Down

0 comments on commit 6bca6ef

Please sign in to comment.