diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2018-02-24 23:43:22 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2018-02-24 23:43:22 +0100 |
commit | 1c1469d5522c7c7d7c03232d9c2711c5d96d3c18 (patch) | |
tree | d2bd4e1b17a4ab1cb496ae05be42daffcd4d1305 /window.go | |
parent | 9f351fc3691f30ae5b3c195ef186470987ac78f9 (diff) | |
download | poe-1c1469d5522c7c7d7c03232d9c2711c5d96d3c18.tar.gz poe-1c1469d5522c7c7d7c03232d9c2711c5d96d3c18.tar.bz2 poe-1c1469d5522c7c7d7c03232d9c2711c5d96d3c18.zip |
Bulk. Move fast and break things. Whatever.
Fixed scrolling and mouse selection in regards to soft wrap and tabstop.
Fixed empty buffer windir setting which will make new buffers start in
correct working dir.
Fixed automatic dot expansion on Open and Run.
Made commands not need a prepended ! to be considered an external command.
Diffstat (limited to 'window.go')
-rw-r--r-- | window.go | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -68,7 +68,7 @@ func NewWindow(fn string) *Window { file: &File{name: fnabs}, } - fmt.Fprintf(win.tagline, "⌘ %s%s Del", + fmt.Fprintf(win.tagline, "%s%s Del ", win.Flags(), win.Name(), ) @@ -171,6 +171,10 @@ func (win *Window) SaveFile() (int, error) { return 0, nil } + if win.isdir { + return 0, nil + } + f, err := os.OpenFile(win.NameAbs(), os.O_RDWR|os.O_CREATE, 0644) if err != nil { return 0, err @@ -221,15 +225,29 @@ func (win *Window) Name() string { } func (win *Window) NameAbs() string { + if win.file.name == FnEmptyWin { + return "" + } s, _ := filepath.Abs(win.file.name) return s } +func (win *Window) NameFromTag() string { + tstr := win.tagline.text.String() + if tstr == "" { + return "" + } + return strings.Split(tstr, " ")[0] +} + // Dir returns the working directory of current window, without trailing path separator. func (win *Window) Dir() string { if win.isdir { return win.NameAbs() } + if win.Name() == FnEmptyWin { + return baseDir + } return filepath.Dir(win.NameAbs()) } |