[geany/geany] 3ce25d: Remove line number zoom hack as it is no longer necessary
Colomban Wendling
git-noreply at xxxxx
Fri Jun 27 20:23:48 UTC 2014
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Fri, 27 Jun 2014 20:23:48 UTC
Commit: 3ce25db632e7142159fc86081f36afefe9f317ce
https://github.com/geany/geany/commit/3ce25db632e7142159fc86081f36afefe9f317ce
Log Message:
-----------
Remove line number zoom hack as it is no longer necessary
Since cbf9813632d7ee921ffa1fda0d1f69128b2bc755 we have a proper
solution for maintaining line number consistent with the editor zoom,
so drop the old hack.
This also allows to remove the now useless third argument of
sci_set_line_numbers().
Modified Paths:
--------------
src/callbacks.c
src/document.c
src/editor.c
src/printing.c
src/sciwrappers.c
src/sciwrappers.h
src/ui_utils.c
Modified: src/callbacks.c
7 lines changed, 0 insertions(+), 7 deletions(-)
===================================================================
@@ -500,13 +500,9 @@ G_MODULE_EXPORT void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer u
G_MODULE_EXPORT void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- static gint done = 1;
g_return_if_fail(doc != NULL);
- if (done++ % 3 == 0)
- sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin,
- (sci_get_zoom(doc->editor->sci) / 2));
sci_zoom_in(doc->editor->sci);
}
@@ -518,8 +514,6 @@ G_MODULE_EXPORT void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_
g_return_if_fail(doc != NULL);
- if (sci_get_zoom(doc->editor->sci) == 0)
- sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
sci_zoom_out(doc->editor->sci);
}
@@ -531,7 +525,6 @@ G_MODULE_EXPORT void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer us
g_return_if_fail(doc != NULL);
sci_zoom_off(doc->editor->sci);
- sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
}
Modified: src/document.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -791,7 +791,7 @@ GeanyDocument *document_new_file(const gchar *utf8_filename, GeanyFiletype *ft,
document_set_text_changed(doc, FALSE);
ui_document_show_hide(doc); /* update the document menu */
- sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin);
/* bring it in front, jump to the start and grab the focus */
editor_goto_pos(doc->editor, 0, FALSE);
document_try_focus(doc, NULL);
@@ -1247,7 +1247,7 @@ GeanyDocument *document_open_file_full(GeanyDocument *doc, const gchar *filename
/* update line number margin width */
doc->priv->line_count = sci_get_line_count(doc->editor->sci);
- sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin);
if (! reload)
{
Modified: src/editor.c
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -934,7 +934,7 @@ static void auto_update_margin_width(GeanyEditor *editor)
if (editor->document->priv->line_count != next_linecount)
{
doc->priv->line_count = next_linecount;
- sci_set_line_numbers(editor->sci, TRUE, 0);
+ sci_set_line_numbers(editor->sci, TRUE);
}
}
@@ -1127,7 +1127,7 @@ static gboolean on_editor_notify(G_GNUC_UNUSED GObject *object, GeanyEditor *edi
case SCN_ZOOM:
/* recalculate line margin width */
- sci_set_line_numbers(sci, editor_prefs.show_linenumber_margin, 0);
+ sci_set_line_numbers(sci, editor_prefs.show_linenumber_margin);
break;
}
/* we always return FALSE here to let plugins handle the event too */
@@ -5014,7 +5014,7 @@ void editor_apply_update_prefs(GeanyEditor *editor)
sci_set_visible_white_spaces(sci, editor_prefs.show_white_space);
sci_set_visible_eols(sci, editor_prefs.show_line_endings);
sci_set_symbol_margin(sci, editor_prefs.show_markers_margin);
- sci_set_line_numbers(sci, editor_prefs.show_linenumber_margin, 0);
+ sci_set_line_numbers(sci, editor_prefs.show_linenumber_margin);
sci_set_folding_margin_visible(sci, editor_prefs.folding);
Modified: src/printing.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -354,7 +354,7 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context,
scintilla_send_message(dinfo->sci, SCI_SETDOCPOINTER, 0,
scintilla_send_message(dinfo->doc->editor->sci, SCI_GETDOCPOINTER, 0, 0));
highlighting_set_styles(dinfo->sci, dinfo->doc->file_type);
- sci_set_line_numbers(dinfo->sci, printing_prefs.print_line_numbers, 0);
+ sci_set_line_numbers(dinfo->sci, printing_prefs.print_line_numbers);
scintilla_send_message(dinfo->sci, SCI_SETVIEWWS, SCWS_INVISIBLE, 0);
scintilla_send_message(dinfo->sci, SCI_SETVIEWEOL, FALSE, 0);
scintilla_send_message(dinfo->sci, SCI_SETEDGEMODE, EDGE_NONE, 0);
Modified: src/sciwrappers.c
7 lines changed, 1 insertions(+), 6 deletions(-)
===================================================================
@@ -45,7 +45,7 @@
#define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
/* line numbers visibility */
-void sci_set_line_numbers(ScintillaObject *sci, gboolean set, gint extra_width)
+void sci_set_line_numbers(ScintillaObject *sci, gboolean set)
{
if (set)
{
@@ -55,11 +55,6 @@ void sci_set_line_numbers(ScintillaObject *sci, gboolean set, gint extra_width)
g_snprintf(tmp_str, 15, "_%d", len);
width = sci_text_width(sci, STYLE_LINENUMBER, tmp_str);
- if (extra_width)
- {
- g_snprintf(tmp_str, 15, "%d", extra_width);
- width += sci_text_width(sci, STYLE_LINENUMBER, tmp_str);
- }
SSM(sci, SCI_SETMARGINWIDTHN, 0, width);
SSM(sci, SCI_SETMARGINSENSITIVEN, 0, FALSE); /* use default behaviour */
}
Modified: src/sciwrappers.h
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -31,7 +31,7 @@ G_BEGIN_DECLS
gchar* sci_get_string (ScintillaObject *sci, guint msg, gulong wParam);
-void sci_set_line_numbers (ScintillaObject *sci, gboolean set, gint extra_width);
+void sci_set_line_numbers (ScintillaObject *sci, gboolean set);
void sci_set_mark_long_lines (ScintillaObject *sci, gint type, gint column, const gchar *color);
void sci_set_text (ScintillaObject *sci, const gchar *text);
Modified: src/ui_utils.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -1282,7 +1282,7 @@ void ui_toggle_editor_features(GeanyUIEditorFeatures feature)
sci_set_symbol_margin(doc->editor->sci, editor_prefs.show_markers_margin);
break;
case GEANY_EDITOR_SHOW_LINE_NUMBERS:
- sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin);
break;
case GEANY_EDITOR_SHOW_WHITE_SPACE:
sci_set_visible_white_spaces(doc->editor->sci, editor_prefs.show_white_space);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list