Exemple #1
0
func names(mask, suffix string, n uint, l, c uint, f, b col.Colour) (string, string) {
	//
	t, t1 := uint(len(mask)), uint(0)
	if t > 0 {
		t1 = 1 + t
	}
	scr.Save(l, c, t1+n, 1)
	if t > 0 {
		mbx.Wd(t)
		mbx.ColoursScreen()
		mbx.Write(mask, l, c)
	}
	bx.Wd(n)
	bx.Colours(f, b)
	ptSuffix = "." + suffix
	errh.Hint("falls Dateien vorhanden, auswählen F2-, dann Pfeil-/Eingabetaste, ggf. Esc")
	name := env.Par(1)
	if name == "" {
		name = str.Clr(n) // Wörkeraunt um Fehler in box/imp.go
	}
	var p uint
	if str.Contains(name, '.', &p) {
		name = str.Part(name, 0, p)
	}
	bx.Edit(&name, l, c+t1)
	str.RemSpaces(&name)
	if str.Contains(name, '.', &p) {
		name = str.Part(name, 0, p)
	}
	filename := name + ptSuffix
	a := files.NumPred(hasSuffix)
	if a > 0 {
		var d uint
		switch kbd.LastCommand(&d) {
		case kbd.Esc:
			return "", "" // str.Clr (n), ""
		case kbd.Enter:
			// entered
		case kbd.LookFor:
			i := uint(0)
			select_(aus, a, a, n, &i, l, c+t1, b, f)
			if i == a {
				return "", "" // str.Clr (n), ""
			} else {
				str.Set(&filename, files.NamePred(hasSuffix, i))
			}
		}
	}
	errh.DelHint()
	str.RemSpaces(&filename)
	if str.Contains(filename, '.', &p) {
		name = str.Part(filename, 0, p)
	}
	scr.Restore(l, c, t1+n, 1)
	return name, filename
}
Exemple #2
0
func aus(n, l, c uint, f, b col.Colour) {
	//
	N := files.NamePred(hasSuffix, n)
	var p uint
	if str.IsPart(ptSuffix, N, &p) {
		N = str.Part(N, 0, p)
	}
	bx.Colours(f, b)
	bx.Write(N, l, c)
}