Leave the current line selected after splitting at cursor rather than selecting the new line

Originally committed to SVN as r6745.
This commit is contained in:
Thomas Goyne 2012-05-03 03:14:11 +00:00
parent 4603a86953
commit 4d7c6b08e0
1 changed files with 4 additions and 4 deletions

View File

@ -852,9 +852,9 @@ void SubsTextEditCtrl::SplitLine(bool estimateTimes) {
GetSelection(&from, &to); GetSelection(&from, &to);
from = GetReverseUnicodePosition(from); from = GetReverseUnicodePosition(from);
AssDialogue *n2 = context->selectionController->GetActiveLine(); AssDialogue *n1 = context->selectionController->GetActiveLine();
AssDialogue *n1 = new AssDialogue(*n2); AssDialogue *n2 = new AssDialogue(*n1);
context->ass->Line.insert(find(context->ass->Line.begin(), context->ass->Line.end(), n2), n1); context->ass->Line.insert(++find(context->ass->Line.begin(), context->ass->Line.end(), n1), n2);
wxString orig = n1->Text; wxString orig = n1->Text;
n1->Text = orig.Left(from).Trim(true); // Trim off trailing whitespace n1->Text = orig.Left(from).Trim(true); // Trim off trailing whitespace
@ -865,7 +865,7 @@ void SubsTextEditCtrl::SplitLine(bool estimateTimes) {
n2->Start = n1->End = (int)((n1->End - n1->Start) * splitPos) + n1->Start; n2->Start = n1->End = (int)((n1->End - n1->Start) * splitPos) + n1->Start;
} }
context->ass->Commit(_("split"), AssFile::COMMIT_DIAG_ADDREM | AssFile::COMMIT_DIAG_FULL); context->ass->Commit(_("split"), AssFile::COMMIT_DIAG_ADDREM | (estimateTimes ? AssFile::COMMIT_DIAG_FULL : AssFile::COMMIT_DIAG_TEXT));
} }
void SubsTextEditCtrl::OnAddToDictionary(wxCommandEvent &) { void SubsTextEditCtrl::OnAddToDictionary(wxCommandEvent &) {