From 76e2fdc82391ea93eea46148c9a664bd43f2a5b9 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sat, 24 Jun 2023 18:54:18 +0100 Subject: [PATCH] FormatBar: Show column number not buffer offset --- src/Widgets/FormatBar.vala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Widgets/FormatBar.vala b/src/Widgets/FormatBar.vala index 47cdbfee45..04c3ca0fb6 100644 --- a/src/Widgets/FormatBar.vala +++ b/src/Widgets/FormatBar.vala @@ -210,8 +210,8 @@ public class Code.FormatBar : Gtk.Box { buffer.get_iter_at_offset (out iter, position); var line = iter.get_line () + 1; - line_menubutton.text = "%d.%d".printf (line, iter.get_line_offset ()); - goto_entry.text = "%d.%d".printf (line, iter.get_line_offset ()); + line_menubutton.text = "%d.%d".printf (line, iter.get_line_offset () + 1); + goto_entry.text = "%d.%d".printf (line, iter.get_line_offset () + 1); } private void create_line_popover () { @@ -235,12 +235,12 @@ public class Code.FormatBar : Gtk.Box { // We need to connect_after because otherwise, the text isn't parsed into the "value" property and we only get the previous value goto_entry.activate.connect_after (() => { - int line, offset; + int line, column; goto_entry.text = goto_entry.text.replace (":", "."); - goto_entry.text.scanf ("%i.%i", out line, out offset); - doc.source_view.go_to_line (line, offset); + goto_entry.text.scanf ("%i.%i", out line, out column); + doc.source_view.go_to_line (line, column - 1); // Focuses parent to the source view, so that the cursor, which indicates line and column is actually visible. doc.source_view.grab_focus (); });