Skip to content

Commit

Permalink
Adjusted calculation for ui_rem_width_scale and added setting ui_rem_…
Browse files Browse the repository at this point in the history
…width_scale_adjust_automatically to turn off automatic adjustments
  • Loading branch information
daveleroy committed Feb 9, 2022
1 parent e5499df commit 075e9b1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Commands/debugger (Linux).sublime-settings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ui_scale": 10,
"ui_rem_width_scale": 0.75,
"ui_rem_width_scale_adjust_automatically": true,
}
2 changes: 1 addition & 1 deletion Commands/debugger (Windows).sublime-settings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ui_scale": 11,
"ui_rem_width_scale": 0.75,
"ui_rem_width_scale_adjust_automatically": true,
}
11 changes: 7 additions & 4 deletions debugger.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
// Sets the entire scale of the UI
"ui_scale": 10,

// This value adjusts the estimated character width calculations used to align the ui
"ui_rem_width_scale": 1.0,
// If true ui_rem_width_scale will be adjusted based on if the debugger layout is over/under shooting the panel.
// Defaults to true on Windows/Linux
"ui_rem_width_scale_adjust_automatically": false,

// change at your own risk it may break the interface. Restart required to take effect
"font_face": "Monospace",

Expand All @@ -28,7 +34,7 @@
"command": "set_layout",
"args": {
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]],
"cols": [0, 0.5, 1],
"cols": [0, 0.666, 1],
"rows": [0, 1],
}
},
Expand Down Expand Up @@ -71,8 +77,5 @@
// probably shouldn't set these
"lldb_library": null, // which lldb library to use
"lldb_python": null, // path to python (3.5 or greater?) that lldb will use

// This value will automatically adjust itself
"ui_rem_width_scale": 1.0,
}

5 changes: 4 additions & 1 deletion modules/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ def dispose(self):
self.timer.dispose()

def adjust_rem_width_scale(self):
if not Settings.ui_rem_width_scale_adjust_automatically:
return

layout_width = self.view.layout_extent()[0]
viewport_width = self.view.viewport_extent()[0]

Expand All @@ -200,7 +203,7 @@ def adjust_rem_width_scale(self):
if overlap <= 0 and overlap >= -5:
return

adjustment = 0.005 * int(abs(overlap) / 10 + 1)
adjustment = 0.001 * int(abs(overlap) / 2 + 1)
value = Settings.ui_rem_width_scale
if overlap > 0:
print(f'overscan {overlap}: adjusting rem_width: {Settings.ui_rem_width_scale}')
Expand Down
2 changes: 2 additions & 0 deletions modules/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def __setattr__(self, key: str, value: Any) -> None:
class Settings(metaclass=SettingsMeta):
open_at_startup: bool = True
ui_scale: int = 10

ui_rem_width_scale: float = 1
ui_rem_width_scale_adjust_automatically: bool = False

font_face: str = 'Monospace'

Expand Down

0 comments on commit 075e9b1

Please sign in to comment.