nelsam / vidar

vidar is a highly experimental Go editor, written in Go, using gxui
The Unlicense
50 stars 7 forks source link

Add check isFile to file opener #183

Closed Kvaz1r closed 5 years ago

Kvaz1r commented 5 years ago

After adding auto-completion current dir as first choice it's very easy to open some directory instead of file. This check will help user didn't get confused when he will try to save such file.

Type

Tests

I have tested locally against:

I have included automated tests:

nelsam commented 5 years ago

@Kvaz1r thanks for the fix! I've pushed an update for two things:

  1. The old code (which I wrote) was capitalizing error messages, which is considered bad practice. I basically just changed the error message to lower case.
  2. The FileOpener had access to a status.General (which can be used to show errors in the UI), but it wasn't making use of it. It now adds the error message to f.Err before returning the error, so that the user sees the message in the UI.

Let me know if it works for you and I'll merge :smiley:

Kvaz1r commented 5 years ago

Yes, it works for me.