Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormatBar: Show column number not buffer offset #1342

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Widgets/FormatBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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 ();
});
Expand Down