@@ -3,6 +3,7 @@ package controllers
33import (
44 "errors"
55 "fmt"
6+ "path/filepath"
67 "strings"
78
89 "github.com/jesseduffield/gocui"
@@ -976,8 +977,8 @@ func (self *FilesController) openCopyMenu() error {
976977 DisabledReason : self .require (self .singleItemSelected ())(),
977978 Key : 'n' ,
978979 }
979- copyPathItem := & types.MenuItem {
980- Label : self .c .Tr .CopyFilePath ,
980+ copyRelativePathItem := & types.MenuItem {
981+ Label : self .c .Tr .CopyRelativeFilePath ,
981982 OnPress : func () error {
982983 if err := self .c .OS ().CopyToClipboard (node .GetPath ()); err != nil {
983984 return err
@@ -988,6 +989,18 @@ func (self *FilesController) openCopyMenu() error {
988989 DisabledReason : self .require (self .singleItemSelected ())(),
989990 Key : 'p' ,
990991 }
992+ copyAbsolutePathItem := & types.MenuItem {
993+ Label : self .c .Tr .CopyAbsoluteFilePath ,
994+ OnPress : func () error {
995+ if err := self .c .OS ().CopyToClipboard (filepath .Join (self .c .Git ().RepoPaths .RepoPath (), node .GetPath ())); err != nil {
996+ return err
997+ }
998+ self .c .Toast (self .c .Tr .FilePathCopiedToast )
999+ return nil
1000+ },
1001+ DisabledReason : self .require (self .singleItemSelected ())(),
1002+ Key : 'P' ,
1003+ }
9911004 copyFileDiffItem := & types.MenuItem {
9921005 Label : self .c .Tr .CopySelectedDiff ,
9931006 Tooltip : self .c .Tr .CopyFileDiffTooltip ,
@@ -1044,7 +1057,8 @@ func (self *FilesController) openCopyMenu() error {
10441057 Title : self .c .Tr .CopyToClipboardMenu ,
10451058 Items : []* types.MenuItem {
10461059 copyNameItem ,
1047- copyPathItem ,
1060+ copyRelativePathItem ,
1061+ copyAbsolutePathItem ,
10481062 copyFileDiffItem ,
10491063 copyAllDiff ,
10501064 },
0 commit comments