Skip to content

Commit be653c8

Browse files
committed
fix(ui): prevent math precision inconsistencies
1 parent a9da56d commit be653c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/activate/registerCommands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
236236
increaseFontSize: async () => {
237237
const config = vscode.workspace.getConfiguration(Package.name)
238238
const currentMultiplier = config.get<number>("fontSizeMultiplier") || 1.0
239-
const newMultiplier = Math.min(currentMultiplier + 0.1, 3.0)
239+
const newMultiplier = Math.min(Math.round((currentMultiplier + 0.1) * 10) / 10, 3.0)
240240

241241
await config.update("fontSizeMultiplier", newMultiplier, vscode.ConfigurationTarget.Global)
242242

@@ -252,7 +252,7 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
252252
decreaseFontSize: async () => {
253253
const config = vscode.workspace.getConfiguration(Package.name)
254254
const currentMultiplier = config.get<number>("fontSizeMultiplier") || 1.0
255-
const newMultiplier = Math.max(currentMultiplier - 0.1, 0.5)
255+
const newMultiplier = Math.min(Math.round((currentMultiplier - 0.1) * 10) / 10, 3.0)
256256

257257
await config.update("fontSizeMultiplier", newMultiplier, vscode.ConfigurationTarget.Global)
258258

0 commit comments

Comments
 (0)