File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -133,20 +133,26 @@ void Editor::BackToPreviousInput(Context* ctx) {
133
133
ctx->PopInput ();
134
134
}
135
135
136
- void Editor::BackToPreviousSyllable (Context* ctx) {
136
+ static bool pop_input_by_syllable (Context* ctx) {
137
137
size_t caret_pos = ctx->caret_pos ();
138
138
if (caret_pos == 0 )
139
- return ;
139
+ return false ;
140
140
if (auto cand = ctx->GetSelectedCandidate ()) {
141
141
if (auto phrase = As<Phrase>(Candidate::GetGenuineCandidate (cand))) {
142
142
size_t stop = phrase->spans ().PreviousStop (caret_pos);
143
143
if (stop != caret_pos) {
144
144
ctx->PopInput (caret_pos - stop);
145
- return ;
145
+ return true ;
146
146
}
147
147
}
148
148
}
149
- ctx->PopInput ();
149
+ return false ;
150
+ }
151
+
152
+ void Editor::BackToPreviousSyllable (Context* ctx) {
153
+ ctx->ReopenPreviousSelection () ||
154
+ ((pop_input_by_syllable (ctx) || ctx->PopInput ()) &&
155
+ ctx->ReopenPreviousSegment ());
150
156
}
151
157
152
158
void Editor::DeleteCandidate (Context* ctx) {
You can’t perform that action at this time.
0 commit comments