OpenNew filename completion

20 views
Skip to first unread message

Aleksa Petrovic

unread,
Sep 30, 2022, 12:59:03 PM9/30/22
to niceeditor
HI, I tested this on the newest version (but it is also in 3.3.1). In a directory I have three files:
3.1 patterns.py
3.1 learn.py
3.2 patterns.py
I start Nice Editor and enter the command prompt, where I write 'on', then start writing 3.1, if I press the tab key it will give me completions, which will include all the files in the directory. So it appears that having these filenames in the current directory prevents the file requester from working properly.

uto...@gmail.com

unread,
Sep 30, 2022, 1:41:42 PM9/30/22
to niceeditor
Rather, entering on the command line "on 3<tab>" prevents the file requester from being invoked at all. Instead you are getting filename completions.

If you want the file requester, enter "on<enter>" or "on<tab>".

Aleksa Petrovic

unread,
Sep 30, 2022, 2:02:15 PM9/30/22
to niceeditor
I press 3<tab> it completes to 3., then if I press 1<tab> it will open the requester, but there are not only 3.1* files, there are all files

uto...@gmail.com

unread,
Sep 30, 2022, 2:21:25 PM9/30/22
to niceeditor
Oh, I see it now. The space is confusing the transition from command line to either autocomplete or file requester. Interesting.

Fortunately, it's easy enough to work around, but we definitely want to get this fixed.

Thanks for bringing this up!

uto...@gmail.com

unread,
Oct 3, 2022, 10:32:24 PM10/3/22
to niceeditor
The master branch at https://github.com/vigna/ne now has a fix for this particular issue, but it's still more fragile than I'd like. It's unfortunate this just missed the 3.3.2 release window. It's a fairly easy build though, if you'd like to give it a try.

Thanks again for reporting the issue.
--
Todd

Aleksa Petrovic

unread,
Oct 4, 2022, 3:21:43 PM10/4/22
to niceeditor
No problem, I will try it right away. What do you mean that it is more fragile that you'd like? Are there some edge cases?

uto...@gmail.com

unread,
Oct 5, 2022, 7:07:32 AM10/5/22
to niceeditor
There are some edge cases. For example, if the first character of your file name is a space, you'll have to double-quote the prefix you want to match on. I don't think that's so bad though, and that does work.

You're using "on" - the short form of "OpenNew", in which case getting file name tab completion makes sense. However, if you start with a different command, say "Help" or "Syntax", the tab completions you get in those cases should be lists of matching built-in commands and available syntax recognizers, respectively. But you get filename completions in those cases, too. And what should you get for commands that take no parameters, or take strings or numbers? Nothing? The "Help" page for the given command maybe? Hmm.

Perhaps "fragile" isn't the right word. Let's go with "elegant" instead. The current behavior isn't particularly elegant, especially when ne already provides those other completions in other contexts. I'm playing with a technique to make it better, but we'll have to see if it makes the code harder or easier to understand. There's some pretty obtuse logic in there now that I wouldn't mind replacing with something that can be understood on the first reading. It could be shorter, too. It also may never see the light of day, because this is a tiny corner in an infrequently visited closet of an antechamber. There are lots of things ne could do, but balancing that with the desire to keep the code base small is tricky. As Sebastiano once asked me to make that point, "When was the last time you used the Center command?"
Reply all
Reply to author
Forward
0 new messages