Skip to content

feat: 添加实例列表右键编辑功能 (#6000)#6038

Open
NWMA-FYWF wants to merge 2 commits intoHMCL-dev:mainfrom
NWMA-FYWF:main
Open

feat: 添加实例列表右键编辑功能 (#6000)#6038
NWMA-FYWF wants to merge 2 commits intoHMCL-dev:mainfrom
NWMA-FYWF:main

Conversation

@NWMA-FYWF
Copy link
Copy Markdown

  • 实例列表项支持右键编辑
  • 编辑页面名称唯一性验证排除自身
  • 路径变化后不再自动修改名称

NWMA-FYWF added 2 commits May 2, 2026 10:39
 - 实例列表项支持右键编辑
 - 编辑页面名称唯一性验证排除自身
 - 路径变化后不再自动修改名称
@NWMA-FYWF
Copy link
Copy Markdown
Author

截图 2026-05-02 11-10-20

@NWMA-FYWF NWMA-FYWF changed the title feat: 添加实例列表右键编辑功能 (#6000) feat: 添加实例列表右键编辑功能 #6000 May 2, 2026
@NWMA-FYWF NWMA-FYWF changed the title feat: 添加实例列表右键编辑功能 #6000 feat: 添加实例列表右键编辑功能 (#6000) May 3, 2026
@NWMA-FYWF NWMA-FYWF closed this May 4, 2026
@NWMA-FYWF NWMA-FYWF reopened this May 4, 2026
Copy link
Copy Markdown
Member

@Glavo Glavo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本审查建议由 GPT-5 生成


已将具体审查建议标注在对应代码行。

txtProfileName.textProperty().removeListener(txtProfileNameChangeListener);

if (profile != null) {
profile.setName(txtProfileName.getText());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本审查建议由 GPT-5 生成


编辑现有实例时,名称输入框使用 Profiles.getProfileDisplayName(profile) 初始化,但保存时又把 txtProfileName.getText() 写回 profile.setName(...)。这会让 Default / Home 这类保留名称在非英文语言下被保存成翻译后的显示名。触发条件是右键编辑默认/主目录实例后直接保存,哪怕只改路径或相对路径开关。结果是配置 key 被改掉,内置实例失去保留名称身份。建议编辑框使用 profile.getName() 作为真实名称,显示名只用于列表/标题展示。

}

ChangeListener<String> locationChangeListener = (observable, oldValue, newValue) -> {
locationChangeListener = (observable, oldValue, newValue) -> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本审查建议由 GPT-5 生成


locationChangeListener 仍然在编辑模式注册。右键编辑现有实例后,如果用户先把实例目录改到某个 .../.minecraft 路径,监听器会把名称输入框自动改成父目录名,保存时就会静默重命名实例。这和 PR 描述里的“路径变化后不再自动修改名称”不一致。建议只在 profile == null 的新建流程中启用这个自动命名监听器,或进入编辑模式时直接禁用它。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants