@@ -342,9 +342,11 @@ public void setFocused(@Nullable Element focused) {
342342 }
343343
344344 public void scrollToFocused () {
345- int index = indexedWidgets .indexOf (this .getFocused ());
346- int itemsOnScreen = this .height / this .itemHeight ;
347- this .setScrollAmount ((index - itemsOnScreen / 2.0 ) * this .itemHeight );
345+ if (this .getFocused () instanceof CommandWidget focusedWidget ) {
346+ int index = indexedWidgets .indexOf (focusedWidget );
347+ int itemsOnScreen = this .height / this .itemHeight ;
348+ this .setScrollAmount ((index - itemsOnScreen / 2.0 ) * this .itemHeight );
349+ }
348350 }
349351 }
350352
@@ -506,13 +508,13 @@ public void render(DrawContext context, int index, int y, int x, int entryWidth,
506508 if (this .isFocused ()) {
507509 CalciteCommandScreen .this .commandSuggestorRenderer = () -> {
508510 context .getMatrices ().push ();
509- context .getMatrices ().translate (0 , 0 , 1 );
511+ context .getMatrices ().translate (3 , 0 , 1 );
510512 ChatInputSuggestor .SuggestionWindow window = ((ChatInputSuggestorFields ) this .commandSuggestor ).getWindow ();
511513 if (window != null ) {
512514 ((SuggestionWindowFields ) window ).getArea ().setY (calculateSuggestionY (y ));
513515 }
514516 if (!this .commandSuggestor .tryRenderWindow (context , mouseX , mouseY )) {
515- context .getMatrices ().translate (0 , calculateMessageY (y ), 0 );
517+ context .getMatrices ().translate (- 3 , calculateMessageY (y ), 0 );
516518 this .commandSuggestor .renderMessages (context );
517519 }
518520 context .getMatrices ().pop ();
0 commit comments