Skip to content

Commit

Permalink
chore(editor): use ints instead of uints to avoid conversions (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm authored Feb 4, 2025
1 parent bea22a7 commit a21e822
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions editor/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ type Option func(editor, filename string) (args []string, pathInArgs bool)
// OpenAtLine opens the file at the given line number in supported editors.
//
// Deprecated: use LineNumber instead.
func OpenAtLine(n uint) Option { return LineNumber(n) }
func OpenAtLine(n int) Option { return LineNumber(n) }

// LineNumber opens the file at the given line number in supported editors.
func LineNumber(number uint) Option {
// LineNumber opens the file at the given line number in supported editors. If
// [number] is less than line 1, the file will be opened at line 1.
func LineNumber(number int) Option {
if number < 1 {
number = 1
}
plusLineEditors := []string{"vi", "vim", "nvim", "nano", "emacs", "kak", "gedit"}
return func(editor, filename string) ([]string, bool) {
for _, e := range plusLineEditors {
Expand Down

0 comments on commit a21e822

Please sign in to comment.