@@ -56,7 +56,7 @@ export default class ModalDiffModal extends Component {
56
56
this .messageBus .subscribe (channel, this .updateResult );
57
57
}
58
58
59
- compareText (oldText = " " , newText = " " ) {
59
+ compareText (oldText = " " , newText = " " , opts = {} ) {
60
60
const oldWords = oldText .trim ().split (/ \s + / );
61
61
const newWords = newText .trim ().split (/ \s + / );
62
62
@@ -76,7 +76,7 @@ export default class ModalDiffModal extends Component {
76
76
wordHTML = newWord;
77
77
}
78
78
79
- if (i === newWords .length - 1 ) {
79
+ if (i === newWords .length - 1 && opts . markLastWord ) {
80
80
wordHTML = ` <mark class="highlight">${ wordHTML} </mark>` ;
81
81
}
82
82
@@ -103,24 +103,28 @@ export default class ModalDiffModal extends Component {
103
103
}
104
104
105
105
if (result .done ) {
106
- this .finalDiff = result .diff ;
106
+ // this.finalDiff = result.diff;
107
107
}
108
108
109
109
this .lastResultText = newText;
110
-
111
110
this .isStreaming = ! result .done ;
112
111
}
113
112
114
113
streamNextWord () {
115
114
if (this .currentWordIndex === this .words .length ) {
116
- this .diff = this .finalDiff ;
115
+ this .diff = this .compareText (
116
+ this .args .model .selectedText ,
117
+ this .suggestion ,
118
+ { markLastWord: false }
119
+ );
117
120
}
118
121
119
122
if (this .currentWordIndex < this .words .length ) {
120
123
this .suggestion += this .words [this .currentWordIndex ] + " " ;
121
124
this .diff = this .compareText (
122
125
this .args .model .selectedText ,
123
- this .suggestion
126
+ this .suggestion ,
127
+ { markLastWord: true }
124
128
);
125
129
126
130
this .currentWordIndex ++ ;
@@ -153,8 +157,6 @@ export default class ModalDiffModal extends Component {
153
157
});
154
158
} catch (e) {
155
159
popupAjaxError (e);
156
- } finally {
157
- this .loading = false ;
158
160
}
159
161
}
160
162
@@ -189,7 +191,8 @@ export default class ModalDiffModal extends Component {
189
191
" streamable-content"
190
192
}}
191
193
>
192
- <CookText @ rawText ={{this .diff }} class =" cooked" />
194
+ {{!-- <CookText @rawText={{this.diff}} class="cooked" /> --}}
195
+ {{htmlSafe this . diff}}
193
196
{{!-- <div class="composer-ai-helper-modal__old-value">
194
197
{{@model.selectedText}}
195
198
{{!-- {{#if this.smoothStreamer.isStreaming}}
0 commit comments