@@ -55,9 +55,10 @@ export interface CSSObject {
55
55
56
56
const fontSize = 14 ;
57
57
const outputPadding = 10 ;
58
- const promptPadding = 5 ;
59
- const promptHeight = 12 + ( 2 * promptPadding ) ;
60
- const promptWrapperHeight = promptHeight + promptPadding ;
58
+ const promptVerticalPadding = 5 ;
59
+ const promptHorizontalPadding = 10 ;
60
+ const promptHeight = 12 + ( 2 * promptVerticalPadding ) ;
61
+ const promptWrapperHeight = promptHeight + promptVerticalPadding ;
61
62
const promptBackgroundColor = lighten ( colors . black , 5 ) ;
62
63
const suggestionSize = 2 * fontSize ;
63
64
const defaultShadow = "0 2px 8px 1px rgba(0, 0, 0, 0.3)" ;
@@ -95,7 +96,10 @@ const progressBarStripesSize = 30;
95
96
const arrowColor = lighten ( promptBackgroundColor , 10 ) ;
96
97
97
98
const promptInlineElement = {
98
- padding : "0 10px 3px 10px" , // FIXME: Use grid-column-gap when it's supported.
99
+ paddingTop : 0 ,
100
+ paddingRight : promptHorizontalPadding ,
101
+ paddingBottom : 3 ,
102
+ paddingLeft : promptHorizontalPadding ,
99
103
gridArea : "prompt" ,
100
104
fontSize : fontSize ,
101
105
WebkitFontFeatureSettings : '"liga", "dlig"' ,
@@ -185,14 +189,14 @@ export const debugTag = {
185
189
} ;
186
190
187
191
export const autocomplete = {
188
- box : ( caretOffset : Offset , hasDescription : boolean ) => {
189
- const shouldDisplayAbove = caretOffset . top + ( suggestionsLimit * suggestionSize ) > window . innerHeight ;
192
+ box : ( offsetTop : number , caretPosition : number , hasDescription : boolean ) => {
193
+ const shouldDisplayAbove = offsetTop + ( suggestionsLimit * suggestionSize ) > window . innerHeight ;
190
194
191
195
return {
192
196
position : "absolute" ,
193
197
top : shouldDisplayAbove ? "auto" : promptWrapperHeight ,
194
198
bottom : shouldDisplayAbove ? suggestionSize + ( hasDescription ? suggestionSize : 0 ) : "auto" ,
195
- left : caretOffset . left ,
199
+ left : decorationWidth + promptHorizontalPadding + ( caretPosition * letterWidth ) ,
196
200
minWidth : 300 ,
197
201
boxShadow : defaultShadow ,
198
202
backgroundColor : colors . black ,
@@ -501,7 +505,7 @@ export const promptInfo = (status: Status) => {
501
505
export const promptWrapper = ( status : Status ) => {
502
506
const styles : CSSObject = {
503
507
top : 0 ,
504
- paddingTop : promptPadding ,
508
+ paddingTop : promptVerticalPadding ,
505
509
position : "relative" , // To position the autocompletion box correctly.
506
510
display : "grid" ,
507
511
gridTemplateAreas : "'decoration prompt actions'" ,
@@ -523,7 +527,7 @@ export const arrow = (status: Status) => {
523
527
gridArea : "decoration" ,
524
528
position : "relative" ,
525
529
width : decorationWidth ,
526
- height : promptHeight - promptPadding ,
530
+ height : promptHeight - promptVerticalPadding ,
527
531
margin : "0 auto" ,
528
532
overflow : "hidden" ,
529
533
zIndex : arrowZIndex ,
0 commit comments