mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	Remove now unused function handleGenericClick
This commit is contained in:
		| @@ -33,10 +33,6 @@ func (self *guiCommon) PostRefreshUpdate(context types.Context) error { | ||||
| 	return self.gui.postRefreshUpdate(context) | ||||
| } | ||||
|  | ||||
| func (self *guiCommon) HandleGenericClick(view *gocui.View) error { | ||||
| 	return self.gui.handleGenericClick(view) | ||||
| } | ||||
|  | ||||
| func (self *guiCommon) RunSubprocessAndRefresh(cmdObj oscommands.ICmdObj) error { | ||||
| 	return self.gui.runSubprocessWithSuspenseAndRefresh(cmdObj) | ||||
| } | ||||
|   | ||||
| @@ -35,10 +35,6 @@ type IGuiCommon interface { | ||||
| 	// case would be overkill, although refresh will internally call 'PostRefreshUpdate' | ||||
| 	PostRefreshUpdate(Context) error | ||||
|  | ||||
| 	// a generic click handler that can be used for any view; it handles opening | ||||
| 	// URLs in the browser when the user clicks on one | ||||
| 	HandleGenericClick(view *gocui.View) error | ||||
|  | ||||
| 	// renders string to a view without resetting its origin | ||||
| 	SetViewContent(view *gocui.View, content string) | ||||
| 	// resets cursor and origin of view. Often used before calling SetViewContent | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| package gui | ||||
|  | ||||
| import ( | ||||
| 	"regexp" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/jesseduffield/gocui" | ||||
| @@ -149,28 +148,3 @@ func (gui *Gui) postRefreshUpdate(c types.Context) error { | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // handleGenericClick is a generic click handler that can be used for any view. | ||||
| // It handles opening URLs in the browser when the user clicks on one. | ||||
| func (gui *Gui) handleGenericClick(view *gocui.View) error { | ||||
| 	cx, cy := view.Cursor() | ||||
| 	word, err := view.Word(cx, cy) | ||||
| 	if err != nil { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	// Allow URLs to be wrapped in angle brackets, and the closing bracket to | ||||
| 	// be followed by punctuation: | ||||
| 	re := regexp.MustCompile(`^<?(https://.+?)(>[,.;!]*)?$`) | ||||
| 	matches := re.FindStringSubmatch(word) | ||||
| 	if matches == nil { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	// Ignore errors (opening the link via the OS can fail if the | ||||
| 	// `os.openLink` config key references a command that doesn't exist, or | ||||
| 	// that errors when called.) | ||||
| 	_ = gui.c.OS().OpenLink(matches[1]) | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user