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

Fix "go to line" behaviour when column number is not explicitly set #1446

Merged
merged 2 commits into from
Jul 2, 2024
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
4 changes: 3 additions & 1 deletion src/Widgets/SourceView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ namespace Scratch.Widgets {
public void go_to_line (int line, int offset = 0) {
Gtk.TextIter it;
buffer.get_iter_at_line (out it, line - 1);
it.forward_chars (offset);
// Ensures offset is set to start of line when column is not set
// offset = column - 1
it.forward_chars (offset == -1 ? 0 : offset);
scroll_to_iter (it, 0, false, 0, 0);
buffer.place_cursor (it);
}
Expand Down