diff --git a/aegisub/subs_edit_ctrl.cpp b/aegisub/subs_edit_ctrl.cpp index e4c49ef81..f6c82225a 100644 --- a/aegisub/subs_edit_ctrl.cpp +++ b/aegisub/subs_edit_ctrl.cpp @@ -946,7 +946,9 @@ void SubsTextEditCtrl::OnSplitLinePreserve (wxCommandEvent &event) { GetSelection(&from, &to); from = GetReverseUnicodePosition(from); to = GetReverseUnicodePosition(to); - control->grid->SplitLine(control->linen,from,0); + // Call SplitLine() with the text currently in the editbox. + // This makes sure we split what the user sees, not the committed line. + control->grid->SplitLine(control->linen,from,0,GetText()); } @@ -957,7 +959,9 @@ void SubsTextEditCtrl::OnSplitLineEstimate (wxCommandEvent &event) { GetSelection(&from, &to); from = GetReverseUnicodePosition(from); to = GetReverseUnicodePosition(to); - control->grid->SplitLine(control->linen,from,1); + // Call SplitLine() with the text currently in the editbox. + // This makes sure we split what the user sees, not the committed line. + control->grid->SplitLine(control->linen,from,1,GetText()); } diff --git a/aegisub/subs_grid.cpp b/aegisub/subs_grid.cpp index 2e8d7f62d..e20ea6e1b 100644 --- a/aegisub/subs_grid.cpp +++ b/aegisub/subs_grid.cpp @@ -1251,11 +1251,20 @@ void SubtitlesGrid::ShiftLineByFrames(int n,int len,int type) { ////////////// // Split line -void SubtitlesGrid::SplitLine(int n,int pos,int mode) { +void SubtitlesGrid::SplitLine(int n,int pos,int mode,wxString textIn) { // Split AssDialogue *n1,*n2; - n1 = GetDialogue(n); - n2 = new AssDialogue(n1->GetEntryData()); + // No textIn? Get saved text + if (textIn.IsEmpty()) { + n1 = GetDialogue(n); + n2 = new AssDialogue(n1->GetEntryData()); + } + // Otherwise use textIn + else { + n1 = GetDialogue(n); + n1->Text = textIn; + n2 = new AssDialogue(n1->GetEntryData()); + } InsertLine(n2,n,true,false); // Modify text diff --git a/aegisub/subs_grid.h b/aegisub/subs_grid.h index 24ff1ce2a..be25942a1 100644 --- a/aegisub/subs_grid.h +++ b/aegisub/subs_grid.h @@ -115,7 +115,7 @@ public: void JoinLines(int first,int last,bool concat=true); void JoinAsKaraoke(int first,int last); void AdjoinLines(int first,int last,bool setStart); - void SplitLine(int lineNumber,int splitPosition,int mode); + void SplitLine(int lineNumber,int splitPosition,int mode,wxString splitText = _T("")); void SplitLineByKaraoke(int lineNumber); void DuplicateLines(int first,int last,bool nextFrame=false);