File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed
Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change 1919
2020 max-height : 20em ;
2121 overflow-y : auto;
22+ box-sizing : border-box;
2223}
2324
2425.CodeMirror-hint {
Original file line number Diff line number Diff line change 286286 setTimeout ( function ( ) { startScroll = cm . getScrollInfo ( ) ; } ) ;
287287
288288 var overlapY = box . bottom - winH ;
289- if ( overlapY > 0 ) {
290- var height = box . bottom - box . top , curTop = pos . top - ( pos . bottom - box . top ) ;
291- if ( curTop - height > 0 ) { // Fits above cursor
292- hints . style . top = ( top = pos . top - height - offsetTop ) + "px" ;
289+ if ( overlapY > 0 ) { // Does not fit below
290+ var height = box . bottom - box . top , spaceAbove = box . top - ( pos . bottom - pos . top ) - 2
291+ if ( winH - box . top < spaceAbove ) { // More room at the top
292+ if ( height > spaceAbove ) hints . style . height = ( height = spaceAbove ) + "px" ;
293+ hints . style . top = ( ( top = pos . top - height ) + offsetTop ) + "px" ;
293294 below = false ;
294- } else if ( height > winH ) {
295- hints . style . height = ( winH - 5 ) + "px" ;
296- hints . style . top = ( top = pos . bottom - box . top - offsetTop ) + "px" ;
297- var cursor = cm . getCursor ( ) ;
298- if ( data . from . ch != cursor . ch ) {
299- pos = cm . cursorCoords ( cursor ) ;
300- hints . style . left = ( left = pos . left - offsetLeft ) + "px" ;
301- box = hints . getBoundingClientRect ( ) ;
302- }
295+ } else {
296+ hints . style . height = ( winH - box . top - 2 ) + "px" ;
303297 }
304298 }
305299 var overlapX = box . right - winW ;
You can’t perform that action at this time.
0 commit comments