File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -296,7 +296,13 @@ export class Editor extends React.Component {
296296 let caretEle = model . editorMirror . getElementsByClassName ( "editor_caret" ) [ 0 ] ;
297297 if ( caretEle ) {
298298 const rect = caretEle . getBoundingClientRect ( ) ;
299- model . setSuggestionPosition ( rect . top + rect . height , rect . left ) ;
299+ const textareaRect = model . editor . getBoundingClientRect ( ) ;
300+ let suggestionLeft = rect . left ;
301+ // If caret's right edge is too close to the left of textarea, position suggestion to the left of caret
302+ if ( rect . left + 200 > textareaRect . right ) {
303+ suggestionLeft = textareaRect . right - 200 ;
304+ }
305+ model . setSuggestionPosition ( rect . top + rect . height , suggestionLeft ) ;
300306 } else {
301307 model . displaySuggestion = false ;
302308 }
You can’t perform that action at this time.
0 commit comments