Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-78963

Command completion fails with multiple possibilities and other arguments set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 18w30b
    • Minecraft 1.8.3, Minecraft 15w37a, Minecraft 15w51b, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.2, Minecraft 16w15b, Minecraft 16w35a, Minecraft 1.11, Minecraft 1.12.2
    • Confirmed

      It seems like this affects every command. If you enter arguments behind the tab completion and then press TAB, it fails when there are multiple possibilities

      When you enter the beginning of a particle name, have the other values set and press TAB, it will only complete the name, if there is only one particle name with this start. I expected rather that it would cycle trough all the names like the game does for every other command.

      How to reproduce:
      Enter the code and press TAB ([CURSOR] shows the position where the mouse cursor should be)

      /particle command completion works
      /particle snows[CURSOR] ~ ~ ~ 1 1 1 10
      
      /particle command completion fails
      /particle snow[CURSOR] ~ ~ ~ 1 1 1 10
      

      The reason

      The reason for this seems to be that the onAutocompleteResponse(String[] p_146406_1_) method of the net.minecraft.client.gui.GuiChat class (MCP 1.8 names) does not remove anything after the next space when trying to complete. This means that the prefixes are identically but because one has the rest of the command behind it, the command pieces are treated as if the were not identically. This causes the common prefix "snow" to be replaced again with "snow".

      public void onAutocompleteResponse(String[] p_146406_1_)
      {
      	if (this.waitingOnAutocomplete)
      	{
      		//...
      		
      		//Changed this 
      		//String var6 = this.inputField.getText().substring(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false));
      		String stringToComplete = this.inputField.getText().substring(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false));
      		int nextSpace = stringToComplete.indexOf(" ");
      		if (nextSpace == -1) nextSpace = stringToComplete.length();
      		String var6 = stringToComplete.substring(0, nextSpace);
      		
      		//...
      	}
      }
      

            Unassigned Unassigned
            marcono1234 [Mod] Marcono1234
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: