PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Host File Editor - "Additional lines" is moving with "Bottom" and "Top" setting

Open Lord-ZuzurNC opened this issue 3 years ago • 5 comments

Microsoft PowerToys version

0.64.0

Installation method

PowerToys auto-update

Running as admin

Yes

Area(s) with issue?

General

Steps to reproduce

Hi,

First please note I selected "General" in "Aera(s) with issue" because "Host File Editor" was not in the list.

When you add or remove a line the host file format is completely "messed up" cause the "Additional lines" are moving with the "Bottom" or "Top" setting.

✔️ Expected Behavior

When I add a line, I want this line only to be put in "Bottom" or "Top" according to the setting. And "Additional lines" to stays where they initialy was.

The Expected behavior looks like: (let's assume I set "Bottom") # Copyright (c) 1993-2009 Microsoft Copr. # # This is a sample HOST file used by Microsoft TCP/IP for Windows. [...] 1.1.1.2 test 1.1.1.3 test2 1.1.1.4 new_line_test EOF

❌ Actual Behavior

The line is put on "Bottom" (or "Top") and then the "Additional lines" (the lines Microsoft is creating by default for example) are put just after the line.

This behavior cause the following outputed file: (let's assume I set "Bottom") [...] 1.1.1.2 test 1.1.1.3 test2 1.1.1.4 new_line_test # Copyright (c) 1993-2009 Microsoft Copr. # # This is a sample HOST file used by Microsoft TCP/IP for Windows. [...] EOF

Other Software

No response

Lord-ZuzurNC avatar Nov 03 '22 11:11 Lord-ZuzurNC

@Lord-ZuzurNC Do you expect that only your new entry is is added at the bottom?

htcfreek avatar Nov 03 '22 11:11 htcfreek

Hi @htcfreek,

Yes this is what I meant, sorry if it was unclear. My new line at bottom (or top) but the "additional lines" not moving with my new line.

Lord-ZuzurNC avatar Nov 03 '22 12:11 Lord-ZuzurNC

@Lord-ZuzurNC First I have to say you that this isn't a bug. "Additional lines" means exactly this additional content with the copyright and all the description. If you add new lines/entries they were always added at the bottom. But you can sort the lines by opening the context menu of the entry and clicking the up/down commands in the Hosts Editor app.

Because we have an unclear translation for German language in the settings ui, I will open an issue for improving the settings name and add a description. I will reference to this one here as misunderstanding example.

@davidegiacometti I suggest to rename the app ui content and setting to "Additional content/Placement of additional content" and add a settings description like "Position of additional content like copyright and examples in the hosts file".

htcfreek avatar Nov 03 '22 12:11 htcfreek

I understand.

But I didn't added lines in these copyright field. When I add an entry on the host file the copyright is moved to the end (cause I have "Bottom" setting).

If it is what you expected I will have to disable that feature and continue with a text editor. I don't want all the commented part of the file (copyright part) to be moved at the bottom when I add an entry at the bottom, I want it to stay where it is: at the top of the file.

Thank you for your time.

Best Regards.

Lord-ZuzurNC avatar Nov 03 '22 13:11 Lord-ZuzurNC

@Lord-ZuzurNC The only thing you have to do is changing the setting from bottom back to top and change an entry once.

htcfreek avatar Nov 03 '22 13:11 htcfreek