Skip to content

Restrict AI context menu to Ctrl + selection + right-click - #4

Open
Cinnavun wants to merge 5 commits into
pingqLIN:mainfrom
Cinnavun:main
Open

Restrict AI context menu to Ctrl + selection + right-click#4
Cinnavun wants to merge 5 commits into
pingqLIN:mainfrom
Cinnavun:main

Conversation

@Cinnavun

Copy link
Copy Markdown

addresses #2
Problem: On text selection, the plugin's popup menu replaces Notepad++'s default right-click context menu entirely, rather than appending to it.

Change: The AI plugin context menu now only appears when ctrlPressed + hasSelection — i.e., Ctrl + right-click with an active selection. Right-click otherwise retains the standard Notepad++ menu.

Alternative: Since the AI context commands mirror the Plugin Menu commands, users can add the following lines to contextMenu.xml (%APPDATA%\Notepad++\contextMenu.xml) to append safely and access them without holding ctrl.

		<Item FolderName="Plugin commands" TranslateID="contextMenu-PluginCommands" PluginEntryName="NppAIAssistant" PluginCommandItemName="Explain Selection" />
		<Item FolderName="Plugin commands" TranslateID="contextMenu-PluginCommands" PluginEntryName="NppAIAssistant" PluginCommandItemName="Fix Selection" />
		<Item FolderName="Plugin commands" TranslateID="contextMenu-PluginCommands" PluginEntryName="NppAIAssistant" PluginCommandItemName="Refactor Selection" />
		<Item FolderName="Plugin commands" TranslateID="contextMenu-PluginCommands" PluginEntryName="NppAIAssistant" PluginCommandItemName="Add Comments to Selection" />

Built x64 | Release and tested on Windows - confirmed all the above working

… + right-click

Signed-off-by: Cinnavun <llshadowz@gmail.com>
…for base url and optional api key

Signed-off-by: Cinnavun <llshadowz@gmail.com>
Signed-off-by: Cinnavun <llshadowz@gmail.com>
@pingqLIN

pingqLIN commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Thank you for this contribution, and apologies for the delayed response. I'm still learning software development and GitHub's collaboration norms, so I've been taking time to understand the code paths and validate the changes carefully. I appreciate your patience.

The Ctrl + selection + right-click behavior directly addresses issue #2 and is a strong usability direction, since it preserves the normal Notepad++ context menu. Since this PR was opened, the repository has also gained:

  • A provider-neutral OpenAI-compatible / LM Studio layer
  • Endpoint validation
  • Non-streaming response handling
  • Structured JSON validation

This PR touches those same overlapping provider, timeout, and settings paths, so I can't merge it as-is — I need to reconcile it against the newer boundaries first.

I'm treating the context-menu behavior as a focused integration candidate and will keep the issue open until it's verified in an updated build. The current update also improves prompt governance, default-locked built-in prompt sections, and Traditional Chinese panel layout.

Feel free to test the PR's interaction flow and share what you observe, especially:

Normal right-click, with and without a selection
Ctrl + right-click with a selection
Access through the Notepad++ plugin menu

Project: https://github.com/pingqLIN/NppAIAssistant
Related issue: #2

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