MCPcopy Create free account
hub / github.com/gokcehan/lf / insert

Function insert

eval.go:811–992  ·  view source on GitHub ↗
(app *app, arg string)

Source from the content-addressed store, hash-verified

809}
810
811func insert(app *app, arg string) {
812 switch {
813 case gOpts.incsearch && (app.ui.cmdPrefix == "/" || app.ui.cmdPrefix == "?"):
814 app.ui.cmdAccLeft += arg
815 update(app)
816 case gOpts.incfilter && app.ui.cmdPrefix == "filter: ":
817 app.ui.cmdAccLeft += arg
818 update(app)
819 case app.ui.cmdPrefix == "find: ":
820 app.nav.find = app.ui.cmdAccLeft + arg + app.ui.cmdAccRight
821
822 if gOpts.findlen == 0 {
823 switch app.nav.findSingle() {
824 case 0:
825 app.ui.echoerrf("find: pattern not found: %s", app.nav.find)
826 case 1:
827 app.ui.loadFile(app, true)
828 default:
829 app.ui.cmdAccLeft += arg
830 return
831 }
832 } else {
833 if len(app.nav.find) < gOpts.findlen {
834 app.ui.cmdAccLeft += arg
835 return
836 }
837
838 if moved, found := app.nav.findNext(); !found {
839 app.ui.echoerrf("find: pattern not found: %s", app.nav.find)
840 } else if moved {
841 app.ui.loadFile(app, true)
842 }
843 }
844
845 normal(app)
846 case app.ui.cmdPrefix == "find-back: ":
847 app.nav.find = app.ui.cmdAccLeft + arg + app.ui.cmdAccRight
848
849 if gOpts.findlen == 0 {
850 switch app.nav.findSingle() {
851 case 0:
852 app.ui.echoerrf("find-back: pattern not found: %s", app.nav.find)
853 case 1:
854 app.ui.loadFile(app, true)
855 default:
856 app.ui.cmdAccLeft += arg
857 return
858 }
859 } else {
860 if len(app.nav.find) < gOpts.findlen {
861 app.ui.cmdAccLeft += arg
862 return
863 }
864
865 if moved, found := app.nav.findPrev(); !found {
866 app.ui.echoerrf("find-back: pattern not found: %s", app.nav.find)
867 } else if moved {
868 app.ui.loadFile(app, true)

Callers 1

evalMethod · 0.85

Calls 15

updateFunction · 0.85
normalFunction · 0.85
remoteFunction · 0.85
cdFunction · 0.85
exitCompMenuFunction · 0.85
findSingleMethod · 0.80
echoerrfMethod · 0.80
loadFileMethod · 0.80
findNextMethod · 0.80
findPrevMethod · 0.80
delMethod · 0.80
unselectMethod · 0.80

Tested by

no test coverage detected