microsoft / microsoft/calculator

Programmer Mode should support setting the radix based on pasted values

Open
#58 11 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

approved Enhancement help wanted Pri: 2
Dominant language
C#
Stars
31.1k
Forks
5.8k
PR merge metrics
No merged PRs in 30d

Description

Problem Statement
Calculator currently supports pasting in prefixed/suffixed values in programmer mode if the value is considered valid for the current radix (hex/dec/bin/oct).

Evidence or User Insights
This is a small quality-of-life improvement when using programmer mode.

Proposal
Upon paste in programmer mode, if invalid input is detected, attempt to detect if the value is valid in a radix other than the current one, and if so, automatically switch to that radix and accept pasted value.

Prefixes

  • Pasted input with prefixes always automatically change to specified radix (e.g., "0b" = binary; "0x" = hex, etc.)

Suffixes

  • If pasted input is valid in currently selected radix, prefer to remain in selected radix (e.g., pasting "10b" while in hex results in remaining in hex with "10B").
  • If pasted input is invalid in currently selected radix and is valid in exactly one other radix, automatically change to specified radix (e.g., pasting "10F" in decimal is invalid and is only valid as hex input, so switch to hex).
  • If pasted input is invalid in currently selected radix and is valid in more than one other radix, do not change radix and display "Cannot determine radix" (e.g., pasting "10b" in decimal is invalid, but is valid input for both binary ('b' suffix) and hex ("10B" is valid hex).
  • If pasted input is invalid across radices, maintain current behavior and display "Invalid input".

Goals

  • Minimize instances we display "Invalid Input" by automatically switching radix when we can do so confidently.

Non-Goals

  • Add support for additional radix prefixes/suffixes.

Low-Fidelity Concept
N/A (use existing UI; just switch radix when appropriate)

Requested Assignment
I'm just suggesting this idea. I don't want to implement it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by locating the programmer-mode paste handling and reviewing how prefixes, suffixes, and invalid input are currently classified. Done means prefixed values select their radix, uniquely identifiable suffixes switch radix, ambiguous values show “Cannot determine radix,” and unrecognized values retain the existing “Invalid input” behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.