[Github-comments] [geany/geany] Show zoom level in status bar. (#1697)
Colomban Wendling
notifications at xxxxx
Fri Oct 4 11:59:22 UTC 2019
I suggest something like this
```diff
diff --git a/src/sciwrappers.c b/src/sciwrappers.c
index 647c44454..5dc59b93e 100644
--- a/src/sciwrappers.c
+++ b/src/sciwrappers.c
@@ -968,9 +968,9 @@ void sci_set_font(ScintillaObject *sci, gint style, const gchar *font, gint size
}
-gint sci_get_fontsize(ScintillaObject *sci, gint style)
+gdouble sci_get_font_size(ScintillaObject *sci, gint style)
{
- return (gint) SSM(sci, SCI_STYLEGETSIZE, (uptr_t) style, 0);
+ return SSM(sci, SCI_STYLEGETSIZEFRACTIONAL, (uptr_t) style, 0) / (gdouble) SC_FONT_SIZE_MULTIPLIER;
}
diff --git a/src/sciwrappers.h b/src/sciwrappers.h
index fca3efa65..fa2a88a29 100644
--- a/src/sciwrappers.h
+++ b/src/sciwrappers.h
@@ -219,7 +219,7 @@ void sci_move_selected_lines_up (ScintillaObject *sci);
void sci_set_font_fractional (ScintillaObject *sci, gint style, const gchar *font, gdouble size);
-gint sci_get_fontsize (ScintillaObject *sci, gint style);
+gdouble sci_get_font_size (ScintillaObject *sci, gint style);
#endif /* GEANY_PRIVATE */
diff --git a/src/ui_utils.c b/src/ui_utils.c
index 644259bec..5f3ad4abf 100644
--- a/src/ui_utils.c
+++ b/src/ui_utils.c
@@ -309,13 +309,13 @@ static gchar *create_statusbar_statistics(GeanyDocument *doc,
zoom = sci_get_zoom(doc->editor->sci);
if (zoom != 0)
{
- gint size, percent;
+ gdouble size, percent;
- size = sci_get_fontsize(doc->editor->sci, STYLE_DEFAULT);
- if (size > 0)
+ size = sci_get_font_size(doc->editor->sci, STYLE_DEFAULT);
+ if (size > 0.0)
{
percent = (size + zoom) * 100 / size;
- g_string_append_printf(stats_str, _("Zoom: %d%%"), percent);
+ g_string_append_printf(stats_str, _("Zoom: %.0f%%"), percent);
g_string_append(stats_str, sp);
}
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1697#issuecomment-538367582
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20191004/d3de6782/attachment.html>
More information about the Github-comments
mailing list